[PATCH] test-lib: do not remove trash_directory if called with --debug

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Sometimes you want to keep the trash directory, even if all tests
passed.  For example, when extending tests, it comes it quite handy.

Signed-off-by: Johannes Schindelin <johannes.schindelin@xxxxxx>
---

	On Wed, 20 Aug 2008, Jeff King wrote:

	> On Wed, Aug 20, 2008 at 05:30:16PM -0700, Junio C Hamano wrote:
	> 
	> > * js/parallel-test (Mon Aug 18 12:25:40 2008 -0400) 4 commits
	> >  + Update t/.gitignore to ignore all trash directories
	> >  + Enable parallel tests
	> >  + tests: Clarify dependencies between tests, 'aggregate-results' and
	> >    'clean'
	> >  + t9700: remove useless check
	> 
	> I really liked this the first time I ran "make -j4 test". 
	> However, it now cleans up the trash directory automagically after a 
	> successful run. This bit me today when I added a test that should
	> have failed but accidentally passed. I wanted to look at the 
	> output, but it was gone.
	> 
	> Probably it's not worth worrying about, since that is certainly 
	> the less common case, and I can work around it by editing the passing 
	> test script to provoke failure. And I can't think of a more sane 
	> behavior. But I wanted to register my slight "this new thing annoyed 
	> me" feeling.

	My original patch tried to be clever and _not_ do the automagical 
	cleanup when run without -j.

	However, this was not liked.

	So I have this in my personal git fork.  Maybe it is good enough 
	for you?

	(Usage: run sh t0000-bla.sh -i -v -d)

 t/test-lib.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/t/test-lib.sh b/t/test-lib.sh
index 6212c46..e2b106c 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -491,7 +491,7 @@ fi
 
 # Test repository
 test="trash directory.$(basename "$0" .sh)"
-remove_trash="$TEST_DIRECTORY/$test"
+test ! -z "$debug" || remove_trash="$TEST_DIRECTORY/$test"
 rm -fr "$test" || {
 	trap - exit
 	echo >&5 "FATAL: Cannot prepare test area"
-- 
1.6.0.172.g459f5

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux