Skip to content

Commit a54ce3c

Browse files
peffgitster
authored andcommitted
tests: make test_must_fail fail on missing commands
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 <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 16034fb commit a54ce3c

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

t/test-lib.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -598,6 +598,9 @@ test_must_fail () {
598598
elif test $exit_code -gt 129 -a $exit_code -le 192; then
599599
echo >&2 "test_must_fail: died by signal: $*"
600600
return 1
601+
elif test $exit_code = 127; then
602+
echo >&2 "test_must_fail: command not found: $*"
603+
return 1
601604
fi
602605
return 0
603606
}

0 commit comments

Comments
 (0)