[Pkg-gnupg-commit] [gpgme] 53/103: tests: Make agent spawning more robust.

Daniel Kahn Gillmor dkg at fifthhorseman.net
Thu Dec 14 18:53:04 UTC 2017


This is an automated email from the git hooks/post-receive script.

dkg pushed a commit to branch master
in repository gpgme.

commit 9cd2b58dfb2c21cce64520cf4c726859b583d14e
Author: Justus Winter <justus at g10code.com>
Date:   Thu Jul 13 15:41:11 2017 +0200

    tests: Make agent spawning more robust.
    
    * tests/gpgsm/Makefile.am (gpgsm.conf): Add agent-program directive.
    * tests/start-stop-agent: Update agent-program directive.
    --
    Update the 'agent-program' configuration directive to point to the
    same agent that we are starting.  Previously, it was possible that a
    different agent was started if 'make check' was run with a different
    PATH.
    
    Signed-off-by: Justus Winter <justus at g10code.com>
---
 tests/gpgsm/Makefile.am |  1 +
 tests/start-stop-agent  | 12 ++++++++++++
 2 files changed, 13 insertions(+)

diff --git a/tests/gpgsm/Makefile.am b/tests/gpgsm/Makefile.am
index c73faea..a5667a8 100644
--- a/tests/gpgsm/Makefile.am
+++ b/tests/gpgsm/Makefile.am
@@ -65,6 +65,7 @@ BUILT_SOURCES = gpgsm.conf trustlist.txt pubring-stamp \
 ./gpgsm.conf:
 	echo disable-crl-checks > ./gpgsm.conf
 	echo faked-system-time 1008241200 >> ./gpgsm.conf
+	echo "agent-program `which $(GPG_AGENT)`|--debug-quick-random" >> ./gpg.conf
 
 ./private-keys-v1.d/gpg-sample.stamp: $(srcdir)/$(key_id)
 	-gpgconf --kill all
diff --git a/tests/start-stop-agent b/tests/start-stop-agent
index 3ce6f22..9514e0a 100755
--- a/tests/start-stop-agent
+++ b/tests/start-stop-agent
@@ -30,6 +30,18 @@ if [ "$1" = "--stop" ]; then
   exit 0
 fi
 
+# Update 'agent-program' in the configuration files to make sure we
+# will always start exactly this agent again if we ever need to.
+for F in gpg.conf gpgsm.conf
+do
+  if test -f "$GNUPGHOME/$F"
+  then
+      mv "$GNUPGHOME/$F" "$GNUPGHOME/$F~"
+      sed -e "s#^agent-program.*#agent-program ${GPG_AGENT}|--debug-quick-random#" \
+          >"$GNUPGHOME/$F" <"$GNUPGHOME/$F~"
+  fi
+done
+
 if [ "$(gpg-connect-agent --no-autostart getval\ $token /bye 2>/dev/null | head -1)" \
       = "D set" ]; then
   echo "gpg-agent already running" >&2

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-gnupg/gpgme.git



More information about the Pkg-gnupg-commit mailing list