Add remaining count to run_tests

reviewable/pr4232/r4
Craig Tiller 9 years ago
parent 27e5aa47a7
commit 6364dcbfeb
  1. 31
      tools/run_tests/jobset.py

@ -302,9 +302,13 @@ class Jobset(object):
self._hashes = {}
self._add_env = add_env
self.resultset = {}
self._remaining = None
def set_remaining(self, remaining):
self._remaining = remaining
def get_num_failures(self):
return self._failures
return self._failures
def start(self, spec):
"""Start a job. Return True on success, False on failure."""
@ -357,8 +361,9 @@ class Jobset(object):
self._running.remove(job)
if dead: return
if (not self._travis):
message('WAITING', '%d jobs running, %d complete, %d failed' % (
len(self._running), self._completed, self._failures))
rstr = '' if self._remaining is None else ', %d remaining' % self._remaining
message('WAITING', '%d jobs running, %d complete, %d failed%s' % (
len(self._running), self._completed, self._failures, rstr))
if platform.system() == 'Windows':
time.sleep(0.1)
else:
@ -397,6 +402,17 @@ class NoCache(object):
pass
def tag_remaining(xs):
staging = []
for x in xs:
staging.append(x)
if len(staging) > 1000:
yield (staging.pop(0), None)
n = len(staging)
for i, x in enumerate(staging):
yield (x, n - i - 1)
def run(cmdlines,
check_cancelled=_never_cancelled,
maxjobs=None,
@ -410,8 +426,11 @@ def run(cmdlines,
maxjobs if maxjobs is not None else _DEFAULT_MAX_JOBS,
newline_on_success, travis, stop_on_failure, add_env,
cache if cache is not None else NoCache())
for cmdline in cmdlines:
for cmdline, remaining in tag_remaining(cmdlines):
if not js.start(cmdline):
break
js.finish()
if remaining is not None:
js.set_remaining(remaining)
js.finish()
return js.get_num_failures(), js.resultset

Loading…
Cancel
Save