diff --git a/CHANGELOG.md b/CHANGELOG.md index fcd5201..01371c4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ this project uses date-based 'snapshot' version identifiers. ### Changed - Document default value of `ctanpkg` as a valid lua expression +- Improve log for failed checks with no diff files ## [2023-11-01] diff --git a/l3build-check.lua b/l3build-check.lua index 3279f2c..91db26a 100644 --- a/l3build-check.lua +++ b/l3build-check.lua @@ -1031,7 +1031,7 @@ function check(names) end end if errorlevel ~= 0 then - checkdiff() + checkdiff() -- this leaves "config" parameter of "checkdiff()" nil if options["show-saves"] then showsavecommands(failurelist) end @@ -1043,10 +1043,26 @@ function check(names) end -- A short auxiliary to print the list of differences for check -function checkdiff() - print("\n Check failed with difference files") - for _,i in ipairs(ordered_filelist(testdir, "*" .. os_diffext)) do - print(" - " .. testdir .. "/" .. i) +function checkdiff(config) + local diff_files = ordered_filelist(testdir, "*" .. os_diffext) + if next(diff_files) then + if config then + print("Failed tests for configuration \"" .. config .. "\":") + local testdir = testdir + if config ~= "build" then + testdir = testdir .. "-" .. config + end + end + print("\n Check failed with difference files") + for _,i in ipairs(diff_files) do + print(" - " .. testdir .. "/" .. i) + end + else + if config then + print("Check failed for configuration \"" .. config .. "\" with no difference files.") + else + print("Check failed with no difference files.") + end end print("") end diff --git a/l3build.lua b/l3build.lua index cf8f66c..146ded5 100644 --- a/l3build.lua +++ b/l3build.lua @@ -165,16 +165,7 @@ if #checkconfigs > 1 then end if next(failed) then for _,config in ipairs(failed) do - print("Failed tests for configuration \"" .. config .. "\":") - print("\n Check failed with difference files") - local testdir = testdir - if config ~= "build" then - testdir = testdir .. "-" .. config - end - for _,i in ipairs(ordered_filelist(testdir,"*" .. os_diffext)) do - print(" - " .. testdir .. "/" .. i) - end - print("") + checkdiff(config) end if options["show-saves"] then local savecmds, recheckcmds = "", ""