mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Support memory report logs with interleaved non-report output, added automated tests
This commit is contained in:
parent
b93f153ed5
commit
e6c85b97f9
1 changed files with 14 additions and 1 deletions
|
@ -28,7 +28,8 @@ def extract_memory_reports(lines):
|
|||
elif line == 'End memory reports\n':
|
||||
in_report = False
|
||||
elif in_report:
|
||||
report_lines[-1].append(line.strip())
|
||||
if line.startswith('|'):
|
||||
report_lines[-1].append(line.strip())
|
||||
return (report_lines, times)
|
||||
|
||||
|
||||
|
@ -72,6 +73,17 @@ def transform_report_for_test(report):
|
|||
return transformed
|
||||
|
||||
|
||||
def test_extract_memory_reports():
|
||||
input = ["Begin memory reports",
|
||||
"|",
|
||||
" 154.56 MiB -- explicit\n",
|
||||
"| 107.88 MiB -- system-heap-unclassified\n",
|
||||
"End memory reports\n"]
|
||||
expected = ([['|', '| 107.88 MiB -- system-heap-unclassified']], ['reports'])
|
||||
assert(extract_memory_reports(input) == expected)
|
||||
return 0
|
||||
|
||||
|
||||
def test():
|
||||
input = '''|
|
||||
| 23.89 MiB -- explicit
|
||||
|
@ -105,6 +117,7 @@ def test():
|
|||
assert(sorted(transformed.keys()) == sorted(expected.keys()))
|
||||
for k, v in transformed.items():
|
||||
assert(v == expected[k])
|
||||
test_extract_memory_reports()
|
||||
return 0
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue