test: use gpgconf --create-socketdir if available
authorDavid Bremner <david@tethera.net>
Tue, 14 Feb 2017 21:42:39 +0000 (16:42 -0500)
committerDavid Bremner <david@tethera.net>
Tue, 21 Feb 2017 11:45:40 +0000 (07:45 -0400)
This enables the shortened socket pathes in /run or equivalent. The
explicit call to gpgconf is needed for nonstandard GNUPGHOME settings.

(amended according to id:m2fujatr4k.fsf@guru.guru-group.fi)

test/test-lib.sh

index 86e792a85df67007cc66a3925b99e91b8ddb60e3..ba1580cd1f3e803130a373c09a766fc82dbf1e7e 100644 (file)
@@ -229,10 +229,19 @@ test_fixed=0
 test_broken=0
 test_success=0
 
+
+_shutdown_gpg_agent () {
+    if [ ${NOTMUCH_HAVE_GPGCONF_SOCKETDIR} = 1 ]; then
+       gpgconf --kill gpg-agent
+       gpgconf --remove-socketdir
+    fi
+}
+
 _exit_common () {
        code=$?
        trap - EXIT
        set +ex
+       _shutdown_gpg_agent
        rm -rf "$TEST_TMPDIR"
 }
 
@@ -1276,6 +1285,11 @@ test_init_ () {
 
 . ./test-lib-common.sh || exit 1
 
+# we need the setting of GNUPGHOME in test-lib-common.sh
+if [ ${NOTMUCH_HAVE_GPGCONF_SOCKETDIR} = 1 ]; then
+    gpgconf --create-socketdir
+fi
+
 emacs_generate_script