#8560: add progress indicator to regrtest.
This commit is contained in:
parent
6fcac0d6f6
commit
dee7b8503d
|
@ -390,7 +390,7 @@ def main(tests=None, testdir=None, verbose=0, quiet=False,
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
else:
|
else:
|
||||||
print(("No handler for option {}. Please report this as a bug "
|
print(("No handler for option {}. Please report this as a bug "
|
||||||
"at http://bugs.python.org.").format(o), file=sys.stderr)
|
"at http://bugs.python.org.").format(o), file=sys.stderr)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
if single and fromfile:
|
if single and fromfile:
|
||||||
usage("-s and -f don't go together!")
|
usage("-s and -f don't go together!")
|
||||||
|
@ -517,6 +517,9 @@ def main(tests=None, testdir=None, verbose=0, quiet=False,
|
||||||
else:
|
else:
|
||||||
tests = iter(selected)
|
tests = iter(selected)
|
||||||
|
|
||||||
|
tests = list(tests)
|
||||||
|
test_count = len(tests)
|
||||||
|
test_count_width = len(str(test_count))
|
||||||
if use_mp:
|
if use_mp:
|
||||||
try:
|
try:
|
||||||
from threading import Thread
|
from threading import Thread
|
||||||
|
@ -559,8 +562,6 @@ def main(tests=None, testdir=None, verbose=0, quiet=False,
|
||||||
output.put((None, None, None, None))
|
output.put((None, None, None, None))
|
||||||
return
|
return
|
||||||
result = json.loads(result)
|
result = json.loads(result)
|
||||||
if not quiet:
|
|
||||||
stdout = test+'\n'+stdout
|
|
||||||
output.put((test, stdout.rstrip(), stderr.rstrip(), result))
|
output.put((test, stdout.rstrip(), stderr.rstrip(), result))
|
||||||
except BaseException:
|
except BaseException:
|
||||||
output.put((None, None, None, None))
|
output.put((None, None, None, None))
|
||||||
|
@ -569,12 +570,16 @@ def main(tests=None, testdir=None, verbose=0, quiet=False,
|
||||||
for worker in workers:
|
for worker in workers:
|
||||||
worker.start()
|
worker.start()
|
||||||
finished = 0
|
finished = 0
|
||||||
|
test_index = 1
|
||||||
try:
|
try:
|
||||||
while finished < use_mp:
|
while finished < use_mp:
|
||||||
test, stdout, stderr, result = output.get()
|
test, stdout, stderr, result = output.get()
|
||||||
if test is None:
|
if test is None:
|
||||||
finished += 1
|
finished += 1
|
||||||
continue
|
continue
|
||||||
|
if not quiet:
|
||||||
|
print("[{1:{0}}/{2:{0}}] {3}".format(
|
||||||
|
test_count_width, test_index, test_count, test))
|
||||||
if stdout:
|
if stdout:
|
||||||
print(stdout)
|
print(stdout)
|
||||||
if stderr:
|
if stderr:
|
||||||
|
@ -583,15 +588,17 @@ def main(tests=None, testdir=None, verbose=0, quiet=False,
|
||||||
assert result[1] == 'KeyboardInterrupt'
|
assert result[1] == 'KeyboardInterrupt'
|
||||||
raise KeyboardInterrupt # What else?
|
raise KeyboardInterrupt # What else?
|
||||||
accumulate_result(test, result)
|
accumulate_result(test, result)
|
||||||
|
test_index += 1
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
interrupted = True
|
interrupted = True
|
||||||
pending.close()
|
pending.close()
|
||||||
for worker in workers:
|
for worker in workers:
|
||||||
worker.join()
|
worker.join()
|
||||||
else:
|
else:
|
||||||
for test in tests:
|
for test_index, test in enumerate(tests, 1):
|
||||||
if not quiet:
|
if not quiet:
|
||||||
print(test)
|
print("[{1:{0}}/{2:{0}}] {3}".format(
|
||||||
|
test_count_width, test_index, test_count, test))
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
if trace:
|
if trace:
|
||||||
# If we're tracing code coverage, then we don't exit with status
|
# If we're tracing code coverage, then we don't exit with status
|
||||||
|
|
Loading…
Reference in New Issue