diff options
author | Junio C Hamano <gitster@pobox.com> | 2010-09-08 20:17:01 +0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2010-09-08 20:17:01 +0400 |
commit | 1080be268b0558ecdc5567e1864a3ae56e25ba65 (patch) | |
tree | 3a267aaa461f419ab1093948127be0cbcd764930 /t | |
parent | 1d86cb80ceee1e93eacded1555abd7f113857efd (diff) | |
parent | d0b8a61742714b93b614f9823491a7557879dfb9 (diff) |
Merge branch 'jk/test-must-fail-missing'
* jk/test-must-fail-missing:
tests: make test_might_fail fail on missing commands
tests: make test_might_fail more verbose
tests: make test_must_fail fail on missing commands
tests: make test_must_fail more verbose
Diffstat (limited to 't')
-rw-r--r-- | t/test-lib.sh | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/t/test-lib.sh b/t/test-lib.sh index dff5e25ae6..830e5e7360 100644 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -620,7 +620,18 @@ test_path_is_missing () { test_must_fail () { "$@" - test $? -gt 0 -a $? -le 129 -o $? -gt 192 + exit_code=$? + if test $exit_code = 0; then + echo >&2 "test_must_fail: command succeeded: $*" + return 1 + 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 } # Similar to test_must_fail, but tolerates success, too. This is @@ -636,7 +647,15 @@ test_must_fail () { test_might_fail () { "$@" - test $? -ge 0 -a $? -le 129 -o $? -gt 192 + exit_code=$? + 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 } # test_cmp is a helper function to compare actual and expected output. |