From 718cc91d004e15ce483cb1ba9bcd5e3a1f025184 Mon Sep 17 00:00:00 2001 From: Roman Lebedev Date: Tue, 8 May 2018 13:34:31 +0300 Subject: [PATCH] [Tools] Fix a few python3-compatibility issues (#585) --- tools/compare.py | 8 ++++++-- tools/gbench/report.py | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/tools/compare.py b/tools/compare.py index c4a47e8d..f0a4455f 100755 --- a/tools/compare.py +++ b/tools/compare.py @@ -138,6 +138,9 @@ def main(): # Parse the command line flags parser = create_parser() args, unknown_args = parser.parse_known_args() + if args.mode is None: + parser.print_help() + exit(1) assert not unknown_args benchmark_options = args.benchmark_options @@ -175,6 +178,7 @@ def main(): else: # should never happen print("Unrecognized mode of operation: '%s'" % args.mode) + parser.print_help() exit(1) check_inputs(test_baseline, test_contender, benchmark_options) @@ -218,8 +222,8 @@ class TestParser(unittest.TestCase): os.path.realpath(__file__)), 'gbench', 'Inputs') - self.testInput0 = os.path.join(testInputs, 'test_baseline_run1.json') - self.testInput1 = os.path.join(testInputs, 'test_baseline_run2.json') + self.testInput0 = os.path.join(testInputs, 'test1_run1.json') + self.testInput1 = os.path.join(testInputs, 'test1_run2.json') def test_benchmarks_basic(self): parsed = self.parser.parse_args( diff --git a/tools/gbench/report.py b/tools/gbench/report.py index 8d68fe96..0c090981 100644 --- a/tools/gbench/report.py +++ b/tools/gbench/report.py @@ -191,7 +191,7 @@ class TestReportDifferenceBetweenFamilies(unittest.TestCase): json2 = filter_benchmark(json, "BM_O.e", ".") output_lines_with_header = generate_difference_report(json1, json2, use_color=False) output_lines = output_lines_with_header[2:] - print "\n" + 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)):