##// END OF EJS Templates
run-tests: introduce threadtmp directory
Matt Mackall -
r19274:6f666780 default
parent child Browse files
Show More
@@ -362,15 +362,15 b' def createhgrc(path, options):'
362 362 hgrc.write('[%s]\n%s\n' % (section, key))
363 363 hgrc.close()
364 364
365 def createenv(options, testtmp):
365 def createenv(options, testtmp, threadtmp):
366 366 env = os.environ.copy()
367 367 env['TESTTMP'] = testtmp
368 368 env['HOME'] = testtmp
369 369 env["HGPORT"] = str(options.port)
370 370 env["HGPORT1"] = str(options.port + 1)
371 371 env["HGPORT2"] = str(options.port + 2)
372 env["HGRCPATH"] = os.path.join(HGTMP, '.hgrc')
373 env["DAEMON_PIDS"] = os.path.join(HGTMP, 'daemon.pids')
372 env["HGRCPATH"] = os.path.join(threadtmp, '.hgrc')
373 env["DAEMON_PIDS"] = os.path.join(threadtmp, 'daemon.pids')
374 374 env["HGEDITOR"] = sys.executable + ' -c "import sys; sys.exit(0)"'
375 375 env["HGMERGE"] = "internal:merge"
376 376 env["HGUSER"] = "test"
@@ -870,7 +870,7 b' def run(cmd, wd, options, replacements, '
870 870 output = re.sub(s, r, output)
871 871 return ret, output.splitlines(True)
872 872
873 def runone(options, test):
873 def runone(options, test, count):
874 874 '''returns a result element: (code, test, msg)'''
875 875
876 876 def skip(msg):
@@ -946,7 +946,9 b' def runone(options, test):'
946 946 os.remove(err) # Remove any previous output files
947 947
948 948 # Make a tmp subdirectory to work in
949 testtmp = os.path.join(HGTMP, os.path.basename(test))
949 threadtmp = os.path.join(HGTMP, "child%d" % count)
950 testtmp = os.path.join(threadtmp, os.path.basename(test))
951 os.mkdir(threadtmp)
950 952 os.mkdir(testtmp)
951 953
952 954 replacements = [
@@ -964,7 +966,7 b' def runone(options, test):'
964 966 else:
965 967 replacements.append((re.escape(testtmp), '$TESTTMP'))
966 968
967 env = createenv(options, testtmp)
969 env = createenv(options, testtmp, threadtmp)
968 970 createhgrc(env['HGRCPATH'], options)
969 971
970 972 if options.time:
@@ -1036,7 +1038,7 b' def runone(options, test):'
1036 1038 iolock.release()
1037 1039
1038 1040 if not options.keep_tmpdir:
1039 shutil.rmtree(testtmp, True)
1041 shutil.rmtree(threadtmp, True)
1040 1042 return result
1041 1043
1042 1044 _hgpath = None
@@ -1189,7 +1191,7 b' abort = False'
1189 1191
1190 1192 def runqueue(options, tests):
1191 1193 for test in tests:
1192 code, test, msg = runone(options, test)
1194 code, test, msg = runone(options, test, 0)
1193 1195 resultslock.acquire()
1194 1196 results[code].append((test, msg))
1195 1197 resultslock.release()
General Comments 0
You need to be logged in to leave comments. Login now