From a6c565be751393ef52d2b74919b7ce2744019394 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Thu, 3 Aug 2017 22:27:28 +0100 Subject: [PATCH] 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 --- debian/changelog | 4 ++++ tests/tstunt/gpg | 16 +++++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index e1c2c476..7bae4d2e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -21,6 +21,10 @@ dgit (4.1~) experimental; urgency=medium Test suite: * sbuild-gitish: New test case to check running sbuild from git + * 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. -- diff --git a/tests/tstunt/gpg b/tests/tstunt/gpg index d71aa63f..790c46c8 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 -- 2.30.2