Re: [PATCH 2/2] tests: make test_must_fail fail on missing commands
- From
Jonathan Nieder <jrnieder@gmail.com>
- Date
- Aug 31, 2010, 17:26 UTC
- Message-ID
- <20100831172657.GP2315@burratino>
- In-Reply-To
- <20100831155652.GB11530@sigill.intra.peff.net>
Jeff King wrote:
> The point of it is to run a command that produces failure. A > missing command is more likely an error in the test script
Makes sense. Here's the corresponding change for test_might_fail.
-- 8< -- Subject: tests: make test_might_fail fail on missing commands
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> --- 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 16ceb53..7da490d 100644 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -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 }
-- 1.7.2.2