summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2017-05-16 11:51:50 +0900
committerJunio C Hamano <gitster@pobox.com>2017-05-16 11:51:51 +0900
commita0ab83ebd807f2bfe1a565ff94fe7d3c6903efee (patch)
tree5163624ae11c0d65177301bb16fc1a63264b2382
parentf767178a5ada848867a7378053897bdfbac32590 (diff)
parent06478dab4c9fb57dc6b7299eafd18df1bea9ca22 (diff)
downloadgit-a0ab83ebd807f2bfe1a565ff94fe7d3c6903efee.tar.gz
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
-rw-r--r--t/test-lib.sh12
1 files changed, 8 insertions, 4 deletions
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 13b5696822..014136fb06 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -761,10 +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 +924,6 @@ case "$TRASH_DIRECTORY" in
/*) ;; # 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"