[PATCH 2 of 3] test-gpg: start gpg-agent under control of the test runner

Yuya Nishihara yuya at tcha.org
Sun Aug 14 05:29:26 EDT 2016


# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1471161693 -32400
#      Sun Aug 14 17:01:33 2016 +0900
# Node ID 20ffcea3fc24f0ef534cd117bbbee134a8dc929c
# Parent  4faac945fa5a66924ffb8e35f8c0a812ec2ec535
test-gpg: start gpg-agent under control of the test runner

GnuPG v2 automatically starts gpg-agent. We should kill the daemon process.

diff --git a/tests/hghave.py b/tests/hghave.py
--- a/tests/hghave.py
+++ b/tests/hghave.py
@@ -349,6 +349,10 @@ def has_tla():
 def has_gpg():
     return matchoutput('gpg --version 2>&1', br'GnuPG')
 
+ at check("gpg2", "gpg client v2")
+def has_gpg2():
+    return matchoutput('gpg --version 2>&1', br'GnuPG[^0-9]+2\.')
+
 @check("unix-permissions", "unix-style permissions")
 def has_unix_permissions():
     d = tempfile.mkdtemp(dir='.', prefix=tempprefix)
diff --git a/tests/test-gpg.t b/tests/test-gpg.t
--- a/tests/test-gpg.t
+++ b/tests/test-gpg.t
@@ -12,6 +12,13 @@ Test the GPG extension
   $ GNUPGHOME="$TESTTMP/gpg"; export GNUPGHOME
   $ cp -R "$TESTDIR/gpg" "$GNUPGHOME"
 
+Start gpg-agent, which is required by GnuPG v2
+
+#if gpg2
+  $ gpg-connect-agent -q --subst /serverpid '/echo ${get serverpid}' /bye \
+  > >> $DAEMON_PIDS
+#endif
+
   $ hg init r
   $ cd r
   $ echo foo > foo


More information about the Mercurial-devel mailing list