Handle incomplete subunit streams
If a subunit stream is aborted in the middle (like in the case of a segfault) this causes subunit-trace to emit a stacktrace. This commit attempts to handle this edge case gracefully. Related-Bug: #1482230 Change-Id: I1a8a0a8e2ab65e637c6a5212e324670b7d95d28d
This commit is contained in:
parent
fdb57bdacd
commit
2ea7c8837b
@ -239,8 +239,13 @@ def run_time():
|
|||||||
def worker_stats(worker):
|
def worker_stats(worker):
|
||||||
tests = RESULTS[worker]
|
tests = RESULTS[worker]
|
||||||
num_tests = len(tests)
|
num_tests = len(tests)
|
||||||
delta = tests[-1]['timestamps'][1] - tests[0]['timestamps'][0]
|
stop_time = tests[-1]['timestamps'][1]
|
||||||
return num_tests, delta
|
start_time = tests[0]['timestamps'][0]
|
||||||
|
if not start_time or not stop_time:
|
||||||
|
delta = 'N/A'
|
||||||
|
else:
|
||||||
|
delta = stop_time - start_time
|
||||||
|
return num_tests, str(delta)
|
||||||
|
|
||||||
|
|
||||||
def print_summary(stream, elapsed_time):
|
def print_summary(stream, elapsed_time):
|
||||||
@ -266,8 +271,11 @@ def print_summary(stream, elapsed_time):
|
|||||||
"Race in testr accounting.\n" % w)
|
"Race in testr accounting.\n" % w)
|
||||||
else:
|
else:
|
||||||
num, time = worker_stats(w)
|
num, time = worker_stats(w)
|
||||||
stream.write(" - Worker %s (%s tests) => %ss\n" %
|
out_str = " - Worker %s (%s tests) => %s" % (w, num, time)
|
||||||
(w, num, time))
|
if time.isdigit():
|
||||||
|
out_str += 's'
|
||||||
|
out_str += '\n'
|
||||||
|
stream.write(out_str)
|
||||||
|
|
||||||
|
|
||||||
def parse_args():
|
def parse_args():
|
||||||
|
Loading…
x
Reference in New Issue
Block a user