From: Marcus Brinkmann Date: Tue, 27 May 2003 05:07:19 +0000 (+0000) Subject: 2003-05-27 Marcus Brinkmann X-Git-Tag: gpgme-1.2.0@1385~612 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=b85d9ceef66f78957c18d2f36d25ebef910d5545;p=gpgme.git 2003-05-27 Marcus Brinkmann * gpg/Makefile.am (TESTS): Order t-keylist and t-keylist-sig after t-import. * gpg/t-edit.c (edit_fnc): Work around gpg 1.2.2 bug by resetting primary uid after setting expiration date. * gpg/t-keylist.c: Change order of user IDs. * gpg/t-keylist-sig.c: Likewise. * gpg/t-import.c: Add support for gpg in CVS. --- diff --git a/trunk/tests/ChangeLog b/trunk/tests/ChangeLog index f31112a..98686fd 100644 --- a/trunk/tests/ChangeLog +++ b/trunk/tests/ChangeLog @@ -1,3 +1,13 @@ +2003-05-27 Marcus Brinkmann + + * gpg/Makefile.am (TESTS): Order t-keylist and t-keylist-sig after + t-import. + * gpg/t-edit.c (edit_fnc): Work around gpg 1.2.2 bug by resetting + primary uid after setting expiration date. + * gpg/t-keylist.c: Change order of user IDs. + * gpg/t-keylist-sig.c: Likewise. + * gpg/t-import.c: Add support for gpg in CVS. + 2003-05-27 Marcus Brinkmann * t-data.c: Remove TEST_OUT_CB. diff --git a/trunk/tests/gpg/Makefile.am b/trunk/tests/gpg/Makefile.am index 9120785..11ab0b0 100644 --- a/trunk/tests/gpg/Makefile.am +++ b/trunk/tests/gpg/Makefile.am @@ -23,9 +23,11 @@ GPG = @GPG@ TESTS_ENVIRONMENT = GNUPGHOME=. GPG_AGENT_INFO= +# The keylist test must come after the import test. TESTS = t-encrypt t-encrypt-sym t-encrypt-sign t-sign t-signers \ - t-decrypt t-verify t-decrypt-verify t-keylist t-keylist-sig \ - t-export t-import t-trustlist t-eventloop t-edit + t-decrypt t-verify t-decrypt-verify \ + t-export t-import t-trustlist t-eventloop t-edit \ + t-keylist t-keylist-sig CLEANFILES = secring.gpg pubring.gpg trustdb.gpg DISTCLEANFILES = pubring.gpg~ random_seed diff --git a/trunk/tests/gpg/t-edit.c b/trunk/tests/gpg/t-edit.c index 74f0cde..fb2f62f 100644 --- a/trunk/tests/gpg/t-edit.c +++ b/trunk/tests/gpg/t-edit.c @@ -92,6 +92,17 @@ edit_fnc (void *opaque, gpgme_status_code_t status, const char *args, int fd) case 1: result = "expire"; break; + + /* Work around a bug in GPG 1.2.2, which causes the + primary UID to change when setting the expiration + date. */ + case 2: + result = "1"; + break; + case 3: + result = "primary"; + break; + default: result = "quit"; break; diff --git a/trunk/tests/gpg/t-import.c b/trunk/tests/gpg/t-import.c index 3f500a2..bea6a0d 100644 --- a/trunk/tests/gpg/t-import.c +++ b/trunk/tests/gpg/t-import.c @@ -105,7 +105,10 @@ check_result (gpgme_import_result_t result, char *fpr, int secret) result->new_sub_keys); exit (1); } - if (result->new_signatures != 0) + if ((secret + && ((result->secret_imported == 0 && result->new_signatures != 0) + || (result->secret_imported == 1 && result->new_signatures != 1))) + || (!secret && result->new_signatures != 0)) { fprintf (stderr, "Unexpected number of new signatures %i\n", result->new_signatures); @@ -146,10 +149,22 @@ check_result (gpgme_import_result_t result, char *fpr, int secret) result->not_imported); exit (1); } - if (!result->imports || result->imports->next) + if (secret) { - fprintf (stderr, "Unexpected number of status reports\n"); - exit (1); + if (!result->imports + || (result->imports->next && result->imports->next->next)) + { + fprintf (stderr, "Unexpected number of status reports\n"); + exit (1); + } + } + else + { + if (!result->imports || result->imports->next) + { + fprintf (stderr, "Unexpected number of status reports\n"); + exit (1); + } } if (strcmp (fpr, result->imports->fpr)) { @@ -157,25 +172,52 @@ check_result (gpgme_import_result_t result, char *fpr, int secret) result->imports->fpr); exit (1); } + if (result->imports->next && strcmp (fpr, result->imports->next->fpr)) + { + fprintf (stderr, "Unexpected fingerprint on second status %s\n", + result->imports->next->fpr); + exit (1); + } if (result->imports->result != 0) { fprintf (stderr, "Unexpected status result %s\n", gpgme_strerror (result->imports->result)); exit (1); } - if ((secret - && ((result->secret_imported == 0 - && result->imports->status != GPGME_IMPORT_SECRET) - || (result->secret_imported == 1 - && result->imports->status != (GPGME_IMPORT_SECRET | GPGME_IMPORT_NEW)))) - || (!secret - && ((result->imported == 0 && result->imports->status != 0) - || (result->imported == 1 - && result->imports->status != GPGME_IMPORT_NEW)))) - { - fprintf (stderr, "Unexpected status %i\n", - result->imports->status); - exit (1); + if (secret) + { + if (result->secret_imported == 0) + { + if (result->imports->status != GPGME_IMPORT_SECRET) + { + fprintf (stderr, "Unexpected status %i\n", + result->imports->status); + exit (1); + } + } + else + { + if (result->imports->status + != (GPGME_IMPORT_SECRET | GPGME_IMPORT_NEW) + || !result->imports->next + || result->imports->next->status != GPGME_IMPORT_SIG) + { + fprintf (stderr, "Unexpected status %i\n", + result->imports->status); + exit (1); + } + } + } + else + { + if ((result->imported == 0 && result->imports->status != 0) + || (result->imported == 1 + && result->imports->status != GPGME_IMPORT_NEW)) + { + fprintf (stderr, "Unexpected status %i\n", + result->imports->status); + exit (1); + } } } diff --git a/trunk/tests/gpg/t-keylist-sig.c b/trunk/tests/gpg/t-keylist-sig.c index 46260bf..63251ad 100644 --- a/trunk/tests/gpg/t-keylist-sig.c +++ b/trunk/tests/gpg/t-keylist-sig.c @@ -62,15 +62,15 @@ struct keys[] = { { "A0FF4590BB6122EDEF6E3C542D727CC768697734", "6AE6D7EE46A871F8", - { { "Alpha Test", "demo key", "alpha@example.net", + { { "Alfa Test", "demo key", "alfa@example.net", { GPGME_PK_DSA, "2D727CC768697734", - "Alpha Test", "demo key", "alpha@example.net", 19, 1 } }, - { "Alice", "demo key", NULL, + "Alfa Test", "demo key", "alfa@example.net", 19, 1 } }, + { "Alpha Test", "demo key", "alpha@example.net", { GPGME_PK_DSA, "2D727CC768697734", - "Alpha Test", "demo key", "alpha@example.net", 19, 1 } }, - { "Alfa Test", "demo key", "alfa@example.net", + "Alfa Test", "demo key", "alfa@example.net", 19, 1 } }, + { "Alice", "demo key", NULL, { GPGME_PK_DSA, "2D727CC768697734", - "Alpha Test", "demo key", "alpha@example.net", 19, 1 } } } }, + "Alfa Test", "demo key", "alfa@example.net", 19, 1 } } } }, { NULL } }; diff --git a/trunk/tests/gpg/t-keylist.c b/trunk/tests/gpg/t-keylist.c index 45e46a0..a4c46ae 100644 --- a/trunk/tests/gpg/t-keylist.c +++ b/trunk/tests/gpg/t-keylist.c @@ -52,9 +52,9 @@ struct keys[] = { { "A0FF4590BB6122EDEF6E3C542D727CC768697734", "6AE6D7EE46A871F8", - { { "Alpha Test", "demo key", "alpha@example.net" }, - { "Alice", "demo key", NULL }, - { "Alfa Test", "demo key", "alfa@example.net" } } }, + { { "Alfa Test", "demo key", "alfa@example.net" }, + { "Alpha Test", "demo key", "alpha@example.net" }, + { "Alice", "demo key", NULL } } }, { "61EE841A2A27EB983B3B3C26413F4AF31AFDAB6C", "E71E72ACBC43DA60", { { "Charlie Test", "demo key", "charlie@example.net" } } }, { "3531152DE293E26A07F504BC318C1FAEFAEF6D1B", "B5C79E1A7272144D",