Skip to content

Commit 2b60649

Browse files
dschogitster
authored andcommitted
tests: increase the verbosity of the GPG-related prereqs
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 no longer redirecting the output not to `/dev/null`. This is now possible because the affected prereqs were turned into lazy ones (and are therefore evaluated via `test_eval_` which respects the `--verbose` option). Note that we _still_ redirect `stdout` to `/dev/null` for those commands that sign their `stdin`, as the output would be binary (and useless anyway, because the reader would not have anything against which to compare the output). Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent b417ec5 commit 2b60649

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

t/lib-gpg.sh

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,12 @@ test_lazy_prereq GPG '
4040
# > lib-gpg/ownertrust
4141
mkdir "$GNUPGHOME" &&
4242
chmod 0700 "$GNUPGHOME" &&
43-
(gpgconf --kill gpg-agent >/dev/null 2>&1 || : ) &&
44-
gpg --homedir "${GNUPGHOME}" 2>/dev/null --import \
43+
(gpgconf --kill gpg-agent || : ) &&
44+
gpg --homedir "${GNUPGHOME}" --import \
4545
"$TEST_DIRECTORY"/lib-gpg/keyring.gpg &&
46-
gpg --homedir "${GNUPGHOME}" 2>/dev/null --import-ownertrust \
46+
gpg --homedir "${GNUPGHOME}" --import-ownertrust \
4747
"$TEST_DIRECTORY"/lib-gpg/ownertrust &&
48-
gpg --homedir "${GNUPGHOME}" </dev/null >/dev/null 2>&1 \
48+
gpg --homedir "${GNUPGHOME}" </dev/null >/dev/null \
4949
--sign -u committer@example.com
5050
;;
5151
esac
@@ -68,23 +68,23 @@ test_lazy_prereq GPGSM '
6868
# gpgsm --homedir /tmp/gpghome/ \
6969
# -o t/lib-gpg/gpgsm_cert.p12 \
7070
# --export-secret-key-p12 "committer@example.com"
71-
echo | gpgsm --homedir "${GNUPGHOME}" 2>/dev/null \
72-
--passphrase-fd 0 --pinentry-mode loopback \
73-
--import "$TEST_DIRECTORY"/lib-gpg/gpgsm_cert.p12 &&
71+
echo | gpgsm --homedir "${GNUPGHOME}" \
72+
--passphrase-fd 0 --pinentry-mode loopback \
73+
--import "$TEST_DIRECTORY"/lib-gpg/gpgsm_cert.p12 &&
7474
75-
gpgsm --homedir "${GNUPGHOME}" 2>/dev/null -K |
76-
grep fingerprint: |
77-
cut -d" " -f4 |
75+
gpgsm --homedir "${GNUPGHOME}" -K |
76+
grep fingerprint: |
77+
cut -d" " -f4 |
7878
tr -d "\\n" >"${GNUPGHOME}/trustlist.txt" &&
7979
80-
echo " S relax" >>"${GNUPGHOME}/trustlist.txt" &&
81-
echo hello | gpgsm --homedir "${GNUPGHOME}" >/dev/null \
82-
-u committer@example.com -o /dev/null --sign - 2>&1
80+
echo " S relax" >>"${GNUPGHOME}/trustlist.txt" &&
81+
echo hello | gpgsm --homedir "${GNUPGHOME}" >/dev/null \
82+
-u committer@example.com -o /dev/null --sign -
8383
'
8484

8585
test_lazy_prereq RFC1991 '
8686
test_have_prereq GPG &&
87-
echo | gpg --homedir "${GNUPGHOME}" -b --rfc1991 >/dev/null 2>&1
87+
echo | gpg --homedir "${GNUPGHOME}" -b --rfc1991 >/dev/null
8888
'
8989

9090
sanitize_pgp() {

0 commit comments

Comments
 (0)