aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2001-09-17 10:36:05 +0000
committerWerner Koch <[email protected]>2001-09-17 10:36:05 +0000
commitb4eddd304269da30d29fc1a272237e706773ea2e (patch)
treee66cf7df026dc614793f3b56a2a5786e408359b6 /tests
parentAdded more doc entries and prepared for 0.2.3 (diff)
downloadgpgme-b4eddd304269da30d29fc1a272237e706773ea2e.tar.gz
gpgme-b4eddd304269da30d29fc1a272237e706773ea2e.zip
Fixed a keylisting bug
Diffstat (limited to '')
-rw-r--r--tests/t-keylist.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/t-keylist.c b/tests/t-keylist.c
index aa82a5b6..9a81c120 100644
--- a/tests/t-keylist.c
+++ b/tests/t-keylist.c
@@ -94,6 +94,34 @@ doit ( GpgmeCtx ctx, const char *pattern )
}
+/*
+ * Check that there are no problems when we are using two context for
+ * listing keys.
+ */
+static void
+check_two_contexts (void)
+{
+ GpgmeError err;
+ GpgmeCtx ctx1, ctx2;
+ GpgmeKey key;
+
+ err = gpgme_new(&ctx1); fail_if_err (err);
+ err = gpgme_op_keylist_start(ctx1, "", 1); fail_if_err (err);
+ err = gpgme_new(&ctx2); fail_if_err (err);
+ err = gpgme_op_keylist_start(ctx2, "", 1); fail_if_err (err);
+
+ while ( (err=gpgme_op_keylist_next(ctx2, &key)) != GPGME_EOF) {
+ gpgme_key_release (key);
+ }
+ if (err != GPGME_EOF)
+ fail_if_err (err);
+ while ( (err=gpgme_op_keylist_next(ctx1, &key)) != GPGME_EOF) {
+ gpgme_key_release (key);
+ }
+ if (err != GPGME_EOF)
+ fail_if_err (err);
+}
+
int
main (int argc, char **argv )
{
@@ -112,6 +140,9 @@ main (int argc, char **argv )
}
pattern = argc? *argv : NULL;
+ err = gpgme_check_engine();
+ fail_if_err (err);
+
err = gpgme_new (&ctx);
fail_if_err (err);
gpgme_set_keylist_mode (ctx, 1); /* no validity calculation */
@@ -121,6 +152,8 @@ main (int argc, char **argv )
} while ( loop );
gpgme_release (ctx);
+ check_two_contexts ();
+
return 0;
}