Skip to content

Commit 8d14ac9

Browse files
committed
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>
1 parent 29dc133 commit 8d14ac9

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

t/test-lib.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,12 @@ fi
396396

397397
# Test repository
398398
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+
400405
test_create_repo $test
401406
cd "$test"
402407

0 commit comments

Comments
 (0)