Skip to content

Commit 4b0bf39

Browse files
committed
tests: squelch noise from GPG machinery set-up
It is distracting to let the GPG message while setting up the test gpghome leak into the test output, especially without running these tests with "-v" option. The splitting of RFC1991 prerequiste part is about future-proofing. When we want to define other kinds of specific prerequisites in the future, we'd prefer to see it done separately from the basic set-up code. Signed-off-by: Junio C Hamano <[email protected]>
1 parent 1e3eefb commit 4b0bf39

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

t/lib-gpg.sh

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,25 @@ else
1616
# Type DSA and Elgamal, size 2048 bits, no expiration date.
1717
# Name and email: C O Mitter <[email protected]>
1818
# No password given, to enable non-interactive operation.
19-
mkdir ./gpghome
20-
chmod 0700 ./gpghome
21-
GNUPGHOME="$(pwd)/gpghome"
22-
export GNUPGHOME
23-
gpg --homedir "${GNUPGHOME}" --import \
24-
"$TEST_DIRECTORY"/lib-gpg/keyring.gpg
25-
gpg --homedir "${GNUPGHOME}" --import-ownertrust \
26-
"$TEST_DIRECTORY"/lib-gpg/ownertrust
19+
mkdir ./gpghome &&
20+
chmod 0700 ./gpghome &&
21+
GNUPGHOME="$(pwd)/gpghome" &&
22+
export GNUPGHOME &&
23+
gpg --homedir "${GNUPGHOME}" 2>/dev/null --import \
24+
"$TEST_DIRECTORY"/lib-gpg/keyring.gpg &&
25+
gpg --homedir "${GNUPGHOME}" 2>/dev/null --import-ownertrust \
26+
"$TEST_DIRECTORY"/lib-gpg/ownertrust &&
2727
test_set_prereq GPG
28-
if echo | gpg --homedir "${GNUPGHOME}" -b --rfc1991 >/dev/null 2>&1
29-
then
30-
test_set_prereq RFC1991
31-
fi
3228
;;
3329
esac
3430
fi
3531

32+
if test_have_prereq GPG &&
33+
echo | gpg --homedir "${GNUPGHOME}" -b --rfc1991 >/dev/null 2>&1
34+
then
35+
test_set_prereq RFC1991
36+
fi
37+
3638
sanitize_pgp() {
3739
perl -ne '
3840
/^-----END PGP/ and $in_pgp = 0;

0 commit comments

Comments
 (0)