From: Junio C Hamano Date: Tue, 6 Mar 2018 22:54:05 +0000 (-0800) Subject: Merge branch 'jk/test-helper-v-output-fix' X-Git-Tag: v2.17.0-rc0~38 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/148bce96e58a80fcf3a36d0cb70e0bd24ba6cfb6?hp=-c 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 --- 148bce96e58a80fcf3a36d0cb70e0bd24ba6cfb6 diff --combined t/test-lib-functions.sh index 8a8a9329ee,aabee13e5d..42a6781358 --- a/t/test-lib-functions.sh +++ b/t/test-lib-functions.sh @@@ -610,14 -610,6 +610,14 @@@ list_contains () # # Writing this as "! git checkout ../outerspace" is wrong, because # the failure could be due to a segv. We want a controlled failure. +# +# Accepts the following options: +# +# ok=[,<...>]: +# Don't treat an exit caused by the given signal as error. +# Multiple signals can be specified as a comma separated list. +# Currently recognized signal names are: sigpipe, success. +# (Don't use 'success', use 'test_might_fail' instead.) test_must_fail () { case "$1" in @@@ -633,22 -625,22 +633,22 @@@ exit_code=$? if test $exit_code -eq 0 && ! list_contains "$_test_ok" success then - echo >&2 "test_must_fail: command succeeded: $*" + echo >&4 "test_must_fail: command succeeded: $*" return 1 elif test_match_signal 13 $exit_code && list_contains "$_test_ok" sigpipe then return 0 elif test $exit_code -gt 129 && test $exit_code -le 192 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 elif test $exit_code -eq 127 then - echo >&2 "test_must_fail: command not found: $*" + echo >&4 "test_must_fail: command not found: $*" return 1 elif test $exit_code -eq 126 then - echo >&2 "test_must_fail: valgrind error: $*" + echo >&4 "test_must_fail: valgrind error: $*" return 1 fi return 0 @@@ -664,8 -656,6 +664,8 @@@ # # Writing "git config --unset all.configuration || :" would be wrong, # because we want to notice if it fails due to segv. +# +# Accepts the same options as test_must_fail. test_might_fail () { test_must_fail ok=success "$@" @@@ -688,7 -678,7 +688,7 @@@ test_expect_code () return 0 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 } @@@ -752,18 -742,18 +752,18 @@@ test_i18ngrep () shift ! grep "$@" && return 0 - echo >&2 "error: '! grep $@' did find a match in:" + echo >&4 "error: '! grep $@' did find a match in:" else grep "$@" && return 0 - echo >&2 "error: 'grep $@' didn't find a match in:" + echo >&4 "error: 'grep $@' didn't find a match in:" fi if test -s "$last_arg" then - cat >&2 "$last_arg" + cat >&4 "$last_arg" else - echo >&2 "" + echo >&4 "" fi return 1 @@@ -774,7 -764,7 +774,7 @@@ # not output anything when they fail. verbose () { "$@" && return 0 - echo >&2 "command failed: $(git rev-parse --sq-quote "$@")" + echo >&4 "command failed: $(git rev-parse --sq-quote "$@")" return 1 }