[git] GnuPG - branch, master, updated. gnupg-2.1.20-50-gcde626e

by Justus Winter cvs at cvs.gnupg.org
Tue Apr 11 11:42:19 CEST 2017


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "The GNU Privacy Guard".

The branch, master has been updated
       via  cde626e7f7349a73d58ec3236ab3b43dec852bb5 (commit)
       via  1b28d9dbe0260b2a4645c4b5caae11d9f375c942 (commit)
       via  ccd2187212c12b84c86a10fd4417a16536243179 (commit)
      from  3133402241167ccad70fa888a47ffcbe04e7b4c5 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit cde626e7f7349a73d58ec3236ab3b43dec852bb5
Author: Justus Winter <justus at g10code.com>
Date:   Tue Apr 11 11:37:37 2017 +0200

    tests: Avoid relying on implicit gpg commands.
    
    * tests/openpgp/armdetach.scm: Always use an explicit command instead
    of relying on gpg to guess what we want.
    * tests/openpgp/armdetachm.scm: Likewise.
    * tests/openpgp/armencrypt.scm: Likewise.
    * tests/openpgp/armencryptp.scm: Likewise.
    * tests/openpgp/armor.scm: Likewise.
    * tests/openpgp/armsignencrypt.scm: Likewise.
    * tests/openpgp/armsigs.scm: Likewise.
    * tests/openpgp/clearsig.scm: Likewise.
    * tests/openpgp/compression.scm: Likewise.
    * tests/openpgp/conventional-mdc.scm: Likewise.
    * tests/openpgp/conventional.scm: Likewise.
    * tests/openpgp/decrypt-dsa.scm: Likewise.
    * tests/openpgp/decrypt.scm: Likewise.
    * tests/openpgp/detach.scm: Likewise.
    * tests/openpgp/detachm.scm: Likewise.
    * tests/openpgp/ecc.scm: Likewise.
    * tests/openpgp/encrypt-dsa.scm: Likewise.
    * tests/openpgp/encrypt-multifile.scm: Likewise.
    * tests/openpgp/encrypt.scm: Likewise.
    * tests/openpgp/encryptp.scm: Likewise.
    * tests/openpgp/seat.scm: Likewise.
    * tests/openpgp/signencrypt-dsa.scm: Likewise.
    * tests/openpgp/signencrypt.scm: Likewise.
    * tests/openpgp/sigs-dsa.scm: Likewise.
    * tests/openpgp/sigs.scm: Likewise.
    
    Signed-off-by: Justus Winter <justus at g10code.com>

diff --git a/tests/openpgp/armdetach.scm b/tests/openpgp/armdetach.scm
index f458441..3bae28b 100755
--- a/tests/openpgp/armdetach.scm
+++ b/tests/openpgp/armdetach.scm
@@ -28,5 +28,5 @@
 			 --output ,tmp ,source ) usrpass1)
      (pipe:do
       (pipe:open source (logior O_RDONLY O_BINARY))
-      (pipe:spawn `(, at GPG --yes ,tmp)))))
+      (pipe:spawn `(, at GPG --yes --verify ,tmp -)))))
  (append plain-files data-files))
diff --git a/tests/openpgp/armdetachm.scm b/tests/openpgp/armdetachm.scm
index 8d30fd3..6812263 100755
--- a/tests/openpgp/armdetachm.scm
+++ b/tests/openpgp/armdetachm.scm
@@ -33,4 +33,4 @@
 			      (pipe:open file (logior O_RDONLY O_BINARY))
 			      (pipe:splice sink)))
 			   files)))
