diff options
author | Kousik Sanagavarapu <five231003@gmail.com> | 2023-06-04 21:22:46 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2023-06-06 03:32:12 +0300 |
commit | 2f36339fa8622ee1cba957e8d0ef15719c697de3 (patch) | |
tree | eb7925b1eb1e4419a626fc8457f60126ca04df65 /t/lib-gpg.sh | |
parent | fe86abd7511a9a6862d5706c6fa1d9b57a63ba09 (diff) |
t/lib-gpg: introduce new prereq GPG2
GnuPG v2.0.0 released in 2006, which according to its release notes
https://gnupg.org/download/release_notes.html
is the "First stable version of GnuPG integrating OpenPGP and S/MIME".
Use this version or its successors for tests that will fail for
versions less than v2.0.0 because of the difference in the output on
stderr between the versions (v2.* vs v0.* or v2.* vs v1.*). Skip if
the GPG version detected is less than v2.0.0.
Do not, however, remove the existing prereq GPG yet since a lot of tests
still work with the prereq GPG (that is even with versions v0.* or v1.*)
and some systems still use these versions.
Mentored-by: Christian Couder <christian.couder@gmail.com>
Mentored-by: Hariom Verma <hariom18599@gmail.com>
Signed-off-by: Kousik Sanagavarapu <five231003@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/lib-gpg.sh')
-rw-r--r-- | t/lib-gpg.sh | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/t/lib-gpg.sh b/t/lib-gpg.sh index 114785586a..d219a09362 100644 --- a/t/lib-gpg.sh +++ b/t/lib-gpg.sh @@ -51,6 +51,27 @@ test_lazy_prereq GPG ' esac ' +test_lazy_prereq GPG2 ' + gpg_version=$(gpg --version 2>&1) + test $? != 127 || exit 1 + + case "$gpg_version" in + "gpg (GnuPG) "[01].*) + say "This test requires a GPG version >= v2.0.0" + exit 1 + ;; + *) + (gpgconf --kill all || : ) && + gpg --homedir "${GNUPGHOME}" --import \ + "$TEST_DIRECTORY"/lib-gpg/keyring.gpg && + gpg --homedir "${GNUPGHOME}" --import-ownertrust \ + "$TEST_DIRECTORY"/lib-gpg/ownertrust && + gpg --homedir "${GNUPGHOME}" </dev/null >/dev/null \ + --sign -u committer@example.com + ;; + esac +' + test_lazy_prereq GPGSM ' test_have_prereq GPG && # Available key info: |