From: Johannes Schindelin <johannes.schindelin@xxxxxx> Especially when debugging a test failure that can only be reproduced in the CI build (e.g. when the developer has no access to a macOS machine other than running the tests on a macOS build agent), output should not be suppressed. In the instance of `hi/gpg-prefer-check-signature`, where one GPG-related test failed for no apparent reason, the entire output of `gpg` and `gpgsm` was suppressed, even in verbose mode, leaving interested readers no clue what was going wrong. Let's fix this by redirecting the output not to `/dev/null`, but to the file descriptors that may, or may not, be redirected via `--verbose-log`. For good measure, also turn on tracing if the user asked for it, and prefix it with a helpful info message. Signed-off-by: Johannes Schindelin <johannes.schindelin@xxxxxx> --- t/lib-gpg.sh | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/t/lib-gpg.sh b/t/lib-gpg.sh index 11b83b8c24a..a7d0708f5df 100755 --- a/t/lib-gpg.sh +++ b/t/lib-gpg.sh @@ -11,6 +11,8 @@ then say "Your version of gpg (1.0.6) is too buggy for testing" ;; *) + say_color info >&4 "Trying to set up GPG" + want_trace && set -x # Available key info: # * Type DSA and Elgamal, size 2048 bits, no expiration date, # name and email: C O Mitter <committer@xxxxxxxxxxx> @@ -31,13 +33,13 @@ then chmod 0700 ./gpghome && GNUPGHOME="$PWD/gpghome" && export GNUPGHOME && - (gpgconf --kill gpg-agent >/dev/null 2>&1 || : ) && - gpg --homedir "${GNUPGHOME}" 2>/dev/null --import \ - "$TEST_DIRECTORY"/lib-gpg/keyring.gpg && - gpg --homedir "${GNUPGHOME}" 2>/dev/null --import-ownertrust \ - "$TEST_DIRECTORY"/lib-gpg/ownertrust && - gpg --homedir "${GNUPGHOME}" </dev/null >/dev/null 2>&1 \ - --sign -u committer@xxxxxxxxxxx && + (gpgconf --kill gpg-agent >&3 2>&4 || : ) && + gpg --homedir "${GNUPGHOME}" --import \ + "$TEST_DIRECTORY"/lib-gpg/keyring.gpg >&3 2>&4 && + gpg --homedir "${GNUPGHOME}" --import-ownertrust \ + "$TEST_DIRECTORY"/lib-gpg/ownertrust >&3 2>&4 && + gpg --homedir "${GNUPGHOME}" </dev/null \ + --sign -u committer@xxxxxxxxxxx >&3 2>&4 && test_set_prereq GPG && # Available key info: # * see t/lib-gpg/gpgsm-gen-key.in @@ -54,28 +56,29 @@ then # gpgsm --homedir /tmp/gpghome/ \ # -o t/lib-gpg/gpgsm_cert.p12 \ # --export-secret-key-p12 "committer@xxxxxxxxxxx" - echo | gpgsm --homedir "${GNUPGHOME}" 2>/dev/null \ + echo | gpgsm --homedir "${GNUPGHOME}" >&3 2>&4 \ --passphrase-fd 0 --pinentry-mode loopback \ --import "$TEST_DIRECTORY"/lib-gpg/gpgsm_cert.p12 && - gpgsm --homedir "${GNUPGHOME}" 2>/dev/null -K | + gpgsm --homedir "${GNUPGHOME}" -K 2>&4 | grep fingerprint: | cut -d" " -f4 | tr -d '\n' >"${GNUPGHOME}/trustlist.txt" && echo " S relax" >>"${GNUPGHOME}/trustlist.txt" && - echo hello | gpgsm --homedir "${GNUPGHOME}" >/dev/null \ - -u committer@xxxxxxxxxxx -o /dev/null --sign - 2>&1 && + echo hello | gpgsm --homedir "${GNUPGHOME}" >&3 2>&4 \ + -u committer@xxxxxxxxxxx -o /dev/null --sign - && test_set_prereq GPGSM ;; esac fi if test_have_prereq GPG && - echo | gpg --homedir "${GNUPGHOME}" -b --rfc1991 >/dev/null 2>&1 + echo | gpg --homedir "${GNUPGHOME}" -b --rfc1991 >&3 2>&4 then test_set_prereq RFC1991 fi +want_trace && set +x sanitize_pgp() { perl -ne ' -- gitgitgadget