-   (pipe:spawn `(, at GPG --yes ,tmp))))
+   (pipe:spawn `(, at GPG --yes --verify ,tmp -))))
diff --git a/tests/openpgp/armencrypt.scm b/tests/openpgp/armencrypt.scm
index b9dfc1e..21131ea 100755
--- a/tests/openpgp/armencrypt.scm
+++ b/tests/openpgp/armencrypt.scm
@@ -26,6 +26,6 @@
    (tr:do
     (tr:open source)
     (tr:gpg usrpass1 `(--yes --passphrase-fd "0" -ea --recipient ,usrname2))
-    (tr:gpg "" '(--yes))
+    (tr:gpg "" '(--yes --decrypt))
     (tr:assert-identity source)))
  (append plain-files data-files))
diff --git a/tests/openpgp/armencryptp.scm b/tests/openpgp/armencryptp.scm
index d280902..4a00166 100755
--- a/tests/openpgp/armencryptp.scm
+++ b/tests/openpgp/armencryptp.scm
@@ -27,6 +27,6 @@
     (tr:open source)
     (tr:pipe-do
      (pipe:gpg `(--yes -ea --recipient ,usrname2))
-     (pipe:gpg '(--yes)))
+     (pipe:gpg '(--yes --decrypt)))
     (tr:assert-identity source)))
  (append plain-files data-files))
diff --git a/tests/openpgp/armor.scm b/tests/openpgp/armor.scm
index 7498ba7..6f57c78 100755
--- a/tests/openpgp/armor.scm
+++ b/tests/openpgp/armor.scm
@@ -764,4 +764,4 @@ wg7Md81a5RI3F2FG8747t9gX
 (tr:do
  (tr:pipe-do
   (pipe:echo nopad_armored_msg)
-  (pipe:gpg '())))
+  (pipe:gpg '(--decrypt))))
diff --git a/tests/openpgp/armsignencrypt.scm b/tests/openpgp/armsignencrypt.scm
index 18178f1..49eea07 100755
--- a/tests/openpgp/armsignencrypt.scm
+++ b/tests/openpgp/armsignencrypt.scm
@@ -26,6 +26,6 @@
    (tr:do
     (tr:open source)
     (tr:gpg usrpass1 `(--yes --passphrase-fd "0" -sea --recipient ,usrname2))
-    (tr:gpg "" '(--yes))
+    (tr:gpg "" '(--yes --decrypt))
     (tr:assert-identity source)))
  (append plain-files data-files))
diff --git a/tests/openpgp/armsigs.scm b/tests/openpgp/armsigs.scm
index 6e5d056..2fab729 100755
--- a/tests/openpgp/armsigs.scm
+++ b/tests/openpgp/armsigs.scm
@@ -26,6 +26,6 @@
    (tr:do
     (tr:open source)
     (tr:gpg usrpass1 `(--yes --passphrase-fd "0" -sa --recipient ,usrname2))
-    (tr:gpg "" '(--yes))
+    (tr:gpg "" '(--yes --decrypt))
     (tr:assert-identity source)))
  (append plain-files data-files))
diff --git a/tests/openpgp/clearsig.scm b/tests/openpgp/clearsig.scm
index cdbf603..a9f20f2 100755
--- a/tests/openpgp/clearsig.scm
+++ b/tests/openpgp/clearsig.scm
@@ -25,7 +25,7 @@
     (lettmp (signed)
 	    (call-popen `(, at GPG --output ,signed --yes
 				, at args ,source) input)
-	    (call-popen `(, at GPG --output ,sink --yes ,signed) ""))))
+	    (call-popen `(, at GPG --output ,sink --yes --verify ,signed) ""))))
 
 (for-each-p
  "Checking signing and verifying plain text messages"
diff --git a/tests/openpgp/compression.scm b/tests/openpgp/compression.scm
index f39c132..bab7572 100755
--- a/tests/openpgp/compression.scm
+++ b/tests/openpgp/compression.scm
@@ -30,7 +30,7 @@
        (tr:open source)
        (tr:gpg "" `(--yes --encrypt --recipient ,usrname2
 			  --compress-algo ,compression))
-       (tr:gpg "" '(--yes))
+       (tr:gpg "" '(--yes --decrypt))
        (tr:assert-identity source)))
     (append plain-files data-files)))
  (force all-compression-algos))
