summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNIIBE Yutaka <[email protected]>2025-12-25 02:21:49 +0100
committerNIIBE Yutaka <[email protected]>2025-12-25 02:26:20 +0100
commit538d7cd52b809fcd77a554f04cd2c8ac8915732c (patch)
treef208b17477cfa5aa4b08ea42acd0e2706ff5aec4
parentw32: Fix debug print on 64-bit machine. (diff)
downloadgpgme-538d7cd52b809fcd77a554f04cd2c8ac8915732c.tar.gz
gpgme-538d7cd52b809fcd77a554f04cd2c8ac8915732c.zip
tests:gpg: Use GPGME_PINENTRY_MODE_LOOPBACK for tests.
* tests/gpg/t-decrypt-verify.c (main): Call gpgme_set_pinentry_mode. * tests/gpg/t-decrypt.c (main): Likewise. * tests/gpg/t-edit-sign.c (main): Likewise. * tests/gpg/t-edit.c (main): Likewise. * tests/gpg/t-encrypt-mixed.c (main): Likewise. * tests/gpg/t-encrypt-sign.c (main): Likewise. * tests/gpg/t-encrypt-sign.c (main): Likewise. * tests/gpg/t-encrypt-sym.c (main): Likewise. * tests/gpg/t-file-name.c (main): Likewise. * tests/gpg/t-sig-notation.c (main): Likewise. * tests/gpg/t-sign.c (main): Likewise. * tests/gpg/t-signers.c (main): Likewise. * tests/gpg/t-thread1.c (main): Likewise. * tests/gpg/Makefile.am (gpg-agent.conf): We use the passphrase_cb. -- We can't remove tests/gpg/pinentry since it's used by tests/json. Signed-off-by: NIIBE Yutaka <[email protected]>
-rw-r--r--tests/gpg/Makefile.am6
-rw-r--r--tests/gpg/t-decrypt-verify.c5
-rw-r--r--tests/gpg/t-decrypt.c5
-rw-r--r--tests/gpg/t-edit-sign.c5
-rw-r--r--tests/gpg/t-edit.c5
-rw-r--r--tests/gpg/t-encrypt-mixed.c1
-rw-r--r--tests/gpg/t-encrypt-sign.c5
-rw-r--r--tests/gpg/t-encrypt-sym.c5
-rw-r--r--tests/gpg/t-file-name.c5
-rw-r--r--tests/gpg/t-sig-notation.c5
-rw-r--r--tests/gpg/t-sign.c5
-rw-r--r--tests/gpg/t-signers.c5
-rw-r--r--tests/gpg/t-thread1.c5
13 files changed, 47 insertions, 15 deletions
diff --git a/tests/gpg/Makefile.am b/tests/gpg/Makefile.am
index a70c7a7b..170b1a7e 100644
--- a/tests/gpg/Makefile.am
+++ b/tests/gpg/Makefile.am
@@ -118,10 +118,8 @@ gpg.conf: $(srcdir)/gpg.conf.in
cp $(srcdir)/gpg.conf.in gpg.conf
gpg-agent.conf:
-# This is required for gpg2, which does not support command fd for the
-# passphrase. disable-scdaemon is required so that we don't try using
-# a key from a smartcard reader (error might be: Unusable secret key)
- echo pinentry-program $(abs_srcdir)/pinentry > ./gpg-agent.conf
+# disable-scdaemon is required so that we don't try using a key from a
+# smartcard reader (error might be: Unusable secret key)
echo disable-scdaemon >> ./gpg-agent.conf
diff --git a/tests/gpg/t-decrypt-verify.c b/tests/gpg/t-decrypt-verify.c
index 424cc817..b548aa93 100644
--- a/tests/gpg/t-decrypt-verify.c
+++ b/tests/gpg/t-decrypt-verify.c
@@ -126,7 +126,10 @@ main (int argc, char *argv[])
agent_info = getenv("GPG_AGENT_INFO");
if (!(agent_info && strchr (agent_info, ':')))
- gpgme_set_passphrase_cb (ctx, passphrase_cb, NULL);
+ {
+ gpgme_set_pinentry_mode (ctx, GPGME_PINENTRY_MODE_LOOPBACK);
+ gpgme_set_passphrase_cb (ctx, passphrase_cb, NULL);
+ }
err = gpgme_data_new_from_file (&in, cipher_2_asc, 1);
free (cipher_2_asc);
diff --git a/tests/gpg/t-decrypt.c b/tests/gpg/t-decrypt.c
index 408564d7..4128a148 100644
--- a/tests/gpg/t-decrypt.c
+++ b/tests/gpg/t-decrypt.c
@@ -56,7 +56,10 @@ main (int argc, char *argv[])
agent_info = getenv("GPG_AGENT_INFO");
if (!(agent_info && strchr (agent_info, ':')))
- gpgme_set_passphrase_cb (ctx, passphrase_cb, NULL);
+ {
+ gpgme_set_pinentry_mode (ctx, GPGME_PINENTRY_MODE_LOOPBACK);
+ gpgme_set_passphrase_cb (ctx, passphrase_cb, NULL);
+ }
err = gpgme_data_new_from_file (&in, cipher_1_asc, 1);
free (cipher_1_asc);
diff --git a/tests/gpg/t-edit-sign.c b/tests/gpg/t-edit-sign.c
index 059a912b..a2f33354 100644
--- a/tests/gpg/t-edit-sign.c
+++ b/tests/gpg/t-edit-sign.c
@@ -172,7 +172,10 @@ sign_key (const char *key_fpr, const char *signer_fpr)
agent_info = getenv("GPG_AGENT_INFO");
if (!(agent_info && strchr (agent_info, ':')))
- gpgme_set_passphrase_cb (ctx, passphrase_cb, 0);
+ {
+ gpgme_set_pinentry_mode (ctx, GPGME_PINENTRY_MODE_LOOPBACK);
+ gpgme_set_passphrase_cb (ctx, passphrase_cb, 0);
+ }
err = gpgme_get_key (ctx, signer_fpr, &signing_key, 1);
fail_if_err (err);
diff --git a/tests/gpg/t-edit.c b/tests/gpg/t-edit.c
index b34ee3f7..e18e0386 100644
--- a/tests/gpg/t-edit.c
+++ b/tests/gpg/t-edit.c
@@ -132,7 +132,10 @@ main (int argc, char **argv)
agent_info = getenv("GPG_AGENT_INFO");
if (!(agent_info && strchr (agent_info, ':')))
- gpgme_set_passphrase_cb (ctx, passphrase_cb, 0);
+ {
+ gpgme_set_pinentry_mode (ctx, GPGME_PINENTRY_MODE_LOOPBACK);
+ gpgme_set_passphrase_cb (ctx, passphrase_cb, 0);
+ }
err = gpgme_op_keylist_start (ctx, pattern, 0);
fail_if_err (err);
diff --git a/tests/gpg/t-encrypt-mixed.c b/tests/gpg/t-encrypt-mixed.c
index 4cc9d6a6..5040148c 100644
--- a/tests/gpg/t-encrypt-mixed.c
+++ b/tests/gpg/t-encrypt-mixed.c
@@ -60,6 +60,7 @@ main (void)
err = gpgme_data_new (&out);
fail_if_err (err);
+ gpgme_set_pinentry_mode (ctx, GPGME_PINENTRY_MODE_LOOPBACK);
gpgme_set_passphrase_cb (ctx, passphrase_cb, NULL);
/* A recipient for which we don't have a secret key */
diff --git a/tests/gpg/t-encrypt-sign.c b/tests/gpg/t-encrypt-sign.c
index dbdae0b6..4dda4faa 100644
--- a/tests/gpg/t-encrypt-sign.c
+++ b/tests/gpg/t-encrypt-sign.c
@@ -106,7 +106,10 @@ main (int argc, char **argv)
agent_info = getenv("GPG_AGENT_INFO");
if (!(agent_info && strchr (agent_info, ':')))
- gpgme_set_passphrase_cb (ctx, passphrase_cb, NULL);
+ {
+ gpgme_set_pinentry_mode (ctx, GPGME_PINENTRY_MODE_LOOPBACK);
+ gpgme_set_passphrase_cb (ctx, passphrase_cb, NULL);
+ }
err = gpgme_data_new_from_mem (&in, "Hallo Leute\n", 12, 0);
fail_if_err (err);
diff --git a/tests/gpg/t-encrypt-sym.c b/tests/gpg/t-encrypt-sym.c
index 127bac60..d10a9606 100644
--- a/tests/gpg/t-encrypt-sym.c
+++ b/tests/gpg/t-encrypt-sym.c
@@ -55,7 +55,10 @@ main (int argc, char *argv[])
p = getenv("GPG_AGENT_INFO");
if (!(p && strchr (p, ':')))
- gpgme_set_passphrase_cb (ctx, passphrase_cb, NULL);
+ {
+ gpgme_set_pinentry_mode (ctx, GPGME_PINENTRY_MODE_LOOPBACK);
+ gpgme_set_passphrase_cb (ctx, passphrase_cb, NULL);
+ }
err = gpgme_data_new_from_mem (&plain, text, strlen (text), 0);
fail_if_err (err);
diff --git a/tests/gpg/t-file-name.c b/tests/gpg/t-file-name.c
index 3b29e4f1..a1d1e597 100644
--- a/tests/gpg/t-file-name.c
+++ b/tests/gpg/t-file-name.c
@@ -54,7 +54,10 @@ main (void)
agent_info = getenv("GPG_AGENT_INFO");
if (!(agent_info && strchr (agent_info, ':')))
- gpgme_set_passphrase_cb (ctx, passphrase_cb, NULL);
+ {
+ gpgme_set_pinentry_mode (ctx, GPGME_PINENTRY_MODE_LOOPBACK);
+ gpgme_set_passphrase_cb (ctx, passphrase_cb, NULL);
+ }
err = gpgme_data_new_from_mem (&in, "Hallo Leute\n", 12, 0);
fail_if_err (err);
diff --git a/tests/gpg/t-sig-notation.c b/tests/gpg/t-sig-notation.c
index df45cfd5..95da481b 100644
--- a/tests/gpg/t-sig-notation.c
+++ b/tests/gpg/t-sig-notation.c
@@ -161,7 +161,10 @@ main (int argc, char *argv[])
agent_info = getenv ("GPG_AGENT_INFO");
if (!(agent_info && strchr (agent_info, ':')))
- gpgme_set_passphrase_cb (ctx, passphrase_cb, NULL);
+ {
+ gpgme_set_pinentry_mode (ctx, GPGME_PINENTRY_MODE_LOOPBACK);
+ gpgme_set_passphrase_cb (ctx, passphrase_cb, NULL);
+ }
err = gpgme_data_new_from_mem (&in, "Hallo Leute\n", 12, 0);
fail_if_err (err);
diff --git a/tests/gpg/t-sign.c b/tests/gpg/t-sign.c
index 54138241..76e85659 100644
--- a/tests/gpg/t-sign.c
+++ b/tests/gpg/t-sign.c
@@ -101,7 +101,10 @@ main (int argc, char **argv)
agent_info = getenv ("GPG_AGENT_INFO");
if (!(agent_info && strchr (agent_info, ':')))
- gpgme_set_passphrase_cb (ctx, passphrase_cb, NULL);
+ {
+ gpgme_set_pinentry_mode (ctx, GPGME_PINENTRY_MODE_LOOPBACK);
+ gpgme_set_passphrase_cb (ctx, passphrase_cb, NULL);
+ }
gpgme_set_textmode (ctx, 1);
gpgme_set_armor (ctx, 1);
diff --git a/tests/gpg/t-signers.c b/tests/gpg/t-signers.c
index cc8609a9..26c2db2e 100644
--- a/tests/gpg/t-signers.c
+++ b/tests/gpg/t-signers.c
@@ -113,7 +113,10 @@ main (int argc, char *argv[])
agent_info = getenv("GPG_AGENT_INFO");
if (!(agent_info && strchr (agent_info, ':')))
- gpgme_set_passphrase_cb (ctx, passphrase_cb, NULL);
+ {
+ gpgme_set_pinentry_mode (ctx, GPGME_PINENTRY_MODE_LOOPBACK);
+ gpgme_set_passphrase_cb (ctx, passphrase_cb, NULL);
+ }
gpgme_set_textmode (ctx, 1);
gpgme_set_armor (ctx, 1);
diff --git a/tests/gpg/t-thread1.c b/tests/gpg/t-thread1.c
index 57d00502..3c64ec24 100644
--- a/tests/gpg/t-thread1.c
+++ b/tests/gpg/t-thread1.c
@@ -112,7 +112,10 @@ thread_two (void *name)
fail_if_err (err);
if (!(agent_info && strchr (agent_info, ':')))
- gpgme_set_passphrase_cb (ctx, passphrase_cb, NULL);
+ {
+ gpgme_set_pinentry_mode (ctx, GPGME_PINENTRY_MODE_LOOPBACK);
+ gpgme_set_passphrase_cb (ctx, passphrase_cb, NULL);
+ }
err = gpgme_data_new_from_file (&in, cipher_1_asc, 1);
fail_if_err (err);