Thread (15 messages) flat view 15 messages, 5 authors, 2016-06-15
STALE3743d

[PATCH 2/2] tests: make test_must_fail fail on missing commands

From: Jeff King <hidden>
Date: 2016-06-15 22:49:25
Subsystem: the rest · Maintainer: Linus Torvalds

The point of it is to run a command that produces failure. A
missing command is more likely an error in the test script
(e.g., using 'test_must_fail "command with arguments"', or
relying on a missing command).

Signed-off-by: Jeff King <redacted>
---
 t/test-lib.sh |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 285bfd8..dbb13af 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -598,6 +598,9 @@ test_must_fail () {
 	elif test $exit_code -gt 129 -a $exit_code -le 192; then
 		echo >&2 "test_must_fail: died by signal: $*"
 		return 1
+	elif test $exit_code = 127; then
+		echo >&2 "test_must_fail: command not found: $*"
+		return 1
 	fi
 	return 0
 }
-- 
1.7.2.2.119.gf9c33
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help