Code

tests: make test_might_fail more verbose
authorJonathan Nieder <jrnieder@gmail.com>
Tue, 31 Aug 2010 17:10:55 +0000 (12:10 -0500)
committerJunio C Hamano <gitster@pobox.com>
Tue, 31 Aug 2010 18:09:21 +0000 (11:09 -0700)
Let test_might_fail say something about its failures for consistency
with test_must_fail.

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 dbb13af33eb8e12a13992e63a2c00748d29f8495..16ceb5316fbdc39225158cd3be109ab727a3f76f 100644 (file)
@@ -618,7 +618,12 @@ 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
+       fi
+       return 0
 }
 
 # test_cmp is a helper function to compare actual and expected output.