[PATCH 2/2] test: use gpgconf --create-socketdir if available

Subject: [PATCH 2/2] test: use gpgconf --create-socketdir if available

Date: Tue, 14 Feb 2017 16:42:39 -0500

To: notmuch@notmuchmail.org

Cc: aidecode@aidecode.name, David Bremner

From: David Bremner


This enables the shortened socket pathes in /run or equivalent. The
explicit call to gpgconf is needed for nonstandard GNUPGHOME settings.
---
 test/test-lib.sh | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/test/test-lib.sh b/test/test-lib.sh
index 86e792a8..9aa6163b 100644
--- a/test/test-lib.sh
+++ b/test/test-lib.sh
@@ -229,9 +229,18 @@ 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
+	_shutdown_gpg_agent
 	set +ex
 	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
 
 
-- 
2.11.0


Thread: