From: Junio C Hamano Date: Tue, 16 May 2017 02:51:50 +0000 (+0900) Subject: Merge branch 'dt/gc-ignore-old-gc-logs' X-Git-Tag: v2.14.0-rc0~196 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/a0ab83ebd807f2bfe1a565ff94fe7d3c6903efee?ds=inline;hp=-c Merge branch 'dt/gc-ignore-old-gc-logs' Attempt to allow us notice "fishy" situation where we fail to remove the temporary directory used during the test. * dt/gc-ignore-old-gc-logs: test-lib: retire $remove_trash variable test-lib.sh: do not barf under --debug at the end of the test test-lib: abort when can't remove trash directory --- a0ab83ebd807f2bfe1a565ff94fe7d3c6903efee diff --combined t/test-lib.sh index 13b5696822,51b59c69cb..014136fb06 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@@ -342,7 -342,6 +342,7 @@@ f exec 5>&1 exec 6<&0 +exec 7>&2 if test "$verbose_log" = "t" then exec 3>>"$GIT_TEST_TEE_OUTPUT_FILE" 4>&3 @@@ -625,9 -624,9 +625,9 @@@ test_run_ () trace= # 117 is magic because it is unlikely to match the exit # code of other programs - test_eval_ "(exit 117) && $1" - if test "$?" != 117; then - error "bug in the test script: broken &&-chain: $1" + if test "OK-117" != "$(test_eval_ "(exit 117) && $1${LF}${LF}echo OK-\$?" 3>&1)" + then + error "bug in the test script: broken &&-chain or run-away HERE-DOC: $1" fi trace=$trace_tmp fi @@@ -761,10 -760,15 +761,15 @@@ test_done () say "1..$test_count$skip_all" fi - test -d "$remove_trash" && - cd "$(dirname "$remove_trash")" && - rm -rf "$(basename "$remove_trash")" + if test -z "$debug" + then + test -d "$TRASH_DIRECTORY" || + error "Tests passed but trash directory already removed before test cleanup; aborting" + cd "$TRASH_DIRECTORY/.." && + rm -fr "$TRASH_DIRECTORY" || + error "Tests passed but test cleanup failed; aborting" + fi test_at_end_hook_ exit 0 ;; @@@ -919,7 -923,6 +924,6 @@@ case "$TRASH_DIRECTORY" i /*) ;; # absolute path is good *) TRASH_DIRECTORY="$TEST_OUTPUT_DIRECTORY/$TRASH_DIRECTORY" ;; esac - test ! -z "$debug" || remove_trash=$TRASH_DIRECTORY rm -fr "$TRASH_DIRECTORY" || { GIT_EXIT_OK=t echo >&5 "FATAL: Cannot prepare test area" @@@ -967,8 -970,7 +971,8 @@@ yes () } # Fix some commands on Windows -case $(uname -s) in +uname_s=$(uname -s) +case $uname_s in *MINGW*) # Windows has its own (incompatible) sort and find sort () { @@@ -1143,7 -1145,6 +1147,7 @@@ test_lazy_prereq SANITY return $status ' +test FreeBSD != $uname_s || GIT_UNZIP=${GIT_UNZIP:-/usr/local/bin/unzip} GIT_UNZIP=${GIT_UNZIP:-unzip} test_lazy_prereq UNZIP ' "$GIT_UNZIP" -v