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 <gitster@pobox.com>
Junio C Hamano committed
Mar 18, 2008 at 21:58 UTC
8d14ac945403d6d4b1de9f9fd680247e831c0bfc
1 file changed
+6
-1
t/test-lib.sh
+6
-1
@@ -396,7 +396,12 @@ fi
396
397
# Test repository
398
test=trash
399
-rm -fr "$test"
399
+rm -fr "$test" || {
400
+ trap - exit
401
+ echo >&5 "FATAL: Cannot prepare test area"
402
+ exit 1
403
+}
404
+
405
test_create_repo $test
406
cd "$test"
407