don't record test status for unreachable tests

and print a summary line for how many tests were unreachable
develop
myk002 2021-04-19 22:18:42 -07:00
parent eaf0722cdf
commit e07635b345
No known key found for this signature in database
GPG Key ID: 8A39CA0FA0C16E78
1 changed files with 14 additions and 5 deletions

@ -484,21 +484,28 @@ end
local function run_tests(tests, status, counts, config) local function run_tests(tests, status, counts, config)
print(('Running %d tests'):format(#tests)) print(('Running %d tests'):format(#tests))
local num_skipped = 0
for _, test in pairs(tests) do for _, test in pairs(tests) do
status[test.full_name] = TestStatus.FAILED if MODES[test.config.mode].failed then
if MODES[test.config.mode].failed then goto skip end num_skipped = num_skipped + 1
goto skip
end
if not MODES[test.config.mode].detect() then if not MODES[test.config.mode].detect() then
local ok, err = pcall(MODES[test.config.mode].navigate, config) local ok, err = pcall(MODES[test.config.mode].navigate, config)
if not ok then if not ok then
MODES[test.config.mode].failed = true MODES[test.config.mode].failed = true
dfhack.printerr(tostring(err)) dfhack.printerr(tostring(err))
num_skipped = num_skipped + 1
goto skip goto skip
end end
end end
status[test.full_name] = run_test(test, status, counts) and if run_test(test, status, counts) then
TestStatus.PASSED or TestStatus.FAILED status[test.full_name] = TestStatus.PASSED
::skip:: else
status[test.full_name] = TestStatus.FAILED
end
save_test_status(status) save_test_status(status)
::skip::
end end
local function print_summary_line(ok, message) local function print_summary_line(ok, message)
@ -518,6 +525,8 @@ local function run_tests(tests, status, counts, config)
('%d/%d checks passed'):format(counts.checks_ok, counts.checks)) ('%d/%d checks passed'):format(counts.checks_ok, counts.checks))
print_summary_line(counts.file_errors == 0, print_summary_line(counts.file_errors == 0,
('%d test files failed to load'):format(counts.file_errors)) ('%d test files failed to load'):format(counts.file_errors))
print_summary_line(num_skipped == 0,
('%d tests in unreachable modes'):format(num_skipped))
save_test_status(status) save_test_status(status)
end end