@matheusbsbs / matheus-bagliano / commits / abc5d372ec
Fork 0

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>

Johannes Schindelin committed Aug 8, 2008 at 13:08 UTC abc5d372ec242fc654dc6780df6ea3d63dc72f2f
2 files changed +7 -2
t/Makefile
-1
@@ -39,4 +39,3 @@ full-svn-test:
39 $(MAKE) $(TSVN) GIT_SVN_NO_OPTIMIZE_COMMITS=0 LC_ALL=en_US.UTF-8
40
41 .PHONY: pre-clean $(T) aggregate-results clean
42 -.NOTPARALLEL:
t/test-lib.sh
+7 -1
@@ -449,6 +449,11 @@ test_done () {
449 # we will leave things as they are.
450
451 say_color pass "passed all $msg"
452 +
453 + test -d "$remove_trash" &&
454 + cd "$(dirname "$remove_trash")" &&
455 + rm -rf "$(basename "$remove_trash")"
456 +
457 exit 0 ;;
458
459 *)
@@ -485,7 +490,8 @@ fi
490 . ../GIT-BUILD-OPTIONS
491
492 # Test repository
488 -test="trash directory"
493 +test="trash directory.$(basename "$0" .sh)"
494 +remove_trash="$TEST_DIRECTORY/$test"
495 rm -fr "$test" || {
496 trap - exit
497 echo >&5 "FATAL: Cannot prepare test area"