From: Jeff King <peff@peff.net>
To: "Michał Górny" <mgorny@gentoo.org>
Cc: git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>,
Michael J Gruber <git@drmicha.warpmail.net>
Subject: [PATCH 1/5] t7004: factor out gpg setup
Date: Wed, 7 Sep 2011 13:42:39 -0400 [thread overview]
Message-ID: <20110907174239.GA11355@sigill.intra.peff.net> (raw)
In-Reply-To: <20110902175323.GA29761@sigill.intra.peff.net>
Other test scripts may want to look at or verify signed
tags, and the setup is non-trivial. Let's factor this out
into lib-gpg.sh for other tests to use.
Signed-off-by: Jeff King <peff@peff.net>
---
Similar to the one I sent out earlier, but in that one I accidentally
did:
. ../lib-gpg.sh
which is not right. If --root is used for the test script, then ".." is
not necessarily the right place to find the lib-gpg script. This fixes
it to use $TEST_DIRECTORY.
t/lib-gpg.sh | 26 ++++++++++++++++++++++++++
t/{t7004 => lib-gpg}/pubring.gpg | Bin 1164 -> 1164 bytes
t/{t7004 => lib-gpg}/random_seed | Bin 600 -> 600 bytes
t/{t7004 => lib-gpg}/secring.gpg | Bin 1237 -> 1237 bytes
t/{t7004 => lib-gpg}/trustdb.gpg | Bin 1280 -> 1280 bytes
t/t7004-tag.sh | 29 +----------------------------
6 files changed, 27 insertions(+), 28 deletions(-)
create mode 100755 t/lib-gpg.sh
rename t/{t7004 => lib-gpg}/pubring.gpg (100%)
rename t/{t7004 => lib-gpg}/random_seed (100%)
rename t/{t7004 => lib-gpg}/secring.gpg (100%)
rename t/{t7004 => lib-gpg}/trustdb.gpg (100%)
diff --git a/t/lib-gpg.sh b/t/lib-gpg.sh
new file mode 100755
index 0000000..28463fb
--- /dev/null
+++ b/t/lib-gpg.sh
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+gpg_version=`gpg --version 2>&1`
+if test $? = 127; then
+ say "You do not seem to have gpg installed"
+else
+ # As said here: http://www.gnupg.org/documentation/faqs.html#q6.19
+ # the gpg version 1.0.6 didn't parse trust packets correctly, so for
+ # that version, creation of signed tags using the generated key fails.
+ case "$gpg_version" in
+ 'gpg (GnuPG) 1.0.6'*)
+ say "Your version of gpg (1.0.6) is too buggy for testing"
+ ;;
+ *)
+ # key generation info: gpg --homedir t/lib-gpg --gen-key
+ # Type DSA and Elgamal, size 2048 bits, no expiration date.
+ # Name and email: C O Mitter <committer@example.com>
+ # No password given, to enable non-interactive operation.
+ cp -R "$TEST_DIRECTORY"/lib-gpg ./gpghome
+ chmod 0700 gpghome
+ GNUPGHOME="$(pwd)/gpghome"
+ export GNUPGHOME
+ test_set_prereq GPG
+ ;;
+ esac
+fi
diff --git a/t/t7004/pubring.gpg b/t/lib-gpg/pubring.gpg
similarity index 100%
rename from t/t7004/pubring.gpg
rename to t/lib-gpg/pubring.gpg
diff --git a/t/t7004/random_seed b/t/lib-gpg/random_seed
similarity index 100%
rename from t/t7004/random_seed
rename to t/lib-gpg/random_seed
diff --git a/t/t7004/secring.gpg b/t/lib-gpg/secring.gpg
similarity index 100%
rename from t/t7004/secring.gpg
rename to t/lib-gpg/secring.gpg
diff --git a/t/t7004/trustdb.gpg b/t/lib-gpg/trustdb.gpg
similarity index 100%
rename from t/t7004/trustdb.gpg
rename to t/lib-gpg/trustdb.gpg
diff --git a/t/t7004-tag.sh b/t/t7004-tag.sh
index 097ce2b..e93ac73 100755
--- a/t/t7004-tag.sh
+++ b/t/t7004-tag.sh
@@ -8,6 +8,7 @@ test_description='git tag
Tests for operations with tags.'
. ./test-lib.sh
+. "$TEST_DIRECTORY"/lib-gpg.sh
# creating and listing lightweight tags:
@@ -585,24 +586,6 @@ test_expect_success \
test_cmp expect actual
'
-# subsequent tests require gpg; check if it is available
-gpg --version >/dev/null 2>/dev/null
-if [ $? -eq 127 ]; then
- say "# gpg not found - skipping tag signing and verification tests"
-else
- # As said here: http://www.gnupg.org/documentation/faqs.html#q6.19
- # the gpg version 1.0.6 didn't parse trust packets correctly, so for
- # that version, creation of signed tags using the generated key fails.
- case "$(gpg --version)" in
- 'gpg (GnuPG) 1.0.6'*)
- say "Skipping signed tag tests, because a bug in 1.0.6 version"
- ;;
- *)
- test_set_prereq GPG
- ;;
- esac
-fi
-
# trying to verify annotated non-signed tags:
test_expect_success GPG \
@@ -625,16 +608,6 @@ test_expect_success GPG \
# creating and verifying signed tags:
-# key generation info: gpg --homedir t/t7004 --gen-key
-# Type DSA and Elgamal, size 2048 bits, no expiration date.
-# Name and email: C O Mitter <committer@example.com>
-# No password given, to enable non-interactive operation.
-
-cp -R "$TEST_DIRECTORY"/t7004 ./gpghome
-chmod 0700 gpghome
-GNUPGHOME="$(pwd)/gpghome"
-export GNUPGHOME
-
get_tag_header signed-tag $commit commit $time >expect
echo 'A signed tag message' >>expect
echo '-----BEGIN PGP SIGNATURE-----' >>expect
--
1.7.6.10.g62f04
next prev parent reply other threads:[~2011-09-07 17:42 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-29 19:10 More formatting with 'git tag -l' Michał Górny
2011-08-29 19:36 ` Jeff King
2011-08-29 21:20 ` Michał Górny
2011-08-29 21:37 ` Jeff King
2011-08-29 21:50 ` Michał Górny
2011-08-30 8:57 ` [PATCH] git-for-each-ref: move GPG sigs off %(body) to %(signature) Michał Górny
2011-08-30 9:43 ` Michael J Gruber
2011-08-30 15:58 ` Michał Górny
2011-08-30 16:27 ` Jeff King
2011-08-31 9:11 ` [PATCH] for-each-ref: add split message parts to %(contents:*) Michał Górny
2011-08-31 16:42 ` Jeff King
2011-08-31 16:44 ` [PATCH 1/2] t7004: factor out gpg setup Jeff King
2011-08-31 16:44 ` [PATCH 2/2] t6300: test new content:* for-each-ref placeholders Jeff King
2011-08-31 22:54 ` [PATCH] for-each-ref: add split message parts to %(contents:*) Junio C Hamano
2011-08-31 23:22 ` Jeff King
2011-09-01 7:34 ` Michał Górny
2011-09-01 16:00 ` Junio C Hamano
2011-09-01 16:22 ` Jeff King
2011-09-01 16:48 ` Michał Górny
2011-09-01 16:50 ` Michał Górny
2011-09-02 16:39 ` Jeff King
2011-09-02 17:39 ` Michał Górny
2011-09-02 17:53 ` Jeff King
2011-09-07 17:40 ` Jeff King
2011-09-15 8:18 ` Michał Górny
2011-09-07 17:42 ` Jeff King [this message]
2011-09-07 17:43 ` [PATCH 2/5] t6300: add more body-parsing tests Jeff King
2011-09-07 17:44 ` [PATCH 3/5] for-each-ref: refactor subject and body placeholder parsing Jeff King
2011-09-07 17:44 ` [PATCH 4/5] for-each-ref: handle multiline subjects like --pretty Jeff King
2011-09-07 17:46 ` [PATCH 5/5] for-each-ref: add split message parts to %(contents:*) Jeff King
2011-09-01 17:16 ` [PATCH] " Junio C Hamano
2011-09-01 18:19 ` Jeff King
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20110907174239.GA11355@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=git@drmicha.warpmail.net \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=mgorny@gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).