diff --git a/tests/openpgp/conventional-mdc.scm b/tests/openpgp/conventional-mdc.scm
index 5b009ae..af27fad 100755
--- a/tests/openpgp/conventional-mdc.scm
+++ b/tests/openpgp/conventional-mdc.scm
@@ -34,7 +34,7 @@
        (tr:gpg passphrase `(--yes --passphrase-fd "0" ,s2k
 				  --force-mdc -c
 				  --cipher-algo ,algo))
-       (tr:gpg passphrase `(--yes --passphrase-fd "0" ,s2k))
+       (tr:gpg passphrase `(--yes --passphrase-fd "0" --decrypt ,s2k))
        (tr:assert-identity source)))
     '("plain-1" "data-80000")))
  (force all-cipher-algos))
@@ -45,6 +45,6 @@
    (tr:do
     (tr:open source)
      (tr:gpg passphrase `(--yes --passphrase-fd "0" ,s2k -cs))
-     (tr:gpg passphrase `(--yes --passphrase-fd "0" ,s2k))
+     (tr:gpg passphrase `(--yes --passphrase-fd "0" --decrypt ,s2k))
      (tr:assert-identity source)))
  (append plain-files data-files))
diff --git a/tests/openpgp/conventional.scm b/tests/openpgp/conventional.scm
index 612b992..4bca3c9 100755
--- a/tests/openpgp/conventional.scm
+++ b/tests/openpgp/conventional.scm
@@ -29,7 +29,7 @@
    (tr:do
     (tr:open source)
      (tr:gpg passphrase `(--yes --passphrase-fd "0" ,s2k -c))
-     (tr:gpg passphrase `(--yes --passphrase-fd "0" ,s2k))
+     (tr:gpg passphrase `(--yes --passphrase-fd "0" --decrypt ,s2k))
      (tr:assert-identity source)))
  '("plain-2" "data-32000"))
 
@@ -43,7 +43,7 @@
        (tr:open source)
        (tr:gpg passphrase `(--yes --passphrase-fd "0" ,s2k -c
 				  --cipher-algo ,algo))
-       (tr:gpg passphrase `(--yes --passphrase-fd "0" ,s2k))
+       (tr:gpg passphrase `(--yes --passphrase-fd "0" --decrypt ,s2k))
        (tr:assert-identity source)))
     '("plain-1" "data-80000")))
  (force all-cipher-algos))
diff --git a/tests/openpgp/decrypt-dsa.scm b/tests/openpgp/decrypt-dsa.scm
index 49f9534..640dfd2 100755
--- a/tests/openpgp/decrypt-dsa.scm
+++ b/tests/openpgp/decrypt-dsa.scm
@@ -25,6 +25,6 @@
  (lambda (name)
    (tr:do
     (tr:open (in-srcdir (string-append name "-pgp.asc")))
-    (tr:gpg "" '(--yes))
+    (tr:gpg "" '(--yes --decrypt))
     (tr:assert-identity name)))
  (list (car plain-files)))
diff --git a/tests/openpgp/decrypt.scm b/tests/openpgp/decrypt.scm
index ba8bcee..8dac38a 100755
--- a/tests/openpgp/decrypt.scm
+++ b/tests/openpgp/decrypt.scm
@@ -25,6 +25,6 @@
  (lambda (name)
    (tr:do
     (tr:open (in-srcdir (string-append name ".asc")))
-    (tr:gpg "" '(--yes))
+    (tr:gpg "" '(--yes --decrypt))
     (tr:assert-identity name)))
  plain-files)
diff --git a/tests/openpgp/detach.scm b/tests/openpgp/detach.scm
index 2180f78..ac2bc36 100755
--- a/tests/openpgp/detach.scm
+++ b/tests/openpgp/detach.scm
@@ -28,5 +28,5 @@
 			 --output ,tmp ,source ) usrpass1)
      (pipe:do
       (pipe:open source (logior O_RDONLY O_BINARY))
-      (pipe:spawn `(, at GPG --yes ,tmp)))))
+      (pipe:spawn `(, at GPG --yes --verify ,tmp -)))))
  (append plain-files data-files))
diff --git a/tests/openpgp/detachm.scm b/tests/openpgp/detachm.scm
index 1de8da9..0b64458 100755
--- a/tests/openpgp/detachm.scm
+++ b/tests/openpgp/detachm.scm
@@ -33,4 +33,4 @@
 			      (pipe:open file (logior O_RDONLY O_BINARY))
 			      (pipe:splice sink)))
 			   files)))
