summaryrefslogtreecommitdiffstats
path: root/tests/openpgp
diff options
context:
space:
mode:
authorNIIBE Yutaka <gniibe@fsij.org>2018-04-04 13:27:08 +0200
committerNIIBE Yutaka <gniibe@fsij.org>2018-04-04 13:27:08 +0200
commit83529e1bd14a6d39f2a8ecab9fb6aa4c1f344c73 (patch)
tree7a8a1e7c8367547880106c65cf5cac33e677e31e /tests/openpgp
parentscd: Writing KDF resets auth state. (diff)
downloadgnupg2-83529e1bd14a6d39f2a8ecab9fb6aa4c1f344c73.tar.xz
gnupg2-83529e1bd14a6d39f2a8ecab9fb6aa4c1f344c73.zip
tests: Fix no gpg-agent upon removal of GNUPGHOME.
* tests/gpgscm/gnupg.scm (with-ephemeral-home-directory): Add teadown-fn. * tests/gpgsm/export.scm: Use -no-atexit version and stop-agent. * tests/openpgp/decrypt-session-key.scm: Likewise. * tests/openpgp/decrypt-unwrap-verify.scm: Likewise. * tests/openpgp/defs.scm (have-opt-always-trust): Likewise. (setup-environment-no-atexit): New. (start-agent): Support no use of atexit. * tests/gpgsm/gpgsm-defs.scm (setup-gpgsm-environment-no-atexit): New. * tests/migrations/common.scm (untar-armored): Follow the change of with-ephemeral-home-directory. -- When gpg-agent detects homedir removal, it will automatically exit. Then, call of 'gpgconf --kill all' will fail. So, stop-agent should be called before the removal of homedir. Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
Diffstat (limited to 'tests/openpgp')
-rwxr-xr-xtests/openpgp/decrypt-session-key.scm2
-rwxr-xr-xtests/openpgp/decrypt-unwrap-verify.scm2
-rw-r--r--tests/openpgp/defs.scm14
3 files changed, 11 insertions, 7 deletions
diff --git a/tests/openpgp/decrypt-session-key.scm b/tests/openpgp/decrypt-session-key.scm
index 35aa7f36b..c3294e0c6 100755
--- a/tests/openpgp/decrypt-session-key.scm
+++ b/tests/openpgp/decrypt-session-key.scm
@@ -37,7 +37,7 @@
(lambda (name)
(let* ((source (in-srcdir "tests" "openpgp" (string-append name ".asc")))
(key (get-session-key source)))
- (with-ephemeral-home-directory setup-environment
+ (with-ephemeral-home-directory setup-environment-no-atexit stop-agent
(tr:do
(tr:open source)
(tr:gpg "" `(--yes --decrypt --override-session-key ,key))
diff --git a/tests/openpgp/decrypt-unwrap-verify.scm b/tests/openpgp/decrypt-unwrap-verify.scm
index bf7d14d41..addc2daac 100755
--- a/tests/openpgp/decrypt-unwrap-verify.scm
+++ b/tests/openpgp/decrypt-unwrap-verify.scm
@@ -35,7 +35,7 @@
;; Then, verify the signature with a clean working directory
;; containing only Steve's public key.
- (with-ephemeral-home-directory setup-environment
+ (with-ephemeral-home-directory setup-environment-no-atexit stop-agent
(call-check `(,@gpg --import ,steve's-key))
(call-check `(,@gpg --verify ,unwrapped)))))
'("encsig-2-keys-3" "encsig-2-keys-4")))
diff --git a/tests/openpgp/defs.scm b/tests/openpgp/defs.scm
index a6347fe1f..95376521d 100644
--- a/tests/openpgp/defs.scm
+++ b/tests/openpgp/defs.scm
@@ -201,7 +201,7 @@
(define have-opt-always-trust
(catch #f
- (with-ephemeral-home-directory (lambda ())
+ (with-ephemeral-home-directory (lambda ()) (lambda ())
(call-check `(,(tool 'gpg) --gpgconf-test --always-trust)))
#t))
@@ -365,6 +365,10 @@
(create-gpghome)
(start-agent))
+(define (setup-environment-no-atexit)
+ (create-gpghome)
+ (start-agent #t))
+
(define (create-sample-files)
(log "Creating sample data files")
(for-each
@@ -448,12 +452,12 @@
(preset-passphrases))
;; Create the socket dir and start the agent.
-(define (start-agent)
+(define (start-agent . args)
(log "Starting gpg-agent...")
(let ((gnupghome (getenv "GNUPGHOME")))
- (atexit (lambda ()
- (with-home-directory gnupghome
- (stop-agent)))))
+ (if (null? args)
+ (atexit (lambda ()
+ (with-home-directory gnupghome (stop-agent))))))
(catch (log "Warning: Creating socket directory failed:" (car *error*))
(gpg-conf '--create-socketdir))
(call-check `(,(tool 'gpg-connect-agent) --verbose