summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/l3build/l3build-check.lua
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/l3build/l3build-check.lua')
-rw-r--r--macros/latex/contrib/l3build/l3build-check.lua74
1 files changed, 52 insertions, 22 deletions
diff --git a/macros/latex/contrib/l3build/l3build-check.lua b/macros/latex/contrib/l3build/l3build-check.lua
index 3279f2c4a1..75e2fc2bcf 100644
--- a/macros/latex/contrib/l3build/l3build-check.lua
+++ b/macros/latex/contrib/l3build/l3build-check.lua
@@ -799,29 +799,37 @@ function runtest(name, engine, hide, ext, test_type, breakout)
-- Ensure there is no stray .log file
rmfile(testdir,name .. logext)
local errlevels = {}
+ local preamble =
+ -- No use of localdir here as the files get copied to testdir:
+ -- avoids any paths in the logs
+ os_setenv .. " TEXINPUTS=." .. localtexmf()
+ .. (checksearch and os_pathsep or "")
+ .. os_concat ..
+ os_setenv .. " LUAINPUTS=." .. localtexmf()
+ .. (checksearch and os_pathsep or "")
+ .. os_concat ..
+ -- ensure epoch settings
+ set_epoch_cmd(epoch, forcecheckepoch) ..
+ -- Ensure lines are of a known length
+ os_setenv .. " max_print_line=" .. maxprintline
+ .. os_concat
for i = 1, checkruns do
errlevels[i] = runcmd(
- -- No use of localdir here as the files get copied to testdir:
- -- avoids any paths in the logs
- os_setenv .. " TEXINPUTS=." .. localtexmf()
- .. (checksearch and os_pathsep or "")
- .. os_concat ..
- os_setenv .. " LUAINPUTS=." .. localtexmf()
- .. (checksearch and os_pathsep or "")
- .. os_concat ..
- -- ensure epoch settings
- set_epoch_cmd(epoch, forcecheckepoch) ..
- -- Ensure lines are of a known length
- os_setenv .. " max_print_line=" .. maxprintline
- .. os_concat ..
+ preamble ..
binary .. format
.. " " .. asciiopt .. " " .. checkopts
.. setup(lvtfile)
- .. (hide and (" > " .. os_null) or "")
- .. os_concat ..
- runtest_tasks(jobname(lvtfile),i),
+ .. (hide and (" > " .. os_null) or ""),
testdir
)
+ -- On Windows, concatenting here will suppress any non-zero errorlevel
+ -- from the main run, so we split into two parts.
+ if errlevels[i] == 0 then
+ local errorlevel =
+ runcmd(preamble .. runtest_tasks(jobname(lvtfile),i)
+ .. (hide and (" > " .. os_null) or ""),testdir)
+ if errorlevel ~= 0 then errlevels[i] = errorlevel end
+ end
-- Break the loop if the result is stable
if breakout and i < checkruns then
if test_type.generated == pdfext then
@@ -926,7 +934,13 @@ end
function check(names)
local errorlevel = 0
if testfiledir ~= "" and direxists(testfiledir) then
- if not options["rerun"] then
+ if options["rerun"] then
+ if not direxists(testdir) then
+ print("\n Test directory \"" .. testdir .. "\" doesn't exist.")
+ print(" Try again without \"--rerun\".\n")
+ return 1
+ end
+ else
errorlevel = checkinit()
if errorlevel ~= 0 then
return errorlevel
@@ -1031,7 +1045,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 +1057,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