Merge branch 'jk/test-helper-v-output-fix'

Test framework update.

* jk/test-helper-v-output-fix:
  t: send verbose test-helper output to fd 4
This commit is contained in:
Junio C Hamano 2018-03-06 14:54:05 -08:00
commit 148bce96e5

View file

@ -633,22 +633,22 @@ test_must_fail () {
exit_code=$? exit_code=$?
if test $exit_code -eq 0 && ! list_contains "$_test_ok" success if test $exit_code -eq 0 && ! list_contains "$_test_ok" success
then then
echo >&2 "test_must_fail: command succeeded: $*" echo >&4 "test_must_fail: command succeeded: $*"
return 1 return 1
elif test_match_signal 13 $exit_code && list_contains "$_test_ok" sigpipe elif test_match_signal 13 $exit_code && list_contains "$_test_ok" sigpipe
then then
return 0 return 0
elif test $exit_code -gt 129 && test $exit_code -le 192 elif test $exit_code -gt 129 && test $exit_code -le 192
then then
echo >&2 "test_must_fail: died by signal $(($exit_code - 128)): $*" echo >&4 "test_must_fail: died by signal $(($exit_code - 128)): $*"
return 1 return 1
elif test $exit_code -eq 127 elif test $exit_code -eq 127
then then
echo >&2 "test_must_fail: command not found: $*" echo >&4 "test_must_fail: command not found: $*"
return 1 return 1
elif test $exit_code -eq 126 elif test $exit_code -eq 126
then then
echo >&2 "test_must_fail: valgrind error: $*" echo >&4 "test_must_fail: valgrind error: $*"
return 1 return 1
fi fi
return 0 return 0
@ -688,7 +688,7 @@ test_expect_code () {
return 0 return 0
fi fi
echo >&2 "test_expect_code: command exited with $exit_code, we wanted $want_code $*" echo >&4 "test_expect_code: command exited with $exit_code, we wanted $want_code $*"
return 1 return 1
} }
@ -752,18 +752,18 @@ test_i18ngrep () {
shift shift
! grep "$@" && return 0 ! grep "$@" && return 0
echo >&2 "error: '! grep $@' did find a match in:" echo >&4 "error: '! grep $@' did find a match in:"
else else
grep "$@" && return 0 grep "$@" && return 0
echo >&2 "error: 'grep $@' didn't find a match in:" echo >&4 "error: 'grep $@' didn't find a match in:"
fi fi
if test -s "$last_arg" if test -s "$last_arg"
then then
cat >&2 "$last_arg" cat >&4 "$last_arg"
else else
echo >&2 "<File '$last_arg' is empty>" echo >&4 "<File '$last_arg' is empty>"
fi fi
return 1 return 1
@ -774,7 +774,7 @@ test_i18ngrep () {
# not output anything when they fail. # not output anything when they fail.
verbose () { verbose () {
"$@" && return 0 "$@" && return 0
echo >&2 "command failed: $(git rev-parse --sq-quote "$@")" echo >&4 "command failed: $(git rev-parse --sq-quote "$@")"
return 1 return 1
} }