tests: check_logs: improve error message (#10887)

Before:

    [  ERROR   ] test/functional/helpers.lua @ 812: after_each
    test/helpers.lua:156: assertion failed!
    stack traceback:
            test/helpers.lua:156: in function 'check_logs'
            test/functional/helpers.lua:816: in function <test/functional/helpers.lua:812>
This commit is contained in:
Daniel Hahler 2019-08-30 08:26:55 +02:00 committed by GitHub
parent 7d53887352
commit 4b8a16153e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -124,7 +124,7 @@ end
function module.check_logs() function module.check_logs()
local log_dir = os.getenv('LOG_DIR') local log_dir = os.getenv('LOG_DIR')
local runtime_errors = 0 local runtime_errors = {}
if log_dir and lfs.attributes(log_dir, 'mode') == 'directory' then if log_dir and lfs.attributes(log_dir, 'mode') == 'directory' then
for tail in lfs.dir(log_dir) do for tail in lfs.dir(log_dir) do
if tail:sub(1, 30) == 'valgrind-' or tail:find('san%.') then if tail:sub(1, 30) == 'valgrind-' or tail:find('san%.') then
@ -148,12 +148,14 @@ function module.check_logs()
out:write(start_msg .. '\n') out:write(start_msg .. '\n')
out:write('= ' .. table.concat(lines, '\n= ') .. '\n') out:write('= ' .. table.concat(lines, '\n= ') .. '\n')
out:write(select(1, start_msg:gsub('.', '=')) .. '\n') out:write(select(1, start_msg:gsub('.', '=')) .. '\n')
runtime_errors = runtime_errors + 1 table.insert(runtime_errors, file)
end end
end end
end end
end end
assert(0 == runtime_errors) assert(0 == #runtime_errors, string.format(
'Found runtime errors in logfile(s): %s',
table.concat(runtime_errors, ', ')))
end end
-- Tries to get platform name from $SYSTEM_NAME, uname; fallback is "Windows". -- Tries to get platform name from $SYSTEM_NAME, uname; fallback is "Windows".