Add total runtime to summary output

This commit adds the total runtime in secs to the summary view from
subunit-trace.py

Change-Id: If56f2a048b3d1ab3d51425d5b3560e1f365a6c3a
This commit is contained in:
Matthew Treinish 2014-06-12 17:35:10 -04:00
parent 2c75b7cb83
commit 53eef72128
1 changed files with 10 additions and 1 deletions

View File

@ -221,6 +221,14 @@ def count_tests(key, value):
return count
def run_time():
runtime = 0.0
for k, v in RESULTS.items():
for test in v:
runtime += float(get_duration(test['timestamps']).strip('s'))
return runtime
def worker_stats(worker):
tests = RESULTS[worker]
num_tests = len(tests)
@ -230,7 +238,8 @@ def worker_stats(worker):
def print_summary(stream):
stream.write("\n======\nTotals\n======\n")
stream.write("Run: %s\n" % count_tests('status', '.*'))
stream.write("Run: %s in %s sec.\n" % (count_tests('status', '.*'),
run_time()))
stream.write(" - Passed: %s\n" % count_tests('status', 'success'))
stream.write(" - Skipped: %s\n" % count_tests('status', 'skip'))
stream.write(" - Failed: %s\n" % count_tests('status', 'fail'))