git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH 1/2] t7510-signed-commit: use 'test_must_fail'
@ 2018-06-04 13:39 SZEDER Gábor
  2018-06-04 13:39 ` [PATCH 2/2] tests: make forging GPG signed commits and tags more robust SZEDER Gábor
  0 siblings, 1 reply; 3+ messages in thread
From: SZEDER Gábor @ 2018-06-04 13:39 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, SZEDER Gábor

The two tests 'detect fudged signature' and 'detect fudged signature
with NUL' in 't7510-signed-commit.sh' check that 'git verify-commit'
errors out when encountering a forged commit, but they do so by
running

  ! git verify-commit ...

Use 'test_must_fail' instead, because that would catch potential
unexpected errors like a segfault as well.

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
---
 t/t7510-signed-commit.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/t/t7510-signed-commit.sh b/t/t7510-signed-commit.sh
index 762135adea..663bf68def 100755
--- a/t/t7510-signed-commit.sh
+++ b/t/t7510-signed-commit.sh
@@ -145,7 +145,7 @@ test_expect_success GPG 'detect fudged signature' '
 
 	sed -e "s/seventh/7th forged/" raw >forged1 &&
 	git hash-object -w -t commit forged1 >forged1.commit &&
-	! git verify-commit $(cat forged1.commit) &&
+	test_must_fail git verify-commit $(cat forged1.commit) &&
 	git show --pretty=short --show-signature $(cat forged1.commit) >actual1 &&
 	grep "BAD signature from" actual1 &&
 	! grep "Good signature from" actual1
@@ -156,7 +156,7 @@ test_expect_success GPG 'detect fudged signature with NUL' '
 	cat raw >forged2 &&
 	echo Qwik | tr "Q" "\000" >>forged2 &&
 	git hash-object -w -t commit forged2 >forged2.commit &&
-	! git verify-commit $(cat forged2.commit) &&
+	test_must_fail git verify-commit $(cat forged2.commit) &&
 	git show --pretty=short --show-signature $(cat forged2.commit) >actual2 &&
 	grep "BAD signature from" actual2 &&
 	! grep "Good signature from" actual2
-- 
2.18.0.rc0.207.ga6211da864


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-06-04 22:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-04 13:39 [PATCH 1/2] t7510-signed-commit: use 'test_must_fail' SZEDER Gábor
2018-06-04 13:39 ` [PATCH 2/2] tests: make forging GPG signed commits and tags more robust SZEDER Gábor
2018-06-04 22:33   ` brian m. carlson

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).