From 4b8a16153e79644a5df9f6dc94215ac009c26c33 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Fri, 30 Aug 2019 08:26:55 +0200 Subject: [PATCH] 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/helpers.lua | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/test/helpers.lua b/test/helpers.lua index b571085b4e..08a7822b19 100644 --- a/test/helpers.lua +++ b/test/helpers.lua @@ -124,7 +124,7 @@ end function module.check_logs() 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 for tail in lfs.dir(log_dir) do 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('= ' .. table.concat(lines, '\n= ') .. '\n') out:write(select(1, start_msg:gsub('.', '=')) .. '\n') - runtime_errors = runtime_errors + 1 + table.insert(runtime_errors, file) 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 -- Tries to get platform name from $SYSTEM_NAME, uname; fallback is "Windows".