[PATCH] run-tests: in parallel mode, give each child its own tmp dir

Greg Ward greg-hg at gerg.ca
Wed Nov 18 21:25:12 CST 2009


# HG changeset patch
# User Greg Ward <greg at gerg.ca>
# Date 1258600991 18000
# Branch stable
# Node ID 4e47da9b7e9f322980b0d7623805dda74958962d
# Parent  7bb004fc14ecadc355cf5a65b9b055ffe7ef0f92
run-tests: in parallel mode, give each child its own tmp dir.

Fixes bug introduced by f8b4df4b033d (issue1911: --tmpdir plus parallel
mode = fail), and also fixes the long-standing quirk that parallel mode
created multiple /tmp/hgtests.XXXXXX directories.  Now there is only one
/tmp/hgtests.XXXXXX, with child0, child1, etc. under it.

diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -31,8 +31,10 @@
 #      ./run-tests.py -j2 --local test-s*
 #  7) parallel, coverage, temp install:
 #      ./run-tests.py -j2 -c test-s*          # currently broken
-#  8) parallel, coverage, local install
+#  8) parallel, coverage, local install:
 #      ./run-tests.py -j2 -c --local test-s*  # unsupported (and broken)
+#  9) parallel, custom tmp dir:
+#      ./run-tests.py -j2 --tmpdir /tmp/myhgtests
 #
 # (You could use any subset of the tests: test-s* happens to match
 # enough that it's worth doing parallel runs, few enough that it
@@ -639,6 +641,8 @@
             continue
         rfd, wfd = os.pipe()
         childopts = ['--child=%d' % wfd, '--port=%d' % (options.port + j * 3)]
+        childtmp = os.path.join(HGTMP, 'child%d' % j)
+        childopts += ['--tmpdir', childtmp]
         cmdline = [PYTHON, sys.argv[0]] + opts + childopts + job
         vlog(' '.join(cmdline))
         fps[os.spawnvp(os.P_NOWAIT, cmdline[0], cmdline)] = os.fdopen(rfd, 'r')


More information about the Mercurial-devel mailing list