commit 47e11dea58fb2f2eab49cfb4f9630274fc424ae2
parent 72e7d3ceb83d1e8b223974478f5ca539371ab894
Author: James Prestwood <prestwoj@gmail.com>
Date: Fri, 30 Sep 2022 16:28:08 -0700
test-runner: write out individual test results
The --results option only wrote PASS/FAIL for the entire run.
Instead write out each individual test result.
Diffstat:
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/tools/run-tests b/tools/run-tests
@@ -37,6 +37,14 @@ def dbg(*s, **kwargs):
'''
print(*s, **kwargs, file=sys.__stdout__)
+def write_results(file, results):
+ with open(file, 'w') as f:
+ for test, results in results.items():
+ if results.failures != 0 or results.errors != 0:
+ f.write('%s:FAIL\n' % test)
+ else:
+ f.write('%s:PASS\n' % test)
+
def exit_vm():
if config:
for p in Process.get_all():
@@ -45,13 +53,9 @@ def exit_vm():
if config.ctx and config.ctx.results:
success = print_results(config.ctx.results)
- else:
- success = False
- if config.ctx.args.result:
- result = 'PASS' if success else 'FAIL'
- with open(config.ctx.args.result, 'w') as f:
- f.write(result)
+ if config.ctx.args.result:
+ write_results(config.ctx.args.result, config.ctx.results)
os.sync()