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

[PATCH 3/3 v2] Enable parallel tests

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Aug 8, 2008, 11:08 UTC
Message-ID
<alpine.DEB.1.00.0808081302180.9611@pacific.mpi-cbg.de.mpi-cbg.de>
In-Reply-To
<alpine.DEB.1.00.0808081236010.9611@pacific.mpi-cbg.de.mpi-cbg.de>

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é.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
	> On Fri, 8 Aug 2008, René Scharfe wrote:
	> 
	> > The implementation would be a bit simpler (no -j detection 
	> > needed) and the documentation would be simpler, too.
	Oh well, here it goes.
 t/Makefile    |    1 -
 t/test-lib.sh |    8 +++++++-
 2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/t/Makefile b/t/Makefile
index aa952e1..ed49c20 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 11c0275..75c8a36 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 ! -z "$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="$(pwd)/$test"
 rm -fr "$test" || {
 	trap - exit
 	echo >&5 "FATAL: Cannot prepare test area"
-- 
1.6.0.rc2.23.gd08e9
Previous: Johannes SchindelinNext: Stephan Beyer
Message 18 of 26 in “Enable parallelized tests”
  1. 0/3 Enable parallelized testsJohannes Schindelin, Aug 8, 2008
  2. 1/3 t9700: remove useless checkJohannes Schindelin, Aug 8, 2008
  3. 2/3 tests: Clarify dependencies between tests, 'aggregate-results' and 'clean'Johannes Schindelin, Aug 8, 2008
  4. 3/3 Enable parallel testsJohannes Schindelin, Aug 8, 2008
  5. Junio C HamanoAug 8, 2008
  6. Johannes SchindelinAug 8, 2008
  7. Junio C HamanoAug 8, 2008
  8. René ScharfeAug 8, 2008
  9. Junio C HamanoAug 8, 2008
  10. tests: use $TEST_DIRECTORY to refer to the t/ directoryJunio C Hamano, Aug 8, 2008
  11. Johannes SchindelinAug 8, 2008
  12. Junio C HamanoAug 8, 2008
  13. Stephan BeyerAug 8, 2008
  14. Olivier MarinAug 9, 2008
  15. Junio C HamanoAug 9, 2008
  16. Junio C HamanoAug 10, 2008
  17. Johannes SchindelinAug 8, 2008
  18. 3/3 Enable parallel testsJohannes Schindelin, Aug 8, 2008
  19. Stephan BeyerAug 8, 2008
  20. Johannes SchindelinAug 8, 2008
  21. SZEDER GáborAug 8, 2008
  22. Stephan BeyerAug 8, 2008
  23. Johannes SchindelinAug 8, 2008
  24. Stephan BeyerAug 8, 2008
  25. Johannes SchindelinAug 8, 2008
  26. Stephan BeyerAug 8, 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.