git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Aug 21, 2008, 07:49 UTC
Message-ID
<alpine.DEB.1.00.0808210946280.24820@pacific.mpi-cbg.de.mpi-cbg.de>
In-Reply-To
<20080821011811.GA13915@coredump.intra.peff.net>

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@gmx.de>
---
	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
Previous: Junio C HamanoNext: Junio C Hamano
Message 4 of 7 in “What's cooking in git.git (Aug 2008, #06; Wed, 20)”
  1. Junio C HamanoAug 21, 2008
  2. Jeff KingAug 21, 2008
  3. Junio C HamanoAug 21, 2008
  4. test-lib: do not remove trash_directory if called with --debugJohannes Schindelin, Aug 21, 2008
  5. Junio C HamanoAug 21, 2008
  6. Jeff KingAug 21, 2008
  7. Michael J GruberAug 21, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.