From ff30fff38c09dac7c1349fb774c55daa8fd92972 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Fri, 8 Aug 2008 07:59:13 +0200 Subject: [PATCH 1/4] t9700: remove useless check t9700 used to check if the basename of the current directory is 'trash directory', the expensive way. However, there is absolutely no good reason why this test should not run in, say 'life is good' or 'i love tests'. So remove the check altogether. Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- t/t9700/test.pl | 3 --- 1 file changed, 3 deletions(-) diff --git a/t/t9700/test.pl b/t/t9700/test.pl index 4d2312548a..851cea4a4b 100755 --- a/t/t9700/test.pl +++ b/t/t9700/test.pl @@ -14,10 +14,7 @@ use File::Temp; BEGIN { use_ok('Git') } # set up -our $repo_dir = "trash directory"; our $abs_repo_dir = Cwd->cwd; -die "this must be run by calling the t/t97* shell script(s)\n" - if basename(Cwd->cwd) ne $repo_dir; ok(our $r = Git->repository(Directory => "."), "open repository"); # config From e3df89a4b167c2ca0bd2b0a0025fd16c4d3dd651 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Fri, 8 Aug 2008 07:59:18 +0200 Subject: [PATCH 2/4] tests: Clarify dependencies between tests, 'aggregate-results' and 'clean' The Makefile targets 'aggregate-results' and 'clean' pretended to be independent. This is not true, of course, since aggregate-results needs the results _before_ they are removed. Likewise, the tests should have been run already when the results are to be aggregated. However, as it is legitimate to run only a few tests, and then aggregate just those results, so another target is introduced, that depends on all tests, then aggregates the results, and only then removes the results. Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- t/Makefile | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/t/Makefile b/t/Makefile index 0d65cedaa6..aa952e1c5c 100644 --- a/t/Makefile +++ b/t/Makefile @@ -14,7 +14,8 @@ SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH)) T = $(wildcard t[0-9][0-9][0-9][0-9]-*.sh) TSVN = $(wildcard t91[0-9][0-9]-*.sh) -all: pre-clean $(T) aggregate-results clean +all: pre-clean + $(MAKE) aggregate-results-and-cleanup $(T): @echo "*** $@ ***"; GIT_CONFIG=.git/config '$(SHELL_PATH_SQ)' $@ $(GIT_TEST_OPTS) @@ -25,6 +26,10 @@ pre-clean: clean: $(RM) -r 'trash directory' test-results +aggregate-results-and-cleanup: $(T) + $(MAKE) aggregate-results + $(MAKE) clean + aggregate-results: '$(SHELL_PATH_SQ)' ./aggregate-results.sh test-results/t*-* From abc5d372ec242fc654dc6780df6ea3d63dc72f2f Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Fri, 8 Aug 2008 13:08:37 +0200 Subject: [PATCH 3/4] Enable parallel tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On multiprocessor machines, or with I/O heavy tests (that leave the CPU waiting a lot), it makes sense to parallelize the tests. However, care has to be taken that the different jobs use different trash directories. This commit does so, by creating the trash directories with a suffix that is unique with regard to the test, as it is the test's base name. Further, the trash directory is removed in the test itself if everything went fine, so that the trash directories do not pile up only to be removed at the very end. If a test failed, the trash directory is not removed. Chances are that the exact error message is lost in the clutter, but you can still see what test failed from the name of the trash directory, and repeat the test (without -j). If all was good, you will see the aggregated results. Suggestions to simplify this commit came from Junio and René. There still is an issue with tests that want to run a server process and listen to a fixed port (http and svn) --- they cannot run in parallel but this patch does not address this issue. Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- t/Makefile | 1 - t/test-lib.sh | 8 +++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/t/Makefile b/t/Makefile index aa952e1c5c..ed49c20b16 100644 --- a/t/Makefile +++ b/t/Makefile @@ -39,4 +39,3 @@ full-svn-test: $(MAKE) $(TSVN) GIT_SVN_NO_OPTIMIZE_COMMITS=0 LC_ALL=en_US.UTF-8 .PHONY: pre-clean $(T) aggregate-results clean -.NOTPARALLEL: diff --git a/t/test-lib.sh b/t/test-lib.sh index 11c027571b..7f60b614ea 100644 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -449,6 +449,11 @@ test_done () { # we will leave things as they are. say_color pass "passed all $msg" + + test -d "$remove_trash" && + cd "$(dirname "$remove_trash")" && + rm -rf "$(basename "$remove_trash")" + exit 0 ;; *) @@ -485,7 +490,8 @@ fi . ../GIT-BUILD-OPTIONS # Test repository -test="trash directory" +test="trash directory.$(basename "$0" .sh)" +remove_trash="$TEST_DIRECTORY/$test" rm -fr "$test" || { trap - exit echo >&5 "FATAL: Cannot prepare test area" From 54514f1f144a0e79b6c39d4a865927a18c17ed17 Mon Sep 17 00:00:00 2001 From: Marcus Griep Date: Mon, 18 Aug 2008 12:25:40 -0400 Subject: [PATCH 4/4] Update t/.gitignore to ignore all trash directories The current .gitignore only ignores the old "trash directory" and not the new "trash directory.[test]". This ignores both forms. Signed-off-by: Marcus Griep Signed-off-by: Junio C Hamano --- t/.gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/t/.gitignore b/t/.gitignore index b27e280083..7dcbb232cd 100644 --- a/t/.gitignore +++ b/t/.gitignore @@ -1,2 +1,2 @@ -/trash directory +/trash directory* /test-results