Commit feb69ae7 by Felix Duvallet Committed by Dominic Hamon

Ensure all the necessary keys are present before parsing JSON data (#380)

This prevents errors when additional non-timing data are present in the JSON that is loaded, for example when complexity data has been computed (see #379).
parent 3336ea00
...@@ -80,7 +80,9 @@ def generate_difference_report(json1, json2, use_color=True): ...@@ -80,7 +80,9 @@ def generate_difference_report(json1, json2, use_color=True):
first_line = "{:<{}s} Time CPU Old New".format( first_line = "{:<{}s} Time CPU Old New".format(
'Benchmark', first_col_width) 'Benchmark', first_col_width)
output_strs = [first_line, '-' * len(first_line)] output_strs = [first_line, '-' * len(first_line)]
for bn in json1['benchmarks']:
gen = (bn for bn in json1['benchmarks'] if 'real_time' in bn and 'cpu_time' in bn)
for bn in gen:
other_bench = find_test(bn['name']) other_bench = find_test(bn['name'])
if not other_bench: if not other_bench:
continue continue
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment