mirror of
https://github.com/google/benchmark.git
synced 2025-03-30 22:20:23 +08:00
[Tools] Fix a few python3-compatibility issues (#585)
This commit is contained in:
parent
e8ddd907bb
commit
718cc91d00
@ -138,6 +138,9 @@ def main():
|
|||||||
# Parse the command line flags
|
# Parse the command line flags
|
||||||
parser = create_parser()
|
parser = create_parser()
|
||||||
args, unknown_args = parser.parse_known_args()
|
args, unknown_args = parser.parse_known_args()
|
||||||
|
if args.mode is None:
|
||||||
|
parser.print_help()
|
||||||
|
exit(1)
|
||||||
assert not unknown_args
|
assert not unknown_args
|
||||||
benchmark_options = args.benchmark_options
|
benchmark_options = args.benchmark_options
|
||||||
|
|
||||||
@ -175,6 +178,7 @@ def main():
|
|||||||
else:
|
else:
|
||||||
# should never happen
|
# should never happen
|
||||||
print("Unrecognized mode of operation: '%s'" % args.mode)
|
print("Unrecognized mode of operation: '%s'" % args.mode)
|
||||||
|
parser.print_help()
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
check_inputs(test_baseline, test_contender, benchmark_options)
|
check_inputs(test_baseline, test_contender, benchmark_options)
|
||||||
@ -218,8 +222,8 @@ class TestParser(unittest.TestCase):
|
|||||||
os.path.realpath(__file__)),
|
os.path.realpath(__file__)),
|
||||||
'gbench',
|
'gbench',
|
||||||
'Inputs')
|
'Inputs')
|
||||||
self.testInput0 = os.path.join(testInputs, 'test_baseline_run1.json')
|
self.testInput0 = os.path.join(testInputs, 'test1_run1.json')
|
||||||
self.testInput1 = os.path.join(testInputs, 'test_baseline_run2.json')
|
self.testInput1 = os.path.join(testInputs, 'test1_run2.json')
|
||||||
|
|
||||||
def test_benchmarks_basic(self):
|
def test_benchmarks_basic(self):
|
||||||
parsed = self.parser.parse_args(
|
parsed = self.parser.parse_args(
|
||||||
|
@ -191,7 +191,7 @@ class TestReportDifferenceBetweenFamilies(unittest.TestCase):
|
|||||||
json2 = filter_benchmark(json, "BM_O.e", ".")
|
json2 = filter_benchmark(json, "BM_O.e", ".")
|
||||||
output_lines_with_header = generate_difference_report(json1, json2, use_color=False)
|
output_lines_with_header = generate_difference_report(json1, json2, use_color=False)
|
||||||
output_lines = output_lines_with_header[2:]
|
output_lines = output_lines_with_header[2:]
|
||||||
print "\n"
|
print("\n")
|
||||||
print("\n".join(output_lines_with_header))
|
print("\n".join(output_lines_with_header))
|
||||||
self.assertEqual(len(output_lines), len(expect_lines))
|
self.assertEqual(len(output_lines), len(expect_lines))
|
||||||
for i in range(0, len(output_lines)):
|
for i in range(0, len(output_lines)):
|
||||||
|
Loading…
Reference in New Issue
Block a user