diff options
author | Ian Jackson <ijackson@chiark.greenend.org.uk> | 2018-01-07 14:34:08 +0000 |
---|---|---|
committer | Ian Jackson <ijackson@chiark.greenend.org.uk> | 2018-01-07 16:18:53 +0000 |
commit | a1f9fa9628907a650f00f27ad1669d5ad69028d3 (patch) | |
tree | 3bb595e7723d9f599078c73ac3fa6d8ec8643355 /tests/tstunt | |
parent | 640602b53ec3a387aef776d6a727118e1784f6d7 (diff) |
test suite: gnupg: Save stdin on apt-key's import invocations
Recognise these with an ad-hoc pattern on the command line arguments.
When they occur, save stdin to a temporary file.
We can't do this generally, because stdin might be some thing that
gpg's caller doesn't expect gpg to eat.
When we do this saving, print the size in bytes of the input file.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Diffstat (limited to 'tests/tstunt')
-rwxr-xr-x | tests/tstunt/gpg-locked | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/tests/tstunt/gpg-locked b/tests/tstunt/gpg-locked index 892b9c8..ddb880f 100755 --- a/tests/tstunt/gpg-locked +++ b/tests/tstunt/gpg-locked @@ -3,6 +3,20 @@ set -e for attempt in '' ' ' exec; do +case "$*" in +*" +--batch +--import") + # ^ apt-key's invocation + if [ "x$stdin_tmp" = x ]; then + stdin_tmp="$GNUPGHOME"/dgit-stdin-tmp + cat >$stdin_tmp + stdin_tmp_bytes=$(wc -c <$stdin_tmp) + fi + exec <$stdin_tmp + ;; +esac + set +e $attempt \ $DGIT_TEST_REAL_GPG \ @@ -13,7 +27,7 @@ set -e if [ $rc != 2 ]; then exit $rc; fi -echo >&2 "WARNING - GNUPG FAILED $rc - STUNT GNUPG $attempt $*" +echo >&2 "WARNING - GNUPG FAILED $rc - STUNT GNUPG $attempt $stdin_tmp_bytes $*" sh -ec ' if [ "x$DGIT_GNUPG_STUNT_ERRLOG" != x ]; then @@ -23,7 +37,7 @@ sh -ec ' fi exec >/dev/tty printf "%s\n" "$*" -' x "GNUPG WRAPPER - TROUBLE - $HOME $GNUPGHOME - FAILED $rc $attempt $*" +' x "GNUPG WRAPPER - TROUBLE - $HOME $GNUPGHOME - FAILED $rc $attempt $stdin_tmp_bytes $*" sleep 10 |