chiark / gitweb /
po4a: pairwise-pocheck: Force it to be run sometimes
[dgit.git] / tests / tstunt / gpg-withagent
index 4cb5d4e619ee75d81eb1351883d2f21ad9a010c5..b7b8bfd787680f9db0ec3d95ad02022e6bf032b4 100755 (executable)
@@ -1,9 +1,18 @@
 #!/bin/sh
 set -ex
 
+d () {
+       date --iso-8601=ns >&2
+       ps -ef | grep gpg-agent >&2 ||:
+}
+
+d
+
 retry_until_ok () {
        sleeptime=0
+       d
        while ! "$@"; do
+               d
                case $sleeptime in
                ??.*)
                        echo >&2 "$0: GPG AGENT STARTP $@ TIMED OUT"
@@ -15,7 +24,16 @@ retry_until_ok () {
        done
 }
 
-echo >&2 'GPG-WITHAGENT...'
+kill_agent_not_running () {
+       LC_MESSAGES=C gpg-connect-agent --no-autostart </dev/null \
+               KILLAGENT /bye 2>&1 \
+       | tee -a /dev/stderr \
+       | grep 'no gpg-agent running' >&2
+}
+
+echo >&2 'GPG-WITHAGENT... PRE-STOPPING'
+
+retry_until_ok kill_agent_not_running
 
 agent_is_running () {
        gpg-connect-agent --no-autostart </dev/null \
@@ -29,23 +47,22 @@ retry_until_ok agent_is_running
 
 echo >&2 'GPG-WITHAGENT... RUNNING'
 
+d
+
 set +e
 $DGIT_TEST_REAL_GPG                                    \
-       --agent-program=$DGIT_STUNT_AGENT "$@"
+       --agent-program=$DGIT_STUNT_AGENT "$@" 2>&9
 rc=$?
 set -e
 
-echo >&2 'GPG-WITHAGENT... STOPPING'
+d
 
-kill_agent_not_running () {
-       LC_MESSAGES=C gpg-connect-agent --no-autostart </dev/null \
-               KILLAGENT /bye 2>&1 \
-       | tee -a /dev/stderr \
-       | grep 'no gpg-agent running' >&2
-}
+echo >&2 'GPG-WITHAGENT... STOPPING'
 
 retry_until_ok kill_agent_not_running
 
 echo >&2 'GPG-WITHAGENT... DONE'
 
+d
+
 exit $rc