exit lingering gpg agents at the end of relevant tests

Since gnupg 2.1.20, gpg-agent no longer shut itself down when
$GNUPGHOME directory is removed.

Add exit hooks to the test modules which execute `gpgconf --kill all`

Add exit hooks to execute `gpgconf --kill all` in the modules that
create $GNUPGHOME for gpg to work with.
This commit is contained in:
Tomi Ollila 2017-05-23 21:54:25 +03:00 committed by David Bremner
parent eb157f8841
commit 5f71a4d3e1
2 changed files with 4 additions and 0 deletions

View file

@ -11,6 +11,8 @@ add_gnupg_home ()
{
local output
[ -d ${GNUPGHOME} ] && return
_gnupg_exit () { gpgconf --kill all 2>/dev/null || true; }
at_exit_function _gnupg_exit
mkdir -m 0700 "$GNUPGHOME"
gpg --no-tty --import <$TEST_DIRECTORY/gnupg-secret-key.asc >"$GNUPGHOME"/import.log 2>&1
test_debug "cat $GNUPGHOME/import.log"

View file

@ -7,6 +7,8 @@ add_gpgsm_home ()
{
local fpr
[ -d ${GNUPGHOME} ] && return
_gnupg_exit () { gpgconf --kill all 2>/dev/null || true; }
at_exit_function _gnupg_exit
mkdir -m 0700 "$GNUPGHOME"
gpgsm --no-tty --no-common-certs-import --disable-dirmngr --import < $TEST_DIRECTORY/smime/test.crt >"$GNUPGHOME"/import.log 2>&1
fpr=$(gpgsm --list-key test_suite@notmuchmail.org | sed -n 's/.*fingerprint: //p')