Code

tests: make test_might_fail fail on missing commands
authorJonathan Nieder <jrnieder@gmail.com>
Tue, 31 Aug 2010 17:26:57 +0000 (12:26 -0500)
committerJunio C Hamano <gitster@pobox.com>
Tue, 31 Aug 2010 18:40:20 +0000 (11:40 -0700)
Detect and report hard-to-notice spelling mistakes like

 test_might_fail "git config --unset whatever"

(the extra quotes prevent the shell from running git as intended;
instead, the shell looks for a "git config --unset whatever" file).

Cc: Jeff King <peff@peff.net>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/test-lib.sh

index 16ceb5316fbdc39225158cd3be109ab727a3f76f..7da490de01063083c87f5f282408f1fdf1fa4ecb 100644 (file)
@@ -622,6 +622,9 @@ test_might_fail () {
        if test $exit_code -gt 129 -a $exit_code -le 192; then
                echo >&2 "test_might_fail: died by signal: $*"
                return 1
+       elif test $exit_code = 127; then
+               echo >&2 "test_might_fail: command not found: $*"
+               return 1
        fi
        return 0
 }