git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Test: catch if trash cannot be removed
@ 2008-03-19  4:58 Junio C Hamano
  0 siblings, 0 replies; only message in thread
From: Junio C Hamano @ 2008-03-19  4:58 UTC (permalink / raw)
  To: git

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>
---
 t/test-lib.sh |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/t/test-lib.sh b/t/test-lib.sh
index 268b26c..870b255 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"
 
-- 
1.5.5.rc0.122.g8e28f

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2008-03-19 19:43 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-19  4:58 [PATCH] Test: catch if trash cannot be removed Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).