comparison tests/run-tests.py @ 9890:4f1ee228e577

run-tests: give each child its own tmp dir (issue1911) 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.
author Greg Ward <greg@gerg.ca>
date Wed, 18 Nov 2009 22:23:11 -0500
parents 0a8a43b4ca75
children bf9d117d0010
comparison
equal deleted inserted replaced
9889:38864218c4cc 9890:4f1ee228e577
29 # ./run-tests.py -j2 test-s* 29 # ./run-tests.py -j2 test-s*
30 # 6) parallel, no coverage, local hg: 30 # 6) parallel, no coverage, local hg:
31 # ./run-tests.py -j2 --local test-s* 31 # ./run-tests.py -j2 --local test-s*
32 # 7) parallel, coverage, temp install: 32 # 7) parallel, coverage, temp install:
33 # ./run-tests.py -j2 -c test-s* # currently broken 33 # ./run-tests.py -j2 -c test-s* # currently broken
34 # 8) parallel, coverage, local install 34 # 8) parallel, coverage, local install:
35 # ./run-tests.py -j2 -c --local test-s* # unsupported (and broken) 35 # ./run-tests.py -j2 -c --local test-s* # unsupported (and broken)
36 # 9) parallel, custom tmp dir:
37 # ./run-tests.py -j2 --tmpdir /tmp/myhgtests
36 # 38 #
37 # (You could use any subset of the tests: test-s* happens to match 39 # (You could use any subset of the tests: test-s* happens to match
38 # enough that it's worth doing parallel runs, few enough that it 40 # enough that it's worth doing parallel runs, few enough that it
39 # completes fairly quickly, includes both shell and Python scripts, and 41 # completes fairly quickly, includes both shell and Python scripts, and
40 # includes some scripts that run daemon processes.) 42 # includes some scripts that run daemon processes.)
637 for j, job in enumerate(jobs): 639 for j, job in enumerate(jobs):
638 if not job: 640 if not job:
639 continue 641 continue
640 rfd, wfd = os.pipe() 642 rfd, wfd = os.pipe()
641 childopts = ['--child=%d' % wfd, '--port=%d' % (options.port + j * 3)] 643 childopts = ['--child=%d' % wfd, '--port=%d' % (options.port + j * 3)]
644 childtmp = os.path.join(HGTMP, 'child%d' % j)
645 childopts += ['--tmpdir', childtmp]
642 cmdline = [PYTHON, sys.argv[0]] + opts + childopts + job 646 cmdline = [PYTHON, sys.argv[0]] + opts + childopts + job
643 vlog(' '.join(cmdline)) 647 vlog(' '.join(cmdline))
644 fps[os.spawnvp(os.P_NOWAIT, cmdline[0], cmdline)] = os.fdopen(rfd, 'r') 648 fps[os.spawnvp(os.P_NOWAIT, cmdline[0], cmdline)] = os.fdopen(rfd, 'r')
645 os.close(wfd) 649 os.close(wfd)
646 failures = 0 650 failures = 0