-   (pipe:spawn `(, at GPG --yes ,tmp))))
+   (pipe:spawn `(, at GPG --yes --verify ,tmp -))))
diff --git a/tests/openpgp/ecc.scm b/tests/openpgp/ecc.scm
index a40869d..2ea8c39 100755
--- a/tests/openpgp/ecc.scm
+++ b/tests/openpgp/ecc.scm
@@ -101,8 +101,7 @@ Ic1RdzgeCfosMF+l/zVRchcLKzenEQA=
      (lettmp (x y)
        (call-with-output-file
 	   x (lambda (p) (display (eval test (current-environment)) p)))
-       (call-check `(,(tool 'gpg) --verify ,x))
-       (call-check `(,(tool 'gpg) --output ,y ,x))
+       (call-check `(,(tool 'gpg) --output ,y --verify ,x))
        (unless (file=? y z) (fail "mismatch"))))
    '(msg_opaque_signed_256 msg_opaque_signed_384 msg_opaque_signed_521)))
 
@@ -181,7 +180,7 @@ Rg==
      (lettmp (x y)
        (call-with-output-file
 	   x (lambda (p) (display (eval test (current-environment)) p)))
-       (call-check `(, at GPG --yes --output ,y ,x))
+       (call-check `(, at GPG --yes --output ,y --decrypt ,x))
        (unless (file=? y z) (fail "mismatch"))))
    '(msg_encrypted_256 msg_encrypted_384 msg_encrypted_521)))
 
@@ -200,7 +199,7 @@ Rg==
       (tr:do
        (tr:open source)
        (tr:gpg "" `(--yes --encrypt --recipient ,keyid))
-       (tr:gpg "" '(--yes))
+       (tr:gpg "" '(--yes --decrypt))
        (tr:assert-identity source)))
     mainkeyids))
  (append plain-files data-files))
@@ -217,7 +216,7 @@ Rg==
       (tr:do
        (tr:open source)
        (tr:gpg "" `(--yes --sign --local-user ,keyid))
-       (tr:gpg "" '(--yes))
+       (tr:gpg "" '(--yes --decrypt))
        (tr:assert-identity source)))
     mainkeyids))
  (append plain-files data-files))
diff --git a/tests/openpgp/encrypt-dsa.scm b/tests/openpgp/encrypt-dsa.scm
index 7ac1916..0c5a2fd 100755
--- a/tests/openpgp/encrypt-dsa.scm
+++ b/tests/openpgp/encrypt-dsa.scm
@@ -26,7 +26,7 @@
    (tr:do
     (tr:open source)
     (tr:gpg "" `(--yes --encrypt --recipient ,dsa-usrname2))
-    (tr:gpg "" '(--yes))
+    (tr:gpg "" '(--yes --decrypt))
     (tr:assert-identity source)))
  (append plain-files data-files))
 
@@ -40,7 +40,7 @@
        (tr:open source)
        (tr:gpg "" `(--yes --encrypt --recipient ,dsa-usrname2
 			  --cipher-algo ,cipher))
-       (tr:gpg "" '(--yes))
+       (tr:gpg "" '(--yes --decrypt))
        (tr:assert-identity source)))
     (append plain-files data-files)))
  (force all-cipher-algos))
diff --git a/tests/openpgp/encrypt-multifile.scm b/tests/openpgp/encrypt-multifile.scm
index 4b76ff0..d55971c 100755
--- a/tests/openpgp/encrypt-multifile.scm
+++ b/tests/openpgp/encrypt-multifile.scm
@@ -34,6 +34,6 @@
  (lambda (source)
    (tr:do
     (tr:open (string-append source ".gpg"))
-    (tr:gpg "" '(--yes))
+    (tr:gpg "" '(--yes --decrypt))
     (tr:assert-identity source)))
  files)
diff --git a/tests/openpgp/encrypt.scm b/tests/openpgp/encrypt.scm
index 4247aa8..1888a00 100755
--- a/tests/openpgp/encrypt.scm
+++ b/tests/openpgp/encrypt.scm
@@ -26,7 +26,7 @@
    (tr:do
     (tr:open source)
     (tr:gpg "" `(--yes --encrypt --recipient ,usrname2))
-    (tr:gpg "" '(--yes))
+    (tr:gpg "" '(--yes --decrypt))
     (tr:assert-identity source)))
  (append plain-files data-files))
 
