[Pkg-gnupg-commit] [gnupg2] 120/132: tests: Also run all OpenPGP tests using keyrings.

Daniel Kahn Gillmor dkg at fifthhorseman.net
Wed May 17 03:07:48 UTC 2017


This is an automated email from the git hooks/post-receive script.

dkg pushed a commit to branch experimental
in repository gnupg2.

commit bc01d62dc5d520e138499df5d80fb50f9e87e3e8
Author: Justus Winter <justus at g10code.com>
Date:   Thu May 11 17:17:12 2017 +0200

    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 at g10code.com>
---
 tests/openpgp/all-tests.scm | 31 +++++++++++++++++++++++--------
 tests/openpgp/defs.scm      |  4 ++++
 tests/openpgp/setup.scm     |  7 ++++---
 3 files changed, 31 insertions(+), 11 deletions(-)

diff --git a/tests/openpgp/all-tests.scm b/tests/openpgp/all-tests.scm
index 4b14c4e..6584df2 100644
--- a/tests/openpgp/all-tests.scm
+++ b/tests/openpgp/all-tests.scm
@@ -31,13 +31,28 @@
     (test::scm
      #f
      (path-join "tests" "openpgp" "setup.scm")
+     (in-srcdir "tests" "openpgp" "setup.scm"))))
+
+ (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")
-     "--" "tests" "gpg")))
+     "--use-keyring")))
 
- (map (lambda (name)
-	(test::scm setup
-		   (path-join "tests" "openpgp" name)
-		   (in-srcdir "tests" "openpgp" name)))
-      (parse-makefile-expand (in-srcdir "tests" "openpgp" "Makefile.am")
-			     (lambda (filename port key) (parse-makefile port key))
-			     "XTESTS")))
+ (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)
+	 (test::scm setup
+		    (path-join "tests" "openpgp" name)
+		    (in-srcdir "tests" "openpgp" name))) all-tests)
+  (map (lambda (name)
+	 (test::scm setup-use-keyring
+		    (string-append "<use-keyring>"
+				   (path-join "tests" "openpgp" name))
+		    (in-srcdir "tests" "openpgp" name)
+		    "--use-keyring")) all-tests)))
diff --git a/tests/openpgp/defs.scm b/tests/openpgp/defs.scm
index 8d7caed..1531dc1 100644
--- a/tests/openpgp/defs.scm
+++ b/tests/openpgp/defs.scm
@@ -328,6 +328,10 @@
   (make-test-data "random_seed" 600)
 
   (log "Creating configuration files")
+
+  (if (flag "--use-keyring" *args*)
+      (create-file "pubring.gpg"))
+
   (create-file "gpg.conf"
 	       "no-greeting"
 	       "no-secmem-warning"
diff --git a/tests/openpgp/setup.scm b/tests/openpgp/setup.scm
index 00eed53..22c89a3 100755
--- a/tests/openpgp/setup.scm
+++ b/tests/openpgp/setup.scm
@@ -19,8 +19,9 @@
 
 (load (in-srcdir "tests" "openpgp" "defs.scm"))
 
-(unless (member "--create-tarball" *args*)
-	(fail "Usage: setup.scm --create-tarball <file>"))
+(define cache (flag "--create-tarball" *args*))
+(unless (and cache (= 1 (length cache)))
+	(fail "Usage: setup.scm --create-tarball <file> [--use-keyring]"))
 
 (when (> (*verbose*) 0)
       (define (pad symbol length)
@@ -45,4 +46,4 @@
 (start-agent)
 (create-legacy-gpghome)
 (stop-agent)
-(call-check `(,(tool 'gpgtar) --create --output ,(cadr *args*) "."))
+(call-check `(,(tool 'gpgtar) --create --output ,(car cache) "."))

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-gnupg/gnupg2.git



More information about the Pkg-gnupg-commit mailing list