--- a/tests/run-tests.py Sun Jun 02 17:56:51 2013 -0500
+++ b/tests/run-tests.py Sun Jun 02 17:56:53 2013 -0500
@@ -1069,121 +1069,6 @@
' (expected %s)\n'
% (verb, actualhg, expecthg))
-def runchildren(options, tests):
- if INST:
- installhg(options)
- _checkhglib("Testing")
- else:
- usecorrectpython()
-
- optcopy = dict(options.__dict__)
- optcopy['jobs'] = 1
-
- # Because whitelist has to override keyword matches, we have to
- # actually load the whitelist in the children as well, so we allow
- # the list of whitelist files to pass through and be parsed in the
- # children, but not the dict of whitelisted tests resulting from
- # the parse, used here to override blacklisted tests.
- whitelist = optcopy['whitelisted'] or []
- del optcopy['whitelisted']
-
- blacklist = optcopy['blacklist'] or []
- del optcopy['blacklist']
- blacklisted = []
-
- if optcopy['with_hg'] is None:
- optcopy['with_hg'] = os.path.join(BINDIR, "hg")
- optcopy.pop('anycoverage', None)
-
- opts = []
- for opt, value in optcopy.iteritems():
- name = '--' + opt.replace('_', '-')
- if value is True:
- opts.append(name)
- elif isinstance(value, list):
- for v in value:
- opts.append(name + '=' + str(v))
- elif value is not None:
- opts.append(name + '=' + str(value))
-
- tests.reverse()
- jobs = [[] for j in xrange(options.jobs)]
- while tests:
- for job in jobs:
- if not tests:
- break
- test = tests.pop()
- if test not in whitelist and test in blacklist:
- blacklisted.append(test)
- else:
- job.append(test)
-
- waitq = queue.Queue()
-
- # windows lacks os.wait, so we must emulate it
- def waitfor(proc, rfd):
- fp = os.fdopen(rfd, 'rb')
- return lambda: waitq.put((proc.pid, proc.wait(), fp))
-
- for j, job in enumerate(jobs):
- if not job:
- continue
- rfd, wfd = os.pipe()
- childopts = ['--child=%d' % wfd, '--port=%d' % (options.port + j * 3)]
- childtmp = os.path.join(HGTMP, 'child%d' % j)
- childopts += ['--tmpdir', childtmp]
- if options.keep_tmpdir:
- childopts.append('--keep-tmpdir')
- cmdline = [PYTHON, sys.argv[0]] + opts + childopts + job
- vlog(' '.join(cmdline))
- proc = subprocess.Popen(cmdline, executable=cmdline[0])
- threading.Thread(target=waitfor(proc, rfd)).start()
- os.close(wfd)
- signal.signal(signal.SIGINT, signal.SIG_IGN)
- failures = 0
- passed, skipped, failed = 0, 0, 0
- skips = []
- fails = []
- for job in jobs:
- if not job:
- continue
- pid, status, fp = waitq.get()
- try:
- childresults = pickle.load(fp)
- except (pickle.UnpicklingError, EOFError):
- sys.exit(255)
- else:
- passed += len(childresults['.'])
- skipped += len(childresults['s'])
- failed += len(childresults['!'])
- skips.extend(childresults['s'])
- fails.extend(childresults['!'])
- if options.time:
- childtimes = pickle.load(fp)
- times.extend(childtimes)
-
- vlog('pid %d exited, status %d' % (pid, status))
- failures |= status
- print
- skipped += len(blacklisted)
- if not options.noskips:
- for s in skips:
- print "Skipped %s: %s" % (s[0], s[1])
- for s in blacklisted:
- print "Skipped %s: blacklisted" % s
- for s in fails:
- print "Failed %s: %s" % (s[0], s[1])
-
- _checkhglib("Tested")
- print "# Ran %d tests, %d skipped, %d failed." % (
- passed + failed, skipped, failed)
-
- if options.time:
- outputtimes(options)
- if options.anycoverage:
- outputcoverage(options)
- sys.exit(failures != 0)
-
results = {'.':[], '!':[], 's':[], 'i':[]}
resultslock = threading.Lock()
times = []