@@ -40,7 +40,7 @@
        (tr:open source)
        (tr:gpg "" `(--yes --encrypt --recipient ,usrname2
 			  --cipher-algo ,cipher))
-       (tr:gpg "" '(--yes))
+       (tr:gpg "" '(--yes --decrypt))
        (tr:assert-identity source)))
     (append plain-files data-files)))
  (force all-cipher-algos))
@@ -56,6 +56,6 @@
     (tr:gpg "" `(--yes -v --no-keyring --encrypt
                  --recipient-file ,(in-srcdir key-file1)
                  --hidden-recipient-file ,(in-srcdir key-file2)))
-    (tr:gpg "" '(--yes))
+    (tr:gpg "" '(--yes --decrypt))
     (tr:assert-identity source)))
  plain-files)
diff --git a/tests/openpgp/encryptp.scm b/tests/openpgp/encryptp.scm
index d939190..ccd5c7b 100755
--- a/tests/openpgp/encryptp.scm
+++ b/tests/openpgp/encryptp.scm
@@ -27,6 +27,6 @@
     (tr:open source)
     (tr:pipe-do
      (pipe:gpg `(--yes --encrypt --recipient ,usrname2))
-     (pipe:gpg '(--yes)))
+     (pipe:gpg '(--yes --decrypt)))
     (tr:assert-identity source)))
  (append plain-files data-files))
diff --git a/tests/openpgp/seat.scm b/tests/openpgp/seat.scm
index 22a5a67..31bd71a 100755
--- a/tests/openpgp/seat.scm
+++ b/tests/openpgp/seat.scm
@@ -26,6 +26,6 @@
    (tr:do
     (tr:open source)
     (tr:gpg usrpass1 '(--yes -seat -r two at example.com --passphrase-fd "0"))
-    (tr:gpg "" '(--yes))
+    (tr:gpg "" '(--yes --decrypt))
     (tr:assert-weak-identity source)))
  plain-files)
diff --git a/tests/openpgp/signencrypt-dsa.scm b/tests/openpgp/signencrypt-dsa.scm
index c969d2f..00ce625 100755
--- a/tests/openpgp/signencrypt-dsa.scm
+++ b/tests/openpgp/signencrypt-dsa.scm
@@ -28,7 +28,7 @@
     (tr:gpg usrpass1 `(--yes --passphrase-fd "0" -se
 			     -u ,dsa-usrname1
 			     --recipient ,dsa-usrname2))
-    (tr:gpg "" '(--yes))
+    (tr:gpg "" '(--yes --decrypt))
     (tr:assert-identity source)))
  (append plain-files data-files))
 
@@ -44,6 +44,6 @@
 			     -u ,dsa-usrname1
 			     --recipient ,dsa-usrname2
 			     --digest-algo ,hash))
-    (tr:gpg "" '(--yes))
+    (tr:gpg "" '(--yes --decrypt))
     (tr:assert-identity (car plain-files))))
  algos)
diff --git a/tests/openpgp/signencrypt.scm b/tests/openpgp/signencrypt.scm
index 35ac89a..3021eb4 100755
--- a/tests/openpgp/signencrypt.scm
+++ b/tests/openpgp/signencrypt.scm
@@ -26,14 +26,14 @@
    (tr:do
     (tr:open source)
     (tr:gpg usrpass1 `(--yes --passphrase-fd "0" -se --recipient ,usrname2))
-    (tr:gpg "" '(--yes))
+    (tr:gpg "" '(--yes --decrypt))
     (tr:assert-identity source)))
  (append plain-files data-files))
 
 (info "Checking bug 537: MDC problem with old style compressed packets.")
 (lettmp (tmp)
   (call-popen `(, at GPG --yes --passphrase-fd "0"
-		      --output ,tmp ,(in-srcdir "bug537-test.data.asc"))
+		      --output ,tmp --decrypt ,(in-srcdir "bug537-test.data.asc"))
 	      usrpass1)
   (if (not (string=? "4336AE2A528FAE091E73E59E325B588FEE795F9B"
 		     (cadar (gpg-hash-string `(--print-md SHA1 ,tmp) ""))))
diff --git a/tests/openpgp/sigs-dsa.scm b/tests/openpgp/sigs-dsa.scm
index f909078..d8494d5 100755
--- a/tests/openpgp/sigs-dsa.scm
+++ b/tests/openpgp/sigs-dsa.scm
@@ -26,7 +26,7 @@
    (tr:do
     (tr:open source)
     (tr:gpg "" `(--yes --sign --user ,dsa-usrname1))
-    (tr:gpg "" '(--yes))
+    (tr:gpg "" '(--yes --decrypt))
     (tr:assert-identity source)))
  (append plain-files data-files))
 
@@ -39,6 +39,6 @@
    (tr:do
     (tr:open (car plain-files))
     (tr:gpg "" `(--yes --sign --user ,dsa-usrname1 --digest-algo ,hash))
-    (tr:gpg "" '(--yes))
+    (tr:gpg "" '(--yes --decrypt))
     (tr:assert-identity (car plain-files))))
  algos)
diff --git a/tests/openpgp/sigs.scm b/tests/openpgp/sigs.scm
index 5a1efa7..c2298f9 100755
--- a/tests/openpgp/sigs.scm
+++ b/tests/openpgp/sigs.scm
@@ -26,7 +26,7 @@
    (tr:do
     (tr:open source)
     (tr:gpg "" '(--yes --sign))
-    (tr:gpg "" '(--yes))
+    (tr:gpg "" '(--yes --decrypt))
     (tr:assert-identity source)))
  (append plain-files data-files))
 
@@ -38,7 +38,7 @@
        (tr:do
 	(tr:open (car plain-files))
 	(tr:gpg "" `(--yes --sign --user ,usrname3 --digest-algo ,hash))
-	(tr:gpg "" '(--yes))
+	(tr:gpg "" '(--yes --decrypt))
 	(tr:assert-identity (car plain-files))))
    (if (not (equal? "MD5" hash))
        ;; Using the DSA sig key - only 160 bit or larger hashes
@@ -46,6 +46,6 @@
 	(tr:open (car plain-files))
 	(tr:gpg usrpass1
 		`(--yes --sign --passphrase-fd "0" --digest-algo ,hash))
-	(tr:gpg "" '(--yes))
+	(tr:gpg "" '(--yes --decrypt))
 	(tr:assert-identity (car plain-files)))))
  (force all-hash-algos))

commit 1b28d9dbe0260b2a4645c4b5caae11d9f375c942
Author: Justus Winter <justus at g10code.com>
Date:   Tue Apr 11 10:46:09 2017 +0200

    tests: Make tests more robust.
    
    * tests/openpgp/defs.scm (have-opt-always-trust): Execute in empty
    ephemeral home directory.  This prevents gpg from picking up the
    configuration from the current gnupghome (if any).
    * tests/migrations/common.scm (untar-armored): Likewise.
    
    Signed-off-by: Justus Winter <justus at g10code.com>

diff --git a/tests/migrations/common.scm b/tests/migrations/common.scm
index fa8f129..cba6590 100644
--- a/tests/migrations/common.scm
+++ b/tests/migrations/common.scm
@@ -39,10 +39,11 @@
 (define GPGTAR (path-join (getenv "objdir") "tools" (qualify "gpgtar")))
 
 (define (untar-armored source-name)
-  (pipe:do
-   (pipe:open source-name (logior O_RDONLY O_BINARY))
-   (pipe:spawn `(, at GPG --dearmor))
-   (pipe:spawn `(,GPGTAR --extract --directory=. -))))
+  (with-ephemeral-home-directory (lambda ())
+    (pipe:do
+     (pipe:open source-name (logior O_RDONLY O_BINARY))
+     (pipe:spawn `(, at GPG --dearmor))
+     (pipe:spawn `(,GPGTAR --extract --directory=. -)))))
 
 (define (run-test message src-tarball test)
   (catch (skip "gpgtar not built")
diff --git a/tests/openpgp/defs.scm b/tests/openpgp/defs.scm
index cb22de7..c4b321c 100644
--- a/tests/openpgp/defs.scm
+++ b/tests/openpgp/defs.scm
@@ -201,7 +201,8 @@
 
 (define have-opt-always-trust
   (catch #f
-	 (call-check `(,(tool 'gpg) --gpgconf-test --always-trust))
+	 (with-ephemeral-home-directory (lambda ())
+	   (call-check `(,(tool 'gpg) --gpgconf-test --always-trust)))
 	 #t))
 
 (define GPG `(,(tool 'gpg) --no-permission-warning

commit ccd2187212c12b84c86a10fd4417a16536243179
Author: Justus Winter <justus at g10code.com>
Date:   Tue Apr 11 10:43:52 2017 +0200

    tests: Move common functionality.
    
    * tests/openpgp/defs.scm (with-home-directory,
    with-ephemeral-home-directory): Move...
    * tests/gpgscm/gnupg.scm: ... to this new file.
    * tests/gpgscm/main.c (main): Load the new file.
    
    Signed-off-by: Justus Winter <justus at g10code.com>

diff --git a/tests/gpgscm/gnupg.scm b/tests/gpgscm/gnupg.scm
new file mode 100644
index 0000000..5fcf9fd
--- /dev/null
+++ b/tests/gpgscm/gnupg.scm
@@ -0,0 +1,44 @@
+;; Common definitions for executing gpg and related tools.
+;;
+;; Copyright (C) 2016, 2017 g10 Code GmbH
+;;
+;; This file is part of GnuPG.
+;;
+;; GnuPG is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 3 of the License, or
+;; (at your option) any later version.
+;;
+;; GnuPG is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+;; Evaluate a sequence of expressions with the given home directory.
+(define-macro (with-home-directory gnupghome . expressions)
+  (let ((original-home-directory (gensym)))
+    `(let ((,original-home-directory (getenv "GNUPGHOME")))
+       (dynamic-wind
+	   (lambda () (setenv "GNUPGHOME" ,gnupghome #t))
+	   (lambda () , at expressions)
+	   (lambda () (setenv "GNUPGHOME" ,original-home-directory #t))))))
+
+;; Evaluate a sequence of expressions with an ephemeral home
+;; directory.
+(define-macro (with-ephemeral-home-directory setup-fn . expressions)
+  (let ((original-home-directory (gensym))
+	(ephemeral-home-directory (gensym))
+	(setup (gensym)))
+    `(let ((,original-home-directory (getenv "GNUPGHOME"))
+	   (,ephemeral-home-directory (mkdtemp))
+	   (,setup (delay (,setup-fn))))
+       (finally (unlink-recursively ,ephemeral-home-directory)
+	 (dynamic-wind
+	     (lambda ()
+	       (setenv "GNUPGHOME" ,ephemeral-home-directory #t)
+	       (with-working-directory ,ephemeral-home-directory (force ,setup)))
+	     (lambda () , at expressions)
+	     (lambda () (setenv "GNUPGHOME" ,original-home-directory #t)))))))
diff --git a/tests/gpgscm/main.c b/tests/gpgscm/main.c
index 79072a5..5e04d97 100644
--- a/tests/gpgscm/main.c
+++ b/tests/gpgscm/main.c
@@ -314,6 +314,8 @@ main (int argc, char **argv)
     err = load (sc, "repl.scm", 0, 1);
   if (! err)
     err = load (sc, "tests.scm", 0, 1);
+  if (! err)
+    err = load (sc, "gnupg.scm", 0, 1);
   if (err)
     {
       fprintf (stderr, "Error initializing gpgscm: %s.\n",
diff --git a/tests/openpgp/defs.scm b/tests/openpgp/defs.scm
index 29eb775..cb22de7 100644
--- a/tests/openpgp/defs.scm
+++ b/tests/openpgp/defs.scm
@@ -280,32 +280,6 @@
 ;; GnuPG helper.
 ;;
 
-;; Evaluate a sequence of expressions with the given home directory.
-(define-macro (with-home-directory gnupghome . expressions)
-  (let ((original-home-directory (gensym)))
-    `(let ((,original-home-directory (getenv "GNUPGHOME")))
-       (dynamic-wind
-	   (lambda () (setenv "GNUPGHOME" ,gnupghome #t))
-	   (lambda () , at expressions)
-	   (lambda () (setenv "GNUPGHOME" ,original-home-directory #t))))))
-
-;; Evaluate a sequence of expressions with an ephemeral home
-;; directory.
-(define-macro (with-ephemeral-home-directory setup-fn . expressions)
-  (let ((original-home-directory (gensym))
-	(ephemeral-home-directory (gensym))
-	(setup (gensym)))
-    `(let ((,original-home-directory (getenv "GNUPGHOME"))
-	   (,ephemeral-home-directory (mkdtemp))
-	   (,setup (delay (,setup-fn))))
-       (finally (unlink-recursively ,ephemeral-home-directory)
-	 (dynamic-wind
-	     (lambda ()
-	       (setenv "GNUPGHOME" ,ephemeral-home-directory #t)
-	       (with-working-directory ,ephemeral-home-directory (force ,setup)))
-	     (lambda () , at expressions)
-	     (lambda () (setenv "GNUPGHOME" ,original-home-directory #t)))))))
-
 ;; Call GPG to obtain the hash sums.  Either specify an input file in
 ;; ARGS, or an string in INPUT.  Returns a list of (<algo>
 ;; "<hashsum>") lists.

-----------------------------------------------------------------------

Summary of changes:
 tests/gpgscm/gnupg.scm              | 44 +++++++++++++++++++++++++++++++++++++
 tests/gpgscm/main.c                 |  2 ++
 tests/migrations/common.scm         |  9 ++++----
 tests/openpgp/armdetach.scm         |  2 +-
 tests/openpgp/armdetachm.scm        |  2 +-
 tests/openpgp/armencrypt.scm        |  2 +-
 tests/openpgp/armencryptp.scm       |  2 +-
 tests/openpgp/armor.scm             |  2 +-
 tests/openpgp/armsignencrypt.scm    |  2 +-
 tests/openpgp/armsigs.scm           |  2 +-
 tests/openpgp/clearsig.scm          |  2 +-
 tests/openpgp/compression.scm       |  2 +-
 tests/openpgp/conventional-mdc.scm  |  4 ++--
 tests/openpgp/conventional.scm      |  4 ++--
 tests/openpgp/decrypt-dsa.scm       |  2 +-
 tests/openpgp/decrypt.scm           |  2 +-
 tests/openpgp/defs.scm              | 29 ++----------------------
 tests/openpgp/detach.scm            |  2 +-
 tests/openpgp/detachm.scm           |  2 +-
 tests/openpgp/ecc.scm               |  9 ++++----
 tests/openpgp/encrypt-dsa.scm       |  4 ++--
 tests/openpgp/encrypt-multifile.scm |  2 +-
 tests/openpgp/encrypt.scm           |  6 ++---
 tests/openpgp/encryptp.scm          |  2 +-
 tests/openpgp/seat.scm              |  2 +-
 tests/openpgp/signencrypt-dsa.scm   |  4 ++--
 tests/openpgp/signencrypt.scm       |  4 ++--
 tests/openpgp/sigs-dsa.scm          |  4 ++--
 tests/openpgp/sigs.scm              |  6 ++---
 29 files changed, 91 insertions(+), 70 deletions(-)
 create mode 100644 tests/gpgscm/gnupg.scm


hooks/post-receive
-- 
The GNU Privacy Guard
http://git.gnupg.org




More information about the Gnupg-commits mailing list