Mercurial > hg
changeset 19274:6f666780f846
run-tests: introduce threadtmp directory
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Sun, 02 Jun 2013 16:38:15 -0500 |
parents | f3effc499288 |
children | de44cf138761 |
files | tests/run-tests.py |
diffstat | 1 files changed, 10 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/tests/run-tests.py Sun Jun 02 16:29:35 2013 -0500 +++ b/tests/run-tests.py Sun Jun 02 16:38:15 2013 -0500 @@ -362,15 +362,15 @@ hgrc.write('[%s]\n%s\n' % (section, key)) hgrc.close() -def createenv(options, testtmp): +def createenv(options, testtmp, threadtmp): env = os.environ.copy() env['TESTTMP'] = testtmp env['HOME'] = testtmp env["HGPORT"] = str(options.port) env["HGPORT1"] = str(options.port + 1) env["HGPORT2"] = str(options.port + 2) - env["HGRCPATH"] = os.path.join(HGTMP, '.hgrc') - env["DAEMON_PIDS"] = os.path.join(HGTMP, 'daemon.pids') + env["HGRCPATH"] = os.path.join(threadtmp, '.hgrc') + env["DAEMON_PIDS"] = os.path.join(threadtmp, 'daemon.pids') env["HGEDITOR"] = sys.executable + ' -c "import sys; sys.exit(0)"' env["HGMERGE"] = "internal:merge" env["HGUSER"] = "test" @@ -870,7 +870,7 @@ output = re.sub(s, r, output) return ret, output.splitlines(True) -def runone(options, test): +def runone(options, test, count): '''returns a result element: (code, test, msg)''' def skip(msg): @@ -946,7 +946,9 @@ os.remove(err) # Remove any previous output files # Make a tmp subdirectory to work in - testtmp = os.path.join(HGTMP, os.path.basename(test)) + threadtmp = os.path.join(HGTMP, "child%d" % count) + testtmp = os.path.join(threadtmp, os.path.basename(test)) + os.mkdir(threadtmp) os.mkdir(testtmp) replacements = [ @@ -964,7 +966,7 @@ else: replacements.append((re.escape(testtmp), '$TESTTMP')) - env = createenv(options, testtmp) + env = createenv(options, testtmp, threadtmp) createhgrc(env['HGRCPATH'], options) if options.time: @@ -1036,7 +1038,7 @@ iolock.release() if not options.keep_tmpdir: - shutil.rmtree(testtmp, True) + shutil.rmtree(threadtmp, True) return result _hgpath = None @@ -1189,7 +1191,7 @@ def runqueue(options, tests): for test in tests: - code, test, msg = runone(options, test) + code, test, msg = runone(options, test, 0) resultslock.acquire() results[code].append((test, msg)) resultslock.release()