From: Marcus Brinkmann Date: Sun, 14 Sep 2003 00:30:53 +0000 (+0000) Subject: 2003-09-14 Marcus Brinkmann X-Git-Tag: gpgme-0-4-3~21 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=f8867f27074b9371e5be8376360d75e97c2bbdd2;p=gpgme.git 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. --- diff --git a/tests/ChangeLog b/tests/ChangeLog index 0626751..cf68e28 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 a9c04af..5cbfd0d 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 8c18d78..bfe05b2 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 d2d2e1b..cefcbc4 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 858a99c..19618c4 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 7c84f3d..29a3f47 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 11ebf3f..756d216 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 43e2c09..7e8be3c 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 a5c24fc..44c48f9 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 b218122..52bb99f 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 3733d5c..22528e0 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 88549d2..6578eeb 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 9e68f0c..17c35ed 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 78e590b..1b9d06d 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 d74d447..f8288b4 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 e9ea283..929a5d1 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 db10cf0..c8c82f8 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 b4912e3..83e942f 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 21d6bd1..ca5757d 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 4da0f72..ff61394 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 a2355e0..ce7dadb 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 8b08a65..a4d60c1 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 2b50e10..c9c31ff 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 7e59628..b0249d1 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 5fd6f06..2cfac7d 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 c647051..3199b05 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 be61cbb..c8913a9 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; } - - -