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 <gitster@pobox.com>
Junio C Hamano committed
Dec 12, 2014 at 12:33 UTC
4b0bf39dd580239f647cb925a57566bf60c1f93c
1 file changed
+14
-12
t/lib-gpg.sh
+14
-12
@@ -16,23 +16,25 @@ else
16
# Type DSA and Elgamal, size 2048 bits, no expiration date.
17
# Name and email: C O Mitter <committer@example.com>
18
# 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 &&
27
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
28
;;
29
esac
30
fi
31
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
+
38
sanitize_pgp() {
39
perl -ne '
40
/^-----END PGP/ and $in_pgp = 0;