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

tests: Also run all OpenPGP tests using keyrings.

* tests/openpgp/all-tests.scm: Run each test twice, once with public
keys stored in a keybox, once with a keyring.
* tests/openpgp/defs.scm (create-gpghome): Create a public keyring to
make GnuPG use that instead of creating a keybox if '--use-keyring' is
given.
* tests/openpgp/setup.scm: Fix flag handling and usage.
--

This parametrizes the OpenPGP tests.  With this change, the test suite
is able to detect problems with the keyring store, e.g. like the one
fixed in 22739433e98be80e46fe7d01d52a9627c1aebaae.

GnuPG-bug-id: 3080
Signed-off-by: Justus Winter <justus@g10code.com>
This commit is contained in:
Justus Winter 2017-05-11 17:17:12 +02:00
parent f4365790da
commit bc01d62dc5
No known key found for this signature in database
GPG Key ID: DD1A52F9DA8C9020
3 changed files with 32 additions and 12 deletions

View File

@ -31,13 +31,28 @@
(test::scm (test::scm
#f #f
(path-join "tests" "openpgp" "setup.scm") (path-join "tests" "openpgp" "setup.scm")
(in-srcdir "tests" "openpgp" "setup.scm") (in-srcdir "tests" "openpgp" "setup.scm"))))
"--" "tests" "gpg")))
(define setup-use-keyring
(make-environment-cache
(test::scm
#f
(string-append "<use-keyring>" (path-join "tests" "openpgp" "setup.scm"))
(in-srcdir "tests" "openpgp" "setup.scm")
"--use-keyring")))
(define all-tests
(parse-makefile-expand (in-srcdir "tests" "openpgp" "Makefile.am")
(lambda (filename port key) (parse-makefile port key))
"XTESTS"))
(append
(map (lambda (name) (map (lambda (name)
(test::scm setup (test::scm setup
(path-join "tests" "openpgp" name) (path-join "tests" "openpgp" name)
(in-srcdir "tests" "openpgp" name))) (in-srcdir "tests" "openpgp" name))) all-tests)
(parse-makefile-expand (in-srcdir "tests" "openpgp" "Makefile.am") (map (lambda (name)
(lambda (filename port key) (parse-makefile port key)) (test::scm setup-use-keyring
"XTESTS"))) (string-append "<use-keyring>"
(path-join "tests" "openpgp" name))
(in-srcdir "tests" "openpgp" name)
"--use-keyring")) all-tests)))

View File

@ -328,6 +328,10 @@
(make-test-data "random_seed" 600) (make-test-data "random_seed" 600)
(log "Creating configuration files") (log "Creating configuration files")
(if (flag "--use-keyring" *args*)
(create-file "pubring.gpg"))
(create-file "gpg.conf" (create-file "gpg.conf"
"no-greeting" "no-greeting"
"no-secmem-warning" "no-secmem-warning"

View File

@ -19,8 +19,9 @@
(load (in-srcdir "tests" "openpgp" "defs.scm")) (load (in-srcdir "tests" "openpgp" "defs.scm"))
(unless (member "--create-tarball" *args*) (define cache (flag "--create-tarball" *args*))
(fail "Usage: setup.scm --create-tarball <file>")) (unless (and cache (= 1 (length cache)))
(fail "Usage: setup.scm --create-tarball <file> [--use-keyring]"))
(when (> (*verbose*) 0) (when (> (*verbose*) 0)
(define (pad symbol length) (define (pad symbol length)
@ -45,4 +46,4 @@
(start-agent) (start-agent)
(create-legacy-gpghome) (create-legacy-gpghome)
(stop-agent) (stop-agent)
(call-check `(,(tool 'gpgtar) --create --output ,(cadr *args*) ".")) (call-check `(,(tool 'gpgtar) --create --output ,(car cache) "."))