summaryrefslogtreecommitdiff
path: root/tests/openpgp
diff options
context:
space:
mode:
authorDongHun Kwak <dh0128.kwak@samsung.com>2022-09-16 07:45:32 +0900
committerDongHun Kwak <dh0128.kwak@samsung.com>2022-09-16 07:45:32 +0900
commit49f8cdceaa631ca9754ff27046b4b8e4a217465a (patch)
tree312692f0ce25d4bb3ab21323a188b9318de2a357 /tests/openpgp
parentcd977f94e1b88bcb4a4dcc4bda48b4ec3a5e2e9f (diff)
downloadgpg2-49f8cdceaa631ca9754ff27046b4b8e4a217465a.tar.gz
gpg2-49f8cdceaa631ca9754ff27046b4b8e4a217465a.tar.bz2
gpg2-49f8cdceaa631ca9754ff27046b4b8e4a217465a.zip
Imported Upstream version 2.3.7upstream/2.3.7
Diffstat (limited to 'tests/openpgp')
-rw-r--r--tests/openpgp/Makefile.am3
-rw-r--r--tests/openpgp/Makefile.in80
-rw-r--r--tests/openpgp/all-tests.scm28
-rwxr-xr-xtests/openpgp/quick-key-manipulation.scm6
-rw-r--r--tests/openpgp/run-tests.scm31
5 files changed, 115 insertions, 33 deletions
diff --git a/tests/openpgp/Makefile.am b/tests/openpgp/Makefile.am
index be3e350..5c99a04 100644
--- a/tests/openpgp/Makefile.am
+++ b/tests/openpgp/Makefile.am
@@ -86,6 +86,7 @@ XTESTS = \
trust-pgp-1.scm \
trust-pgp-2.scm \
trust-pgp-3.scm \
+ trust-pgp-4.scm \
gpgtar.scm \
use-exact-key.scm \
default-key.scm \
@@ -277,8 +278,6 @@ CLEANFILES = prepared.stamp x y yy z out err $(data_files) \
gnupg-test.stop random_seed gpg-agent.log tofu.db \
passphrases sshcontrol S.gpg-agent.ssh report.xml
-XTESTS += trust-pgp-4.scm
-
clean-local:
-rm -rf private-keys-v1.d openpgp-revocs.d tofu.d gpgtar.d
diff --git a/tests/openpgp/Makefile.in b/tests/openpgp/Makefile.in
index 83c0687..a4500e0 100644
--- a/tests/openpgp/Makefile.in
+++ b/tests/openpgp/Makefile.in
@@ -460,23 +460,69 @@ TESTS_ENVIRONMENT = LC_ALL=C \
GNUPG_BUILD_ROOT="$(abs_top_builddir)" \
GPGSCM_PATH="$(abs_top_srcdir)/tests/gpgscm"
-XTESTS = version.scm enarmor.scm mds.scm decrypt.scm \
- decrypt-multifile.scm decrypt-dsa.scm decrypt-session-key.scm \
- decrypt-unwrap-verify.scm sigs.scm sigs-dsa.scm encrypt.scm \
- encrypt-multifile.scm encrypt-dsa.scm compression.scm seat.scm \
- clearsig.scm encryptp.scm detach.scm detachm.scm armsigs.scm \
- armencrypt.scm armencryptp.scm signencrypt.scm \
- signencrypt-dsa.scm armsignencrypt.scm armdetach.scm \
- armdetachm.scm genkey1024.scm conventional.scm \
- conventional-mdc.scm multisig.scm verify.scm \
- verify-multifile.scm gpgv.scm gpgv-forged-keyring.scm \
- armor.scm import.scm import-revocation-certificate.scm ecc.scm \
- 4gb-packet.scm tofu.scm trust-pgp-1.scm trust-pgp-2.scm \
- trust-pgp-3.scm gpgtar.scm use-exact-key.scm default-key.scm \
- export.scm ssh-import.scm ssh-export.scm \
- quick-key-manipulation.scm key-selection.scm delete-keys.scm \
- gpgconf.scm issue2015.scm issue2346.scm issue2417.scm \
- issue2419.scm issue2929.scm issue2941.scm trust-pgp-4.scm
+XTESTS = \
+ version.scm \
+ enarmor.scm \
+ mds.scm \
+ decrypt.scm \
+ decrypt-multifile.scm \
+ decrypt-dsa.scm \
+ decrypt-session-key.scm \
+ decrypt-unwrap-verify.scm \
+ sigs.scm \
+ sigs-dsa.scm \
+ encrypt.scm \
+ encrypt-multifile.scm \
+ encrypt-dsa.scm \
+ compression.scm \
+ seat.scm \
+ clearsig.scm \
+ encryptp.scm \
+ detach.scm \
+ detachm.scm \
+ armsigs.scm \
+ armencrypt.scm \
+ armencryptp.scm \
+ signencrypt.scm \
+ signencrypt-dsa.scm \
+ armsignencrypt.scm \
+ armdetach.scm \
+ armdetachm.scm \
+ genkey1024.scm \
+ conventional.scm \
+ conventional-mdc.scm \
+ multisig.scm \
+ verify.scm \
+ verify-multifile.scm \
+ gpgv.scm \
+ gpgv-forged-keyring.scm \
+ armor.scm \
+ import.scm \
+ import-revocation-certificate.scm \
+ ecc.scm \
+ 4gb-packet.scm \
+ tofu.scm \
+ trust-pgp-1.scm \
+ trust-pgp-2.scm \
+ trust-pgp-3.scm \
+ trust-pgp-4.scm \
+ gpgtar.scm \
+ use-exact-key.scm \
+ default-key.scm \
+ export.scm \
+ ssh-import.scm \
+ ssh-export.scm \
+ quick-key-manipulation.scm \
+ key-selection.scm \
+ delete-keys.scm \
+ gpgconf.scm \
+ issue2015.scm \
+ issue2346.scm \
+ issue2417.scm \
+ issue2419.scm \
+ issue2929.scm \
+ issue2941.scm
+
TEST_FILES = pubring.asc secring.asc plain-1o.asc plain-2o.asc plain-3o.asc \
plain-1.asc plain-2.asc plain-3.asc plain-1-pgp.asc \
plain-largeo.asc plain-large.asc \
diff --git a/tests/openpgp/all-tests.scm b/tests/openpgp/all-tests.scm
index 046012c..98a8a65 100644
--- a/tests/openpgp/all-tests.scm
+++ b/tests/openpgp/all-tests.scm
@@ -48,10 +48,17 @@
(define setup-use-keyboxd (setup* "use-keyboxd"))
(define all-tests
- (parse-makefile-expand "Makefile"
+ (parse-makefile-expand (in-srcdir "tests" "openpgp" "Makefile.am")
(lambda (filename port key) (parse-makefile port key))
"XTESTS"))
+ (define keyboxd-enabled?
+ ;; Parse the variable "libexec_PROGRAMS" in kbx/Makefile
+ (not (null?
+ (parse-makefile-expand (in-objdir "kbx" "Makefile")
+ (lambda (filename port key) (parse-makefile port key))
+ "libexec_PROGRAMS"))))
+
(define tests
(map (lambda (name)
(test::scm setup
@@ -62,20 +69,21 @@
(set! tests
(append
tests
- ;; The second pass uses the keyboxd
- (map (lambda (name)
- (test::scm setup-use-keyboxd
- (qualify (path-join "tests" "openpgp" name)
- "keyboxd")
- (in-srcdir "tests" "openpgp" name)
- "--use-keyboxd")) all-tests)
- ;; The third pass uses the legact pubring.gpg
+ ;; The second pass uses the keyboxd
+ (if keyboxd-enabled?
+ (map (lambda (name)
+ (test::scm setup-use-keyboxd
+ (qualify (path-join "tests" "openpgp" name)
+ "keyboxd")
+ (in-srcdir "tests" "openpgp" name)
+ "--use-keyboxd")) all-tests))
+ ;; The third pass uses the legact pubring.gpg
(map (lambda (name)
(test::scm setup-use-keyring
(qualify (path-join "tests" "openpgp" name)
"keyring")
(in-srcdir "tests" "openpgp" name)
"--use-keyring")) all-tests)
- )))
+ )))
tests)
diff --git a/tests/openpgp/quick-key-manipulation.scm b/tests/openpgp/quick-key-manipulation.scm
index 2023f17..6cdf19a 100755
--- a/tests/openpgp/quick-key-manipulation.scm
+++ b/tests/openpgp/quick-key-manipulation.scm
@@ -34,6 +34,8 @@
(define alpha "Alpha <alpha@invalid.example.net>")
(define bravo "Bravo <bravo@invalid.example.net>")
(define charlie "Charlie <charlie@invalid.example.net>")
+(define delta "Delta <delta@invalid.example.net>")
+(define deltahash "359DC5EFF98B14A58AAA615C638E8BD0CEDA537B")
(define (key-data key)
(filter (lambda (x) (or (string=? (car x) "pub")
@@ -87,6 +89,10 @@
(info "Checking that we can revoke a user ID...")
(call-check `(,@GPG --quick-revoke-uid ,(exact bravo) ,alpha))
+(info "Checking that we can revoke a user ID by its hash...")
+(call-check `(,@GPG --quick-add-uid ,(exact bravo) ,delta))
+(call-check `(,@GPG --quick-revoke-uid ,(exact bravo) ,deltahash))
+
(info "Checking that we get an error revoking a non-existent user ID.")
(catch '()
(call-check `(,@GPG --quick-revoke-uid ,(exact bravo) ,charlie))
diff --git a/tests/openpgp/run-tests.scm b/tests/openpgp/run-tests.scm
index d4914bd..8f94359 100644
--- a/tests/openpgp/run-tests.scm
+++ b/tests/openpgp/run-tests.scm
@@ -32,11 +32,34 @@
(path-join "tests" "openpgp" "setup.scm")
(in-srcdir "tests" "openpgp" "setup.scm"))))
+(define (qualify path variant)
+ (string-append "<" variant ">" path))
+
+(define (setup* variant)
+ (make-environment-cache
+ (test::scm
+ #f
+ (qualify (path-join "tests" "openpgp" "setup.scm") variant)
+ (in-srcdir "tests" "openpgp" "setup.scm")
+ (string-append "--" variant))))
+
+(define setup-use-keyboxd (setup* "use-keyboxd"))
+(define use-keyboxd? (or (and (not (null? *args*))
+ (string=? "--use-keyboxd" (car *args*)))
+ (string=? "keyboxd" (getenv "GPGSCM_TEST_VARIANT"))))
+
(define tests (filter (lambda (arg) (not (string-prefix? arg "--"))) *args*))
(run-tests (if (null? tests)
(load-tests "tests" "openpgp")
- (map (lambda (name)
- (test::scm setup
- (path-join "tests" "openpgp" name)
- (in-srcdir "tests" "openpgp" name))) tests)))
+ (if use-keyboxd?
+ (map (lambda (name)
+ (test::scm setup-use-keyboxd
+ (qualify (path-join "tests" "openpgp" name)
+ "keyboxd")
+ (in-srcdir "tests" "openpgp" name)
+ "--use-keyboxd")) tests)
+ (map (lambda (name)
+ (test::scm setup
+ (path-join "tests" "openpgp" name)
+ (in-srcdir "tests" "openpgp" name))) tests))))