diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2018-07-12 08:33:17 +0100 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2018-07-12 08:33:17 +0100 |
commit | ae8f33be945323e02e670a97c8ac6d42a0e1be40 (patch) | |
tree | 2bbf98c464b32b8ede618bf93929741246b81b5f /tests/tstunt/gpg-withagent | |
parent | 4a142fe137c1bed5a0cb5d14c41adcb3355458c4 (diff) | |
parent | 7166dbc963a9c01ce62a0564bb7b905156adb560 (diff) |
Merge tag 'debian/5.8' into stretch-bpo
dgit release 5.8 for unstable (sid) [dgit]
[dgit distro=debian]
# gpg: Signature made Sun 08 Jul 2018 11:43:29 BST
# gpg: using RSA key 559AE46C2D6B6D3265E7CBA1E3E3392348B50D39
# gpg: Can't check signature: No public key
Diffstat (limited to 'tests/tstunt/gpg-withagent')
-rwxr-xr-x | tests/tstunt/gpg-withagent | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/tests/tstunt/gpg-withagent b/tests/tstunt/gpg-withagent new file mode 100755 index 0000000..b7b8bfd --- /dev/null +++ b/tests/tstunt/gpg-withagent @@ -0,0 +1,68 @@ +#!/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" + exit 127 + ;; + esac + sleep $sleeptime + sleeptime=$(echo "($sleeptime + 0.001) * 2" | bc -l) + done +} + +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 \ + '/echo dgit-gpg-agent-ok' /bye 2>&1 \ + | grep dgit-gpg-agent-ok >&2 +} + + +$DGIT_STUNT_AGENT --daemon </dev/null >&2 +retry_until_ok agent_is_running + +echo >&2 'GPG-WITHAGENT... RUNNING' + +d + +set +e +$DGIT_TEST_REAL_GPG \ + --agent-program=$DGIT_STUNT_AGENT "$@" 2>&9 +rc=$? +set -e + +d + +echo >&2 'GPG-WITHAGENT... STOPPING' + +retry_until_ok kill_agent_not_running + +echo >&2 'GPG-WITHAGENT... DONE' + +d + +exit $rc |