[Pkg-gnupg-commit] [gpgme] 02/53: tests: Check data after decryption

Daniel Kahn Gillmor dkg at fifthhorseman.net
Mon Oct 24 19:26:46 UTC 2016


This is an automated email from the git hooks/post-receive script.

dkg pushed a commit to branch experimental
in repository gpgme.

commit 9b38817968b90caf73f123255fe427691e82fec4
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Fri Sep 23 16:03:37 2016 +0200

    tests: Check data after decryption
    
    * tests/gpgsm/t-decrypt.c (main): Check data matches expected.
    Only print result if it does not.
---
 tests/gpgsm/t-decrypt.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/tests/gpgsm/t-decrypt.c b/tests/gpgsm/t-decrypt.c
index 658809c..81803af 100644
--- a/tests/gpgsm/t-decrypt.c
+++ b/tests/gpgsm/t-decrypt.c
@@ -54,6 +54,8 @@ main (void)
   gpgme_ctx_t ctx;
   gpgme_error_t err;
   gpgme_data_t in, out;
+  size_t len;
+  char *test_text2;
   gpgme_decrypt_result_t result;
 
   init_gpgme (GPGME_PROTOCOL_CMS);
@@ -77,10 +79,18 @@ main (void)
 	       __FILE__, __LINE__, result->unsupported_algorithm);
       exit (1);
     }
-  print_data (out);
+  test_text2 = gpgme_data_release_and_get_mem (out, &len);
+  test_text2[len] = '\0';
+  if (strcmp (test_text1, test_text2))
+    {
+      fprintf (stderr, "%s:%i: data mismatch: expected: \n\"%s\"\n"
+               "got:\n\"%s\"",
+               __FILE__, __LINE__, test_text1, test_text2);
+      exit (1);
+    }
 
+  free (test_text2);
   gpgme_data_release (in);
-  gpgme_data_release (out);
   gpgme_release (ctx);
   return 0;
 }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-gnupg/gpgme.git



More information about the Pkg-gnupg-commit mailing list