From: Junio C Hamano Date: Wed, 19 Mar 2008 04:58:01 +0000 (-0700) Subject: Test: catch if trash cannot be removed X-Git-Tag: v1.5.5-rc1~22 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=8d14ac945403d6d4b1de9f9fd680247e831c0bfc;p=git.git Test: catch if trash cannot be removed When your test creates an unwritable directory that test framework cannot clean out by "rm -fr trash", later tests cannot start in a fresh state they expect to. Detect this and error out early. Signed-off-by: Junio C Hamano --- diff --git a/t/test-lib.sh b/t/test-lib.sh index 268b26c95..870b255f1 100644 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -396,7 +396,12 @@ fi # Test repository test=trash -rm -fr "$test" +rm -fr "$test" || { + trap - exit + echo >&5 "FATAL: Cannot prepare test area" + exit 1 +} + test_create_repo $test cd "$test"