Make "test file failed to load" errors more obvious, and make run-tests.py fail

These errors could previously go undetected, since they were easy to miss at the
end of the output and did not cause run-tests.py to fail.

This change adds a `*` pseudo-entry to test_status.json, which is set to
"failed" if any tests failed *or* failed to load. This avoids the need to change
run-tests.py, which is cached on Buildmaster.

See #1815
develop
lethosor 2021-03-23 22:11:48 -04:00
parent 10a7455e85
commit 9a29e5f1ce
No known key found for this signature in database
GPG Key ID: 76A269552F4F58C1
1 changed files with 18 additions and 3 deletions

@ -455,10 +455,25 @@ local function run_tests(tests, status, counts)
save_test_status(status)
end
local function print_summary_line(ok, message)
local print_fn = print
if not ok then
status['*'] = TestStatus.FAILED
print_fn = dfhack.printerr
end
print_fn(message)
end
status['*'] = status['*'] or TestStatus.PASSED
print('\nTest summary:')
print(('%d/%d tests passed'):format(counts.tests_ok, counts.tests))
print(('%d/%d checks passed'):format(counts.checks_ok, counts.checks))
print(('%d test files failed to load'):format(counts.file_errors))
print_summary_line(counts.tests_ok == counts.tests,
('%d/%d tests passed'):format(counts.tests_ok, counts.tests))
print_summary_line(counts.checks_ok == counts.checks,
('%d/%d checks passed'):format(counts.checks_ok, counts.checks))
print_summary_line(counts.file_errors == 0,
('%d test files failed to load'):format(counts.file_errors))
save_test_status(status)
end
local function main(args)