[tools] Don't forget to print UTest when printing aggregates only

This probably regressed in #1042.
This commit is contained in:
Roman Lebedev 2021-04-24 13:36:38 +03:00
parent c05843a9f6
commit 362c2ab9c6
No known key found for this signature in database
GPG Key ID: 083C3EBB4A1689E0
1 changed files with 63 additions and 20 deletions

View File

@ -301,11 +301,8 @@ def print_difference_report(
fmt_str = "{}{:<{}s}{endc}{}{:+16.4f}{endc}{}{:+16.4f}{endc}{:14.0f}{:14.0f}{endc}{:14.0f}{:14.0f}" fmt_str = "{}{:<{}s}{endc}{}{:+16.4f}{endc}{}{:+16.4f}{endc}{:14.0f}{:14.0f}{endc}{:14.0f}{:14.0f}"
for benchmark in json_diff_report: for benchmark in json_diff_report:
# *If* we were asked to only include aggregates, # *If* we were asked to only include aggregates,
# and if it is non-aggregate, then skip it. # and if it is non-aggregate, then don't print it.
if include_aggregates_only and 'run_type' in benchmark: if not include_aggregates_only or not 'run_type' in benchmark or benchmark['run_type'] != 'aggregate':
if benchmark['run_type'] != 'aggregate':
continue
for measurement in benchmark['measurements']: for measurement in benchmark['measurements']:
output_strs += [color_format(use_color, output_strs += [color_format(use_color,
fmt_str, fmt_str,
@ -643,6 +640,52 @@ class TestReportDifferenceWithUTest(unittest.TestCase):
parts = [x for x in output_lines[i].split(' ') if x] parts = [x for x in output_lines[i].split(' ') if x]
self.assertEqual(expect_lines[i], parts) self.assertEqual(expect_lines[i], parts)
def test_json_diff_report_pretty_printing_aggregates_only(self):
expect_lines = [
['BM_Two', '+0.1111', '-0.0111', '9', '10', '90', '89'],
['BM_Two', '-0.1250', '-0.1628', '8', '7', '86', '72'],
['BM_Two_pvalue',
'0.6985',
'0.6985',
'U',
'Test,',
'Repetitions:',
'2',
'vs',
'2.',
'WARNING:',
'Results',
'unreliable!',
'9+',
'repetitions',
'recommended.'],
['short_pvalue',
'0.7671',
'0.1489',
'U',
'Test,',
'Repetitions:',
'2',
'vs',
'3.',
'WARNING:',
'Results',
'unreliable!',
'9+',
'repetitions',
'recommended.'],
['medium', '-0.3750', '-0.3375', '8', '5', '80', '53'],
]
output_lines_with_header = print_difference_report(
self.json_diff_report, include_aggregates_only=True, utest=True, utest_alpha=0.05, use_color=False)
output_lines = output_lines_with_header[2:]
print("\n")
print("\n".join(output_lines_with_header))
self.assertEqual(len(output_lines), len(expect_lines))
for i in range(0, len(output_lines)):
parts = [x for x in output_lines[i].split(' ') if x]
self.assertEqual(expect_lines[i], parts)
def test_json_diff_report(self): def test_json_diff_report(self):
expected_output = [ expected_output = [
{ {