1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-02 22:46:30 +02:00

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>
This commit is contained in:
NIIBE Yutaka 2018-04-04 20:27:08 +09:00
parent cb1731c23c
commit 83529e1bd1
7 changed files with 28 additions and 13 deletions

View file

@ -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