From f8867f27074b9371e5be8376360d75e97c2bbdd2 Mon Sep 17 00:00:00 2001 From: Marcus Brinkmann Date: Sun, 14 Sep 2003 00:30:53 +0000 Subject: [PATCH] 2003-09-14 Marcus Brinkmann * gpg/t-import.c (main): Likewise. * gpg/t-keylist-sig.c (main): Likewise. * gpg/t-keylist.c (main): Likewise. * gpg/t-sign.c (main): Likewise. * gpg/t-signers.c (main): Likewise. * gpg/t-trustlist.c (main): Likewise. * gpgsm/t-support.h: Include and . (init_gpgme): New function. * gpg/t-support.h: Likewise. * gpgsm/t-verify.c (main): Call init_gpgme. * gpgsm/t-decrypt.c (main): Likewise. * gpgsm/t-encrypt.c (main): Likewise. * gpgsm/t-export.c (main): Likewise. * gpgsm/t-genkey.c (main): Likewise. * gpgsm/t-import.c (main): Likewise. * gpgsm/t-keylist.c (main): Likewise. * gpgsm/t-sign.c (main): Likewise. * gpg/t-verify.c (main): Call init_gpgme. * gpg/t-decrypt-verify.c (main): Likewise. * gpg/t-decrypt.c (main): Likewise. * gpg/t-edit.c (main): Likewise. * gpg/t-encrypt-sign.c (main): Likewise. * gpg/t-encrypt-sym.c (main): Likewise. * gpg/t-encrypt.c (main): Likewise. * gpg/t-eventloop.c (main): Likewise. * gpg/t-export.c (main): Likewise. * gpg/t-genkey.c (main): Likewise. --- tests/ChangeLog | 30 ++++++++++++++++++++++++++++++ tests/gpg/t-decrypt-verify.c | 4 ++-- tests/gpg/t-decrypt.c | 2 ++ tests/gpg/t-edit.c | 4 ++-- tests/gpg/t-encrypt-sign.c | 3 +-- tests/gpg/t-encrypt-sym.c | 5 +---- tests/gpg/t-encrypt.c | 5 +---- tests/gpg/t-eventloop.c | 2 ++ tests/gpg/t-export.c | 2 ++ tests/gpg/t-genkey.c | 2 ++ tests/gpg/t-import.c | 2 ++ tests/gpg/t-keylist-sig.c | 3 +-- tests/gpg/t-keylist.c | 3 +-- tests/gpg/t-sign.c | 6 ++---- tests/gpg/t-signers.c | 2 ++ tests/gpg/t-support.h | 17 +++++++++++++++++ tests/gpg/t-trustlist.c | 2 ++ tests/gpg/t-verify.c | 2 ++ tests/gpgsm/t-decrypt.c | 4 ++-- tests/gpgsm/t-encrypt.c | 3 +-- tests/gpgsm/t-export.c | 3 +++ tests/gpgsm/t-genkey.c | 3 +-- tests/gpgsm/t-import.c | 3 +-- tests/gpgsm/t-keylist.c | 3 +-- tests/gpgsm/t-sign.c | 7 +------ tests/gpgsm/t-support.h | 17 +++++++++++++++++ tests/gpgsm/t-verify.c | 5 ++--- 27 files changed, 103 insertions(+), 41 deletions(-) diff --git a/tests/ChangeLog b/tests/ChangeLog index 06267512..cf68e287 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,3 +1,33 @@ +2003-09-14 Marcus Brinkmann + + * gpg/t-import.c (main): Likewise. + * gpg/t-keylist-sig.c (main): Likewise. + * gpg/t-keylist.c (main): Likewise. + * gpg/t-sign.c (main): Likewise. + * gpg/t-signers.c (main): Likewise. + * gpg/t-trustlist.c (main): Likewise. + * gpgsm/t-support.h: Include and . + (init_gpgme): New function. + * gpg/t-support.h: Likewise. + * gpgsm/t-verify.c (main): Call init_gpgme. + * gpgsm/t-decrypt.c (main): Likewise. + * gpgsm/t-encrypt.c (main): Likewise. + * gpgsm/t-export.c (main): Likewise. + * gpgsm/t-genkey.c (main): Likewise. + * gpgsm/t-import.c (main): Likewise. + * gpgsm/t-keylist.c (main): Likewise. + * gpgsm/t-sign.c (main): Likewise. + * gpg/t-verify.c (main): Call init_gpgme. + * gpg/t-decrypt-verify.c (main): Likewise. + * gpg/t-decrypt.c (main): Likewise. + * gpg/t-edit.c (main): Likewise. + * gpg/t-encrypt-sign.c (main): Likewise. + * gpg/t-encrypt-sym.c (main): Likewise. + * gpg/t-encrypt.c (main): Likewise. + * gpg/t-eventloop.c (main): Likewise. + * gpg/t-export.c (main): Likewise. + * gpg/t-genkey.c (main): Likewise. + 2003-08-14 Marcus Brinkmann * gpg/t-sign.c (check_result): Change output format for signature diff --git a/tests/gpg/t-decrypt-verify.c b/tests/gpg/t-decrypt-verify.c index a9c04afb..5cbfd0de 100644 --- a/tests/gpg/t-decrypt-verify.c +++ b/tests/gpg/t-decrypt-verify.c @@ -98,6 +98,8 @@ main (int argc, char *argv[]) const char *cipher_2_asc = make_filename ("cipher-2.asc"); char *agent_info; + init_gpgme (GPGME_PROTOCOL_OpenPGP); + err = gpgme_new (&ctx); fail_if_err (err); @@ -130,5 +132,3 @@ main (int argc, char *argv[]) gpgme_release (ctx); return 0; } - - diff --git a/tests/gpg/t-decrypt.c b/tests/gpg/t-decrypt.c index 8c18d783..bfe05b29 100644 --- a/tests/gpg/t-decrypt.c +++ b/tests/gpg/t-decrypt.c @@ -39,6 +39,8 @@ main (int argc, char *argv[]) const char *cipher_1_asc = make_filename ("cipher-1.asc"); char *agent_info; + init_gpgme (GPGME_PROTOCOL_OpenPGP); + err = gpgme_new (&ctx); fail_if_err (err); diff --git a/tests/gpg/t-edit.c b/tests/gpg/t-edit.c index d2d2e1b8..cefcbc41 100644 --- a/tests/gpg/t-edit.c +++ b/tests/gpg/t-edit.c @@ -113,6 +113,8 @@ main (int argc, char **argv) const char *pattern = "Alpha"; char *agent_info; + init_gpgme (GPGME_PROTOCOL_OpenPGP); + err = gpgme_new (&ctx); fail_if_err (err); err = gpgme_data_new (&out); @@ -141,5 +143,3 @@ main (int argc, char **argv) return 0; } - - diff --git a/tests/gpg/t-encrypt-sign.c b/tests/gpg/t-encrypt-sign.c index 858a99c3..19618c43 100644 --- a/tests/gpg/t-encrypt-sign.c +++ b/tests/gpg/t-encrypt-sign.c @@ -86,8 +86,7 @@ main (int argc, char **argv) gpgme_sign_result_t sign_result; char *agent_info; - err = gpgme_engine_check_version (GPGME_PROTOCOL_OpenPGP); - fail_if_err (err); + init_gpgme (GPGME_PROTOCOL_OpenPGP); err = gpgme_new (&ctx); fail_if_err (err); diff --git a/tests/gpg/t-encrypt-sym.c b/tests/gpg/t-encrypt-sym.c index 7c84f3dc..29a3f47c 100644 --- a/tests/gpg/t-encrypt-sym.c +++ b/tests/gpg/t-encrypt-sym.c @@ -40,8 +40,7 @@ main (int argc, char *argv[]) char *p; size_t len; - err = gpgme_engine_check_version (GPGME_PROTOCOL_OpenPGP); - fail_if_err (err); + init_gpgme (GPGME_PROTOCOL_OpenPGP); err = gpgme_new (&ctx); fail_if_err (err); @@ -90,5 +89,3 @@ main (int argc, char *argv[]) return 0; } - - diff --git a/tests/gpg/t-encrypt.c b/tests/gpg/t-encrypt.c index 11ebf3f4..756d216b 100644 --- a/tests/gpg/t-encrypt.c +++ b/tests/gpg/t-encrypt.c @@ -36,10 +36,7 @@ main (int argc, char *argv[]) gpgme_key_t key[3] = { NULL, NULL, NULL }; gpgme_encrypt_result_t result; - gpgme_check_version (0); - - err = gpgme_engine_check_version (GPGME_PROTOCOL_OpenPGP); - fail_if_err (err); + init_gpgme (GPGME_PROTOCOL_OpenPGP); err = gpgme_new (&ctx); fail_if_err (err); diff --git a/tests/gpg/t-eventloop.c b/tests/gpg/t-eventloop.c index 43e2c09b..7e8be3c3 100644 --- a/tests/gpg/t-eventloop.c +++ b/tests/gpg/t-eventloop.c @@ -168,6 +168,8 @@ main (int argc, char *argv[]) gpgme_key_t key[3] = { NULL, NULL, NULL }; int i; + init_gpgme (GPGME_PROTOCOL_OpenPGP); + for (i = 0; i < FDLIST_MAX; i++) fdlist[i].fd = -1; diff --git a/tests/gpg/t-export.c b/tests/gpg/t-export.c index a5c24fc6..44c48f93 100644 --- a/tests/gpg/t-export.c +++ b/tests/gpg/t-export.c @@ -36,6 +36,8 @@ main (int argc, char **argv) gpgme_data_t out; const char *pattern[] = { "Alpha", "Bob", NULL }; + init_gpgme (GPGME_PROTOCOL_OpenPGP); + err = gpgme_new (&ctx); fail_if_err (err); diff --git a/tests/gpg/t-genkey.c b/tests/gpg/t-genkey.c index b218122e..52bb99f2 100644 --- a/tests/gpg/t-genkey.c +++ b/tests/gpg/t-genkey.c @@ -68,6 +68,8 @@ main (int argc, char **argv) "\n"; gpgme_genkey_result_t result; + init_gpgme (GPGME_PROTOCOL_OpenPGP); + err = gpgme_new (&ctx); fail_if_err (err); diff --git a/tests/gpg/t-import.c b/tests/gpg/t-import.c index 3733d5c6..22528e01 100644 --- a/tests/gpg/t-import.c +++ b/tests/gpg/t-import.c @@ -203,6 +203,8 @@ main (int argc, char *argv[]) const char *pubkey_1_asc = make_filename ("pubkey-1.asc"); const char *seckey_1_asc = make_filename ("seckey-1.asc"); + init_gpgme (GPGME_PROTOCOL_OpenPGP); + err = gpgme_new (&ctx); fail_if_err (err); diff --git a/tests/gpg/t-keylist-sig.c b/tests/gpg/t-keylist-sig.c index 88549d26..6578eeb0 100644 --- a/tests/gpg/t-keylist-sig.c +++ b/tests/gpg/t-keylist-sig.c @@ -74,8 +74,7 @@ main (int argc, char **argv) int mode; int i = 0; - err = gpgme_engine_check_version (GPGME_PROTOCOL_OpenPGP); - fail_if_err (err); + init_gpgme (GPGME_PROTOCOL_OpenPGP); err = gpgme_new (&ctx); fail_if_err (err); diff --git a/tests/gpg/t-keylist.c b/tests/gpg/t-keylist.c index 9e68f0cc..17c35edb 100644 --- a/tests/gpg/t-keylist.c +++ b/tests/gpg/t-keylist.c @@ -113,8 +113,7 @@ main (int argc, char **argv) gpgme_keylist_result_t result; int i = 0; - err = gpgme_engine_check_version (GPGME_PROTOCOL_OpenPGP); - fail_if_err (err); + init_gpgme (GPGME_PROTOCOL_OpenPGP); err = gpgme_new (&ctx); fail_if_err (err); diff --git a/tests/gpg/t-sign.c b/tests/gpg/t-sign.c index 78e590b9..1b9d06d4 100644 --- a/tests/gpg/t-sign.c +++ b/tests/gpg/t-sign.c @@ -84,6 +84,8 @@ main (int argc, char **argv) gpgme_sign_result_t result; char *agent_info; + init_gpgme (GPGME_PROTOCOL_OpenPGP); + err = gpgme_new (&ctx); fail_if_err (err); @@ -133,7 +135,3 @@ main (int argc, char **argv) gpgme_release (ctx); return 0; } - - - - diff --git a/tests/gpg/t-signers.c b/tests/gpg/t-signers.c index d74d4479..f8288b49 100644 --- a/tests/gpg/t-signers.c +++ b/tests/gpg/t-signers.c @@ -96,6 +96,8 @@ main (int argc, char *argv[]) gpgme_sign_result_t result; char *agent_info; + init_gpgme (GPGME_PROTOCOL_OpenPGP); + err = gpgme_new (&ctx); fail_if_err (err); diff --git a/tests/gpg/t-support.h b/tests/gpg/t-support.h index e9ea283d..929a5d13 100644 --- a/tests/gpg/t-support.h +++ b/tests/gpg/t-support.h @@ -20,6 +20,8 @@ #include #include +#include +#include #include @@ -79,3 +81,18 @@ make_filename (const char *fname) strcat (buf, fname); return buf; } + + +void +init_gpgme (gpgme_protocol_t proto) +{ + gpgme_error_t err; + + gpgme_check_version (NULL); + setlocale (LC_ALL, ""); + gpgme_set_locale (NULL, LC_CTYPE, setlocale (LC_CTYPE, NULL)); + gpgme_set_locale (NULL, LC_MESSAGES, setlocale (LC_MESSAGES, NULL)); + + err = gpgme_engine_check_version (proto); + fail_if_err (err); +} diff --git a/tests/gpg/t-trustlist.c b/tests/gpg/t-trustlist.c index db10cf0c..c8c82f82 100644 --- a/tests/gpg/t-trustlist.c +++ b/tests/gpg/t-trustlist.c @@ -34,6 +34,8 @@ main (int argc, char *argv[]) gpgme_error_t err; gpgme_trust_item_t item; + init_gpgme (GPGME_PROTOCOL_OpenPGP); + err = gpgme_new (&ctx); fail_if_err (err); diff --git a/tests/gpg/t-verify.c b/tests/gpg/t-verify.c index b4912e3f..83e942f0 100644 --- a/tests/gpg/t-verify.c +++ b/tests/gpg/t-verify.c @@ -151,6 +151,8 @@ main (int argc, char *argv[]) gpgme_data_t sig, text; gpgme_verify_result_t result; + init_gpgme (GPGME_PROTOCOL_OpenPGP); + err = gpgme_new (&ctx); fail_if_err (err); diff --git a/tests/gpgsm/t-decrypt.c b/tests/gpgsm/t-decrypt.c index 21d6bd14..ca5757dc 100644 --- a/tests/gpgsm/t-decrypt.c +++ b/tests/gpgsm/t-decrypt.c @@ -49,6 +49,8 @@ main (int argc, char *argv[]) gpgme_data_t in, out; gpgme_decrypt_result_t result; + init_gpgme (GPGME_PROTOCOL_CMS); + err = gpgme_new (&ctx); fail_if_err (err); gpgme_set_protocol (ctx, GPGME_PROTOCOL_CMS); @@ -75,5 +77,3 @@ main (int argc, char *argv[]) gpgme_release (ctx); return 0; } - - diff --git a/tests/gpgsm/t-encrypt.c b/tests/gpgsm/t-encrypt.c index 4da0f727..ff61394b 100644 --- a/tests/gpgsm/t-encrypt.c +++ b/tests/gpgsm/t-encrypt.c @@ -35,8 +35,7 @@ main (int argc, char **argv) gpgme_key_t key[] = { NULL, NULL }; gpgme_encrypt_result_t result; - err = gpgme_engine_check_version (GPGME_PROTOCOL_CMS); - fail_if_err (err); + init_gpgme (GPGME_PROTOCOL_CMS); err = gpgme_new (&ctx); fail_if_err (err); diff --git a/tests/gpgsm/t-export.c b/tests/gpgsm/t-export.c index a2355e0c..ce7dadb8 100644 --- a/tests/gpgsm/t-export.c +++ b/tests/gpgsm/t-export.c @@ -34,6 +34,9 @@ main (int argc, char *argv[]) gpgme_error_t err; gpgme_data_t out; const char *pattern[] = { "DFN Top Level Certification Authority", NULL }; + + init_gpgme (GPGME_PROTOCOL_CMS); + err = gpgme_new (&ctx); fail_if_err (err); gpgme_set_protocol (ctx, GPGME_PROTOCOL_CMS); diff --git a/tests/gpgsm/t-genkey.c b/tests/gpgsm/t-genkey.c index 8b08a65b..a4d60c1e 100644 --- a/tests/gpgsm/t-genkey.c +++ b/tests/gpgsm/t-genkey.c @@ -64,8 +64,7 @@ main (int argc, char *argv[]) gpgme_genkey_result_t result; gpgme_data_t certreq; - err = gpgme_engine_check_version (GPGME_PROTOCOL_CMS); - fail_if_err (err); + init_gpgme (GPGME_PROTOCOL_CMS); err = gpgme_data_new (&certreq); fail_if_err (err); diff --git a/tests/gpgsm/t-import.c b/tests/gpgsm/t-import.c index 2b50e10e..c9c31ffd 100644 --- a/tests/gpgsm/t-import.c +++ b/tests/gpgsm/t-import.c @@ -161,8 +161,7 @@ main (int argc, char **argv) const char *cert_1 = make_filename ("cert_dfn_pca01.der"); const char *cert_2 = make_filename ("cert_dfn_pca15.der"); - err = gpgme_engine_check_version (GPGME_PROTOCOL_CMS); - fail_if_err (err); + init_gpgme (GPGME_PROTOCOL_CMS); err = gpgme_new (&ctx); fail_if_err (err); diff --git a/tests/gpgsm/t-keylist.c b/tests/gpgsm/t-keylist.c index 7e596283..b0249d12 100644 --- a/tests/gpgsm/t-keylist.c +++ b/tests/gpgsm/t-keylist.c @@ -82,8 +82,7 @@ main (int argc, char **argv) gpgme_keylist_result_t result; int i = 0; - err = gpgme_engine_check_version (GPGME_PROTOCOL_CMS); - fail_if_err (err); + init_gpgme (GPGME_PROTOCOL_CMS); err = gpgme_new (&ctx); fail_if_err (err); diff --git a/tests/gpgsm/t-sign.c b/tests/gpgsm/t-sign.c index 5fd6f069..2cfac7da 100644 --- a/tests/gpgsm/t-sign.c +++ b/tests/gpgsm/t-sign.c @@ -81,8 +81,7 @@ main (int argc, char *argv[]) gpgme_data_t in, out; gpgme_sign_result_t result; - err = gpgme_engine_check_version (GPGME_PROTOCOL_CMS); - fail_if_err (err); + init_gpgme (GPGME_PROTOCOL_CMS); err = gpgme_new (&ctx); fail_if_err (err); @@ -119,7 +118,3 @@ main (int argc, char *argv[]) gpgme_release (ctx); return 0; } - - - - diff --git a/tests/gpgsm/t-support.h b/tests/gpgsm/t-support.h index c6470515..3199b056 100644 --- a/tests/gpgsm/t-support.h +++ b/tests/gpgsm/t-support.h @@ -20,6 +20,8 @@ #include #include +#include +#include #include @@ -79,3 +81,18 @@ make_filename (const char *fname) strcat (buf, fname); return buf; } + + +void +init_gpgme (gpgme_protocol_t proto) +{ + gpgme_error_t err; + + gpgme_check_version (NULL); + setlocale (LC_ALL, ""); + gpgme_set_locale (NULL, LC_CTYPE, setlocale (LC_CTYPE, NULL)); + gpgme_set_locale (NULL, LC_MESSAGES, setlocale (LC_MESSAGES, NULL)); + + err = gpgme_engine_check_version (proto); + fail_if_err (err); +} diff --git a/tests/gpgsm/t-verify.c b/tests/gpgsm/t-verify.c index be61cbb2..c8913a91 100644 --- a/tests/gpgsm/t-verify.c +++ b/tests/gpgsm/t-verify.c @@ -119,6 +119,8 @@ main (int argc, char **argv) gpgme_data_t sig, text; gpgme_verify_result_t result; + init_gpgme (GPGME_PROTOCOL_CMS); + err = gpgme_new (&ctx); fail_if_err (err); gpgme_set_protocol (ctx, GPGME_PROTOCOL_CMS); @@ -150,6 +152,3 @@ main (int argc, char **argv) gpgme_release (ctx); return 0; } - - -