summaryrefslogtreecommitdiff
path: root/tests/tstunt
diff options
context:
space:
mode:
authorIan Jackson <ijackson@chiark.greenend.org.uk>2017-08-03 22:27:28 +0100
committerIan Jackson <ijackson@chiark.greenend.org.uk>2017-08-04 21:44:45 +0100
commita6c565be751393ef52d2b74919b7ce2744019394 (patch)
tree32c1d9621de54334f06604abafd09c8864d9fd41 /tests/tstunt
parentce8eb52870a6c55f5b87ab8def5db27cdf03703c (diff)
test suite: stunt gnupg runs gpg again if it exits status 2
Work around gnupg agent connection races by having our stunt gpg wrapper simply try running gpg again, once, if it exits 2. This does not fully suppress the bug but it does significantly reduce the probability. Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Diffstat (limited to 'tests/tstunt')
-rwxr-xr-xtests/tstunt/gpg16
1 files changed, 15 insertions, 1 deletions
diff --git a/tests/tstunt/gpg b/tests/tstunt/gpg
index d71aa63..790c46c 100755
--- a/tests/tstunt/gpg
+++ b/tests/tstunt/gpg
@@ -1,6 +1,20 @@
#!/bin/sh
set -e
-exec \
+
+for attempt in '' exec; do
+
+set +e
+$attempt \
$DGIT_TEST_REAL_GPG \
--agent-program=$DGIT_STUNT_AGENT \
"$@"
+rc=$?
+set -e
+
+if [ $rc != 2 ]; then exit $rc; fi
+
+echo >&2 "WARNING - GNUPG FAILED $rc - STUNT GNUPG $attempt $*"
+
+done
+
+exit 127