Skip to content

Commit

Permalink
Test: catch if trash cannot be removed
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Junio C Hamano committed Mar 19, 2008
1 parent 29dc133 commit 8d14ac9
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion t/test-lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down

0 comments on commit 8d14ac9

Please sign in to comment.