aboutsummaryrefslogtreecommitdiffstats
path: root/tests/openpgp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/openpgp')
-rw-r--r--tests/openpgp/Makefile.am3
-rw-r--r--tests/openpgp/README2
-rw-r--r--tests/openpgp/defs.scm15
-rwxr-xr-xtests/openpgp/setup.scm1
4 files changed, 15 insertions, 6 deletions
diff --git a/tests/openpgp/Makefile.am b/tests/openpgp/Makefile.am
index afac58fc8..518af200c 100644
--- a/tests/openpgp/Makefile.am
+++ b/tests/openpgp/Makefile.am
@@ -33,12 +33,9 @@ noinst_PROGRAMS = fake-pinentry
fake_pinentry_SOURCES = fake-pinentry.c
-TMP ?= /tmp
-
TESTS_ENVIRONMENT = LC_ALL=C \
EXEEXT=$(EXEEXT) \
PATH=../gpgscm:$(PATH) \
- TMP=$(TMP) \
srcdir=$(abs_srcdir) \
objdir=$(abs_top_builddir) \
GPGSCM_PATH=$(abs_top_srcdir)/tests/gpgscm:$(abs_top_srcdir)/tests/openpgp
diff --git a/tests/openpgp/README b/tests/openpgp/README
index eba77b1ae..b9d560797 100644
--- a/tests/openpgp/README
+++ b/tests/openpgp/README
@@ -30,7 +30,7 @@ This is a bit tricky because one needs to manually set some
environment variables. We should make that easier. See discussion
below. From your build directory, do:
- obj $ TMP=/tmp srcdir=<path to>/tests/openpgp \
+ obj $ srcdir=<path to>/tests/openpgp \
GPGSCM_PATH=<path to>/tests/gpgscm:<path to>/tests/openpgp \
$(pwd)/tests/gpgscm/gpgscm [gpgscm args] \
run-tests.scm [test suite runner args]
diff --git a/tests/openpgp/defs.scm b/tests/openpgp/defs.scm
index a06a570ac..568ffab18 100644
--- a/tests/openpgp/defs.scm
+++ b/tests/openpgp/defs.scm
@@ -278,6 +278,15 @@
;; 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 () ,@expressions)
+ (lambda () (setenv "GNUPGHOME" ,original-home-directory #t))))))
+
;; Evaluate a sequence of expressions with an ephemeral home
;; directory.
(define-macro (with-ephemeral-home-directory . expressions)
@@ -364,7 +373,6 @@
(define (create-legacy-gpghome)
(create-sample-files)
- (mkdir "private-keys-v1.d" "-rwx")
(log "Storing private keys")
(for-each
@@ -434,7 +442,10 @@
;; Create the socket dir and start the agent.
(define (start-agent)
(log "Starting gpg-agent...")
- (atexit stop-agent)
+ (let ((gnupghome (getenv "GNUPGHOME")))
+ (atexit (lambda ()
+ (with-home-directory gnupghome
+ (stop-agent)))))
(catch (log "Warning: Creating socket directory failed:" (car *error*))
(call-popen `(,(tool 'gpgconf) --create-socketdir) ""))
(call-check `(,(tool 'gpg-connect-agent) --verbose
diff --git a/tests/openpgp/setup.scm b/tests/openpgp/setup.scm
index d13799d90..bf1876e2d 100755
--- a/tests/openpgp/setup.scm
+++ b/tests/openpgp/setup.scm
@@ -25,6 +25,7 @@
(with-ephemeral-home-directory
(chdir (getenv "GNUPGHOME"))
(create-gpghome)
+ (start-agent)
(create-legacy-gpghome)
(stop-agent)
(call-check `(,(tool 'gpgtar) --create --output ,(cadr *args*) ".")))