##// END OF EJS Templates
run-tests: support running tests in parallel on windows...
Bryan O'Sullivan -
r18057:6b88ded2 default
parent child Browse files
Show More
@@ -56,6 +56,7 b' import re'
56 56 import threading
57 57 import killdaemons as killmod
58 58 import cPickle as pickle
59 import Queue as queue
59 60
60 61 processlock = threading.Lock()
61 62
@@ -1079,7 +1080,13 b' def runchildren(options, tests):'
1079 1080 blacklisted.append(test)
1080 1081 else:
1081 1082 job.append(test)
1082 fps = {}
1083
1084 waitq = queue.Queue()
1085
1086 # windows lacks os.wait, so we must emulate it
1087 def waitfor(proc, rfd):
1088 fp = os.fdopen(rfd, 'rb')
1089 return lambda: waitq.put((proc.pid, proc.wait(), fp))
1083 1090
1084 1091 for j, job in enumerate(jobs):
1085 1092 if not job:
@@ -1090,16 +1097,18 b' def runchildren(options, tests):'
1090 1097 childopts += ['--tmpdir', childtmp]
1091 1098 cmdline = [PYTHON, sys.argv[0]] + opts + childopts + job
1092 1099 vlog(' '.join(cmdline))
1093 fps[os.spawnvp(os.P_NOWAIT, cmdline[0], cmdline)] = os.fdopen(rfd, 'rb')
1100 proc = subprocess.Popen(cmdline, executable=cmdline[0])
1101 threading.Thread(target=waitfor(proc, rfd)).start()
1094 1102 os.close(wfd)
1095 1103 signal.signal(signal.SIGINT, signal.SIG_IGN)
1096 1104 failures = 0
1097 1105 passed, skipped, failed = 0, 0, 0
1098 1106 skips = []
1099 1107 fails = []
1100 while fps:
1101 pid, status = os.wait()
1102 fp = fps.pop(pid)
1108 for job in jobs:
1109 if not job:
1110 continue
1111 pid, status, fp = waitq.get()
1103 1112 try:
1104 1113 childresults = pickle.load(fp)
1105 1114 except pickle.UnpicklingError:
General Comments 0
You need to be logged in to leave comments. Login now