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