public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Brian Gernhardt <brian@gernhardtsoftware•com>
To: Git List <git@vger•kernel.org>
Cc: Junio C Hamano <gitster@pobox•com>
Subject: [PATCH] t7510: Skip all if GPG isn't installed
Date: Tue, 24 Jun 2014 00:52:16 -0400	[thread overview]
Message-ID: <1403585536-32185-1-git-send-email-brian@gernhardtsoftware.com> (raw)

Since the setup requires the GPG prerequisite, it doesn't make much
sense to try and run any tests without it.  So rather than using a
prereq on each individual test and possibly forgetting it on new ones
(as just happened), skip the entire file if GPG isn't found.

Signed-off-by: Brian Gernhardt <brian@gernhardtsoftware•com>
---
 t/t7510-signed-commit.sh | 24 +++++++++++++++---------
 1 file changed, 15 insertions(+), 9 deletions(-)

diff --git a/t/t7510-signed-commit.sh b/t/t7510-signed-commit.sh
index 9810242..414f9d1 100755
--- a/t/t7510-signed-commit.sh
+++ b/t/t7510-signed-commit.sh
@@ -4,7 +4,13 @@ test_description='signed commit tests'
 . ./test-lib.sh
 . "$TEST_DIRECTORY/lib-gpg.sh"
 
-test_expect_success GPG 'create signed commits' '
+if ! test_have_prereq GPG
+then
+	skip_all='skipping signed commit tests; gpg not available'
+	test_done
+fi
+
+test_expect_success 'create signed commits' '
 	test_when_finished "test_unconfig commit.gpgsign" &&
 
 	echo 1 >file && git add file &&
@@ -48,7 +54,7 @@ test_expect_success GPG 'create signed commits' '
 	git tag eighth-signed-alt
 '
 
-test_expect_success GPG 'show signatures' '
+test_expect_success 'show signatures' '
 	(
 		for commit in initial second merge fourth-signed fifth-signed sixth-signed seventh-signed
 		do
@@ -79,7 +85,7 @@ test_expect_success GPG 'show signatures' '
 	)
 '
 
-test_expect_success GPG 'detect fudged signature' '
+test_expect_success 'detect fudged signature' '
 	git cat-file commit seventh-signed >raw &&
 
 	sed -e "s/seventh/7th forged/" raw >forged1 &&
@@ -89,7 +95,7 @@ test_expect_success GPG 'detect fudged signature' '
 	! grep "Good signature from" actual1
 '
 
-test_expect_success GPG 'detect fudged signature with NUL' '
+test_expect_success 'detect fudged signature with NUL' '
 	git cat-file commit seventh-signed >raw &&
 	cat raw >forged2 &&
 	echo Qwik | tr "Q" "\000" >>forged2 &&
@@ -99,7 +105,7 @@ test_expect_success GPG 'detect fudged signature with NUL' '
 	! grep "Good signature from" actual2
 '
 
-test_expect_success GPG 'amending already signed commit' '
+test_expect_success 'amending already signed commit' '
 	git checkout fourth-signed^0 &&
 	git commit --amend -S --no-edit &&
 	git show -s --show-signature HEAD >actual &&
@@ -107,7 +113,7 @@ test_expect_success GPG 'amending already signed commit' '
 	! grep "BAD signature from" actual
 '
 
-test_expect_success GPG 'show good signature with custom format' '
+test_expect_success 'show good signature with custom format' '
 	cat >expect <<-\EOF &&
 	G
 	13B6F51ECDDE430D
@@ -117,7 +123,7 @@ test_expect_success GPG 'show good signature with custom format' '
 	test_cmp expect actual
 '
 
-test_expect_success GPG 'show bad signature with custom format' '
+test_expect_success 'show bad signature with custom format' '
 	cat >expect <<-\EOF &&
 	B
 	13B6F51ECDDE430D
@@ -127,7 +133,7 @@ test_expect_success GPG 'show bad signature with custom format' '
 	test_cmp expect actual
 '
 
-test_expect_success GPG 'show unknown signature with custom format' '
+test_expect_success 'show unknown signature with custom format' '
 	cat >expect <<-\EOF &&
 	U
 	61092E85B7227189
@@ -137,7 +143,7 @@ test_expect_success GPG 'show unknown signature with custom format' '
 	test_cmp expect actual
 '
 
-test_expect_success GPG 'show lack of signature with custom format' '
+test_expect_success 'show lack of signature with custom format' '
 	cat >expect <<-\EOF &&
 	N
 
-- 
2.0.0.495.gf681aa8

             reply	other threads:[~2014-06-24  5:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-24  4:52 Brian Gernhardt [this message]
2014-06-25 21:16 ` [PATCH] t7510: Skip all if GPG isn't installed Junio C Hamano
2014-06-25 21:42   ` Jeff King
2014-06-25 22:24     ` Junio C Hamano

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=1403585536-32185-1-git-send-email-brian@gernhardtsoftware.com \
    --to=brian@gernhardtsoftware$(echo .)com \
    --cc=git@vger$(echo .)kernel.org \
    --cc=gitster@pobox$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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