3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-21 22:09:23 +01:00

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.
This commit is contained in:
James Prestwood 2022-09-30 16:28:08 -07:00 committed by Denis Kenzior
parent 72e7d3ceb8
commit 47e11dea58

View File

@ -37,6 +37,14 @@ def dbg(*s, **kwargs):
''' '''
print(*s, **kwargs, file=sys.__stdout__) 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(): def exit_vm():
if config: if config:
for p in Process.get_all(): for p in Process.get_all():
@ -45,13 +53,9 @@ def exit_vm():
if config.ctx and config.ctx.results: if config.ctx and config.ctx.results:
success = print_results(config.ctx.results) success = print_results(config.ctx.results)
else:
success = False
if config.ctx.args.result: if config.ctx.args.result:
result = 'PASS' if success else 'FAIL' write_results(config.ctx.args.result, config.ctx.results)
with open(config.ctx.args.result, 'w') as f:
f.write(result)
os.sync() os.sync()