Skip to content

Commit 049ffb3

Browse files
committed
[benchmark] Fix parsing formatted text
The test number column in the space justified column format emmited by the Benchmark_Driver to stdout while logging to file is right aligned, so it must handle leading whitespace.
1 parent 0d64386 commit 049ffb3

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

benchmark/scripts/compare_perf_tests.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ def _reset(self):
308308

309309
# Parse lines like this
310310
# #,TEST,SAMPLES,MIN(μs),MAX(μs),MEAN(μs),SD(μs),MEDIAN(μs)
311-
results_re = re.compile(r'(\d+[, \t]*\w+[, \t]*' +
311+
results_re = re.compile(r'([ ]*\d+[, \t]*\w+[, \t]*' +
312312
r'[, \t]*'.join([r'[\d.]+'] * 6) +
313313
r'[, \t]*[\d.]*)') # optional MAX_RSS(B)
314314

benchmark/scripts/test_compare_perf_tests.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -345,9 +345,9 @@ def test_parse_results_tab_delimited(self):
345345
def test_parse_results_formatted_text(self):
346346
"""Parse format that Benchmark_Driver prints to console"""
347347
log = ("""
348-
# TEST SAMPLES MIN(μs) MAX(μs) MEAN(μs) SD(μs) MEDIAN(μs) MAX_RSS(B)
349-
3 Array2D 20 2060 2188 2099 0 2099 20915200
350-
Totals 281""")
348+
# TEST SAMPLES MIN(μs) MAX(μs) MEAN(μs) SD(μs) MEDIAN(μs) MAX_RSS(B)
349+
3 Array2D 20 2060 2188 2099 0 2099 20915200
350+
Totals 281""")
351351
parser = LogParser()
352352
results = parser.parse_results(log.splitlines()[1:]) # without 1st \n
353353
self.assertTrue(isinstance(results[0], PerformanceTestResult))

0 commit comments

Comments
 (0)