Skip to content

Commit

Permalink
Improve log for failed checks with no diff files
Browse files Browse the repository at this point in the history
  • Loading branch information
muzimuzhi committed Nov 6, 2023
1 parent 9a53611 commit 0cc7fe7
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 15 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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]

Expand Down
26 changes: 21 additions & 5 deletions l3build-check.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
11 changes: 1 addition & 10 deletions l3build.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "", ""
Expand Down

0 comments on commit 0cc7fe7

Please sign in to comment.