Skip to content

Commit

Permalink
Made test.py output parsable by summary.py
Browse files Browse the repository at this point in the history
Also fixed an issue with truncation that resulted in a bunch of null
bytes being injected into the CSV output.
  • Loading branch information
geky committed Sep 17, 2022
1 parent acdea18 commit 1fcd82d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion scripts/summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
MERGES = {
'add': (
['code_size', 'data_size', 'stack_frame', 'struct_size',
'coverage_lines', 'coverage_branches'],
'coverage_lines', 'coverage_branches',
'test_passed'],
lambda xs: sum(xs[1:], start=xs[0])
),
'mul': (
Expand Down
7 changes: 4 additions & 3 deletions scripts/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,7 @@ def writerow(self, row):
else:
# need to rewrite the file
self.head.extend(row.keys() - (self.head + self.tail))
self.f.seek(0)
self.f.truncate()
self.writer = csv.DictWriter(self.f, self.head + self.tail)
self.writer.writeheader()
Expand Down Expand Up @@ -767,7 +768,7 @@ def run_runner(runner_, ids=[]):
runner_, m.group('id'), **args)
output_.writerow({
'case': m.group('case'),
'test_pass': 1,
'test_passed': '1/1',
**defines})
elif op == 'skipped':
locals.seen_perms += 1
Expand Down Expand Up @@ -822,7 +823,7 @@ def run_job(runner_, ids=[], start=None, step=None):
defines = find_defines(runner_, failure.id, **args)
output_.writerow({
'case': ':'.join([suite, case]),
'test_pass': 0,
'test_passed': '0/1',
**defines})

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

# measure runtime
start = time.time()
Expand Down

0 comments on commit 1fcd82d

Please sign in to comment.