From 47e11dea58fb2f2eab49cfb4f9630274fc424ae2 Mon Sep 17 00:00:00 2001 From: James Prestwood Date: Fri, 30 Sep 2022 16:28:08 -0700 Subject: [PATCH] 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. --- tools/run-tests | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/tools/run-tests b/tools/run-tests index 9620ed1f..32c09723 100755 --- 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()