diff options
author | NIIBE Yutaka <gniibe@fsij.org> | 2018-04-04 13:27:08 +0200 |
---|---|---|
committer | NIIBE Yutaka <gniibe@fsij.org> | 2018-04-04 13:27:08 +0200 |
commit | 83529e1bd14a6d39f2a8ecab9fb6aa4c1f344c73 (patch) | |
tree | 7a8a1e7c8367547880106c65cf5cac33e677e31e /tests/gpgscm | |
parent | scd: Writing KDF resets auth state. (diff) | |
download | gnupg2-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/gpgscm')
-rw-r--r-- | tests/gpgscm/gnupg.scm | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/tests/gpgscm/gnupg.scm b/tests/gpgscm/gnupg.scm index 5fcf9fd21..77bf479ef 100644 --- a/tests/gpgscm/gnupg.scm +++ b/tests/gpgscm/gnupg.scm @@ -28,17 +28,22 @@ ;; Evaluate a sequence of expressions with an ephemeral home ;; directory. -(define-macro (with-ephemeral-home-directory setup-fn . expressions) +(define-macro (with-ephemeral-home-directory setup-fn teardown-fn . expressions) (let ((original-home-directory (gensym)) (ephemeral-home-directory (gensym)) - (setup (gensym))) + (setup (gensym)) + (teardown (gensym))) `(let ((,original-home-directory (getenv "GNUPGHOME")) (,ephemeral-home-directory (mkdtemp)) - (,setup (delay (,setup-fn)))) + (,setup (delay (,setup-fn))) + (,teardown (delay (,teardown-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 () ,@expressions) - (lambda () (setenv "GNUPGHOME" ,original-home-directory #t))))))) + (lambda () + (setenv "GNUPGHOME" ,ephemeral-home-directory #t) + (with-working-directory ,ephemeral-home-directory (force ,teardown)) + (setenv "GNUPGHOME" ,original-home-directory #t))))))) |