Skip to content

Commit 1fcd82d

Browse files
committed
Made test.py output parsable by summary.py
Also fixed an issue with truncation that resulted in a bunch of null bytes being injected into the CSV output.
1 parent acdea18 commit 1fcd82d

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

scripts/summary.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
MERGES = {
1919
'add': (
2020
['code_size', 'data_size', 'stack_frame', 'struct_size',
21-
'coverage_lines', 'coverage_branches'],
21+
'coverage_lines', 'coverage_branches',
22+
'test_passed'],
2223
lambda xs: sum(xs[1:], start=xs[0])
2324
),
2425
'mul': (

scripts/test.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -663,6 +663,7 @@ def writerow(self, row):
663663
else:
664664
# need to rewrite the file
665665
self.head.extend(row.keys() - (self.head + self.tail))
666+
self.f.seek(0)
666667
self.f.truncate()
667668
self.writer = csv.DictWriter(self.f, self.head + self.tail)
668669
self.writer.writeheader()
@@ -767,7 +768,7 @@ def run_runner(runner_, ids=[]):
767768
runner_, m.group('id'), **args)
768769
output_.writerow({
769770
'case': m.group('case'),
770-
'test_pass': 1,
771+
'test_passed': '1/1',
771772
**defines})
772773
elif op == 'skipped':
773774
locals.seen_perms += 1
@@ -822,7 +823,7 @@ def run_job(runner_, ids=[], start=None, step=None):
822823
defines = find_defines(runner_, failure.id, **args)
823824
output_.writerow({
824825
'case': ':'.join([suite, case]),
825-
'test_pass': 0,
826+
'test_passed': '0/1',
826827
**defines})
827828

828829
# race condition for multiple failures?
@@ -936,7 +937,7 @@ def run(runner, test_ids=[], **args):
936937
trace = openio(args['trace'], 'w', 1)
937938
output = None
938939
if args.get('output'):
939-
output = TestOutput(args['output'], ['case'], ['test_pass'])
940+
output = TestOutput(args['output'], ['case'], ['test_passed'])
940941

941942
# measure runtime
942943
start = time.time()

0 commit comments

Comments
 (0)