Skip to content

Commit abc5d37

Browse files
dschogitster
authored andcommitted
Enable parallel tests
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 <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent e3df89a commit abc5d37

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

t/Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,3 @@ full-svn-test:
3939
$(MAKE) $(TSVN) GIT_SVN_NO_OPTIMIZE_COMMITS=0 LC_ALL=en_US.UTF-8
4040

4141
.PHONY: pre-clean $(T) aggregate-results clean
42-
.NOTPARALLEL:

t/test-lib.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,11 @@ test_done () {
449449
# we will leave things as they are.
450450

451451
say_color pass "passed all $msg"
452+
453+
test -d "$remove_trash" &&
454+
cd "$(dirname "$remove_trash")" &&
455+
rm -rf "$(basename "$remove_trash")"
456+
452457
exit 0 ;;
453458

454459
*)
@@ -485,7 +490,8 @@ fi
485490
. ../GIT-BUILD-OPTIONS
486491

487492
# Test repository
488-
test="trash directory"
493+
test="trash directory.$(basename "$0" .sh)"
494+
remove_trash="$TEST_DIRECTORY/$test"
489495
rm -fr "$test" || {
490496
trap - exit
491497
echo >&5 "FATAL: Cannot prepare test area"

0 commit comments

Comments
 (0)