[Tools] Fix a few python3-compatibility issues (#585)

This commit is contained in:
Roman Lebedev 2018-05-08 13:34:31 +03:00 committed by Dominic Hamon
parent e8ddd907bb
commit 718cc91d00
2 changed files with 7 additions and 3 deletions

View File

@ -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(

View File

@ -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)):