tests: Make tests more robust.
authorJustus Winter <justus@g10code.com>
Tue, 11 Apr 2017 08:46:09 +0000 (10:46 +0200)
committerJustus Winter <justus@g10code.com>
Tue, 11 Apr 2017 09:37:02 +0000 (11:37 +0200)
* 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@g10code.com>
tests/migrations/common.scm
tests/openpgp/defs.scm

index fa8f129..cba6590 100644 (file)
 (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 `(,@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 `(,@GPG --dearmor))
+     (pipe:spawn `(,GPGTAR --extract --directory=. -)))))
 
 (define (run-test message src-tarball test)
   (catch (skip "gpgtar not built")
index cb22de7..c4b321c 100644 (file)
 
 (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