1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-12-22 10:19:57 +01:00

tests: Integrate --use-keyboxd into the OpenPGP test suite.

* tests/openpgp/all-tests.scm (all-tests): Replace extended-key-format
mode with a new keyboxd mode.
* tests/openpgp/defs.scm (create-gpghome): Ditto.
* tests/openpgp/gpgv.scm: Adjust for keyboxd mode.
* tests/openpgp/issue2419.scm: Fix to allow setting a log-file into
gpg.conf for debugging.

Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
Werner Koch 2020-09-24 10:35:05 +02:00
parent 25ad3c22d7
commit b19a60c6f7
No known key found for this signature in database
GPG Key ID: E3FDFF218E45B72B
4 changed files with 38 additions and 13 deletions

View File

@ -45,7 +45,7 @@
(string-append "--" variant))))
(define setup-use-keyring (setup* "use-keyring"))
(define setup-extended-key-format (setup* "extended-key-format"))
(define setup-use-keyboxd (setup* "use-keyboxd"))
(define all-tests
(parse-makefile-expand "Makefile"
@ -55,24 +55,27 @@
(define tests
(map (lambda (name)
(test::scm setup
(path-join "tests" "openpgp" name)
(qualify (path-join "tests" "openpgp" name) "standard")
(in-srcdir "tests" "openpgp" name))) all-tests))
(when *run-all-tests*
(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
(map (lambda (name)
(test::scm setup-use-keyring
(qualify (path-join "tests" "openpgp" name)
"use-keyring")
"keyring")
(in-srcdir "tests" "openpgp" name)
"--use-keyring")) all-tests)
(map (lambda (name)
(test::scm setup-extended-key-format
(qualify (path-join "tests" "openpgp" name)
"extended-key-format")
(in-srcdir "tests" "openpgp" name)
"--extended-key-format")) all-tests))))
)))
tests)

View File

@ -336,6 +336,8 @@
(create-file "pubring.gpg"))
(create-file "gpg.conf"
;;"log-file socket:///tmp/S.wklog"
;;"verbose"
"no-greeting"
"no-secmem-warning"
"no-permission-warning"
@ -349,14 +351,20 @@
(string-append "agent-program "
(tool 'gpg-agent)
"|--debug-quick-random\n")
(if (flag "--use-keyboxd" *args*)
"use-keyboxd" "#use-keyboxd")
)
(create-file "keyboxd.conf"
;;"log-file socket:///tmp/S.wklog"
;;"verbose"
;;"debug ipc"
)
(create-file "gpg-agent.conf"
"allow-preset-passphrase"
"no-grab"
"enable-ssh-support"
"s2k-count 65536"
(if (flag "--extended-key-format" *args*)
"enable-extended-key-format" "#enable-extended-key-format")
(string-append "pinentry-program " (tool 'pinentry))
"disable-scdaemon"))
@ -505,5 +513,7 @@
(set! gpg `(,@valgrind ,@gpg)))
;;(set! *args* (append *args* (list "--use-keyboxd")))
;; end

View File

@ -21,7 +21,16 @@
(load (in-srcdir "tests" "openpgp" "signed-messages.scm"))
(setup-legacy-environment)
(define keyring (if (file-exists? "pubring.kbx") "pubring.kbx" "pubring.gpg"))
;; In keyboxd mode we need to export all keys first
(if (flag "--use-keyboxd" *args*)
(call-check `(,@GPG --quiet --yes
--export --yes --batch -o mytrustedkeys.gpg)))
(define keyring (if (flag "--use-keyboxd" *args*)
"mytrustedkeys.gpg"
(if (file-exists? "pubring.kbx")
"pubring.kbx"
"pubring.gpg")))
;;
;; Two simple tests to check that verify fails for bad input data
@ -66,6 +75,9 @@
;; Need to import the ed25519 sample key used for the next two tests.
(call-check `(,@gpg --quiet --yes
--import ,(in-srcdir "tests" "openpgp" key-file2)))
(if (flag "--use-keyboxd" *args*)
(call-check `(,@GPG --quiet --yes
--export --yes --batch -o mytrustedkeys.gpg)))
(for-each-p
"Checking that a valid Ed25519 signature is verified as such"
(lambda (armored-file)

View File

@ -25,5 +25,5 @@
(onebyte)
(dearmor (in-srcdir "tests" "openpgp" "samplemsgs/issue2419.asc") onebyte)
(catch (assert (string-contains? (car *error*) "invalid packet"))
(call-popen `(,@GPG --list-packets ,onebyte) "")
(call-popen `(,@GPG --log-file - --list-packets ,onebyte) "")
(fail "Expected an error but got none")))