diff options
Diffstat (limited to 't/test-lib.sh')
| -rw-r--r-- | t/test-lib.sh | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/t/test-lib.sh b/t/test-lib.sh index 62136caee5..876b99562a 100644 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -13,7 +13,7 @@ # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program. If not, see http://www.gnu.org/licenses/ . +# along with this program. If not, see https://www.gnu.org/licenses/ . # Test the binaries we have just built. The tests are kept in # t/ subdirectory and are run in 'trash directory' subdirectory. @@ -89,6 +89,9 @@ prepend_var LSAN_OPTIONS : $GIT_SAN_OPTIONS prepend_var LSAN_OPTIONS : fast_unwind_on_malloc=0 export LSAN_OPTIONS +prepend_var UBSAN_OPTIONS : $GIT_SAN_OPTIONS +export UBSAN_OPTIONS + if test ! -f "$GIT_BUILD_DIR"/GIT-BUILD-OPTIONS then echo >&2 'error: GIT-BUILD-OPTIONS missing (has Git been built?).' @@ -334,6 +337,7 @@ nr_san_dir_leaks_ () { find "$TEST_RESULTS_SAN_DIR" \ -type f \ -name "$TEST_RESULTS_SAN_FILE_PFX.*" 2>/dev/null | + xargs grep -lv "Unable to get registers from thread" | wc -l } @@ -1041,10 +1045,7 @@ want_trace () { # (and we want to make sure we run any cleanup like # "set +x"). test_eval_inner_ () { - # Do not add anything extra (including LF) after '$*' - eval " - want_trace && trace_level_=$(($trace_level_+1)) && set -x - $*" + eval "$*" } test_eval_ () { @@ -1069,7 +1070,10 @@ test_eval_ () { # be _inside_ the block to avoid polluting the "set -x" output # - test_eval_inner_ "$@" </dev/null >&3 2>&4 + # Do not add anything extra (including LF) after '$*' + test_eval_inner_ </dev/null >&3 2>&4 " + want_trace && trace_level_=$(($trace_level_+1)) && set -x + $*" { test_eval_ret_=$? if want_trace @@ -1086,22 +1090,22 @@ test_eval_ () { return $test_eval_ret_ } +fail_117 () { + return 117 +} + test_run_ () { test_cleanup=: expecting_failure=$2 if test "${GIT_TEST_CHAIN_LINT:-1}" != 0; then - # turn off tracing for this test-eval, as it simply creates - # confusing noise in the "-x" output - trace_tmp=$trace - trace= # 117 is magic because it is unlikely to match the exit # code of other programs - if test "OK-117" != "$(test_eval_ "(exit 117) && $1${LF}${LF}echo OK-\$?" 3>&1)" + test_eval_inner_ "fail_117 && $1" </dev/null >&3 2>&4 + if test $? != 117 then - BUG "broken &&-chain or run-away HERE-DOC: $1" + BUG "broken &&-chain: $1" fi - trace=$trace_tmp fi setup_malloc_check @@ -1593,7 +1597,8 @@ then BAIL_OUT_ENV_NEEDS_SANITIZE_LEAK "GIT_TEST_SANITIZE_LEAK_LOG=true" fi -if test "${GIT_TEST_CHAIN_LINT:-1}" != 0 +if test "${GIT_TEST_CHAIN_LINT:-1}" != 0 && + test "${GIT_TEST_EXT_CHAIN_LINT:-1}" != 0 then "$PERL_PATH" "$TEST_DIRECTORY/chainlint.pl" "$0" || BUG "lint error (see '?!...!? annotations above)" |
