summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/scripts/l3build/l3build-check.lua
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2018-03-25 21:28:04 +0000
committerKarl Berry <karl@freefriends.org>2018-03-25 21:28:04 +0000
commitb0d484d66da70017e2f7617211629a579a3b6056 (patch)
tree75a7afb10823d86efcfdaa64db03ef210620c1bf /Master/texmf-dist/scripts/l3build/l3build-check.lua
parent64a86b6f5f34949239097b2846e6f1867b95e651 (diff)
l3build (24mar18)
git-svn-id: svn://tug.org/texlive/trunk@47114 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/scripts/l3build/l3build-check.lua')
-rw-r--r--Master/texmf-dist/scripts/l3build/l3build-check.lua54
1 files changed, 38 insertions, 16 deletions
diff --git a/Master/texmf-dist/scripts/l3build/l3build-check.lua b/Master/texmf-dist/scripts/l3build/l3build-check.lua
index 2239fe97a76..f378893b14a 100644
--- a/Master/texmf-dist/scripts/l3build/l3build-check.lua
+++ b/Master/texmf-dist/scripts/l3build/l3build-check.lua
@@ -46,6 +46,7 @@ local utf8_char = unicode.utf8.char
local exit = os.exit
local execute = os.execute
+local remove = os.remove
--
-- Auxiliary functions which are used by more than one main function
@@ -495,7 +496,7 @@ function runcheck(name, hide)
engine = "luatex"
end
checkpdf = setup_check(name, engine)
- runtest(name, i, hide, lvtext, checkpdf)
+ runtest(name, i, hide, lvtext, checkpdf, true)
-- Generation of results depends on test type
local errlevel
if checkpdf then
@@ -535,7 +536,7 @@ function setup_check(name, engine)
)
exit(1)
end
- runtest(name, engine, true, lveext, true)
+ runtest(name, engine, true, lveext, true, false)
pdffile = testdir .. "/" .. testname .. pdfext
-- If a PDF is generated use it for comparisons
if not fileexists(pdffile) then
@@ -583,19 +584,19 @@ function compare_pdf(name, engine)
.. " " .. pdffile .. " > " .. cmpfile
)
if errorlevel == 0 then
- os.remove(cmpfile)
+ remove(cmpfile)
end
return errorlevel
end
-function compare_tlg(name, engine)
+function compare_tlg(name, engine,cleanup)
local errorlevel
local testname = name .. "." .. engine
local difffile = testdir .. "/" .. testname .. os_diffext
local logfile = testdir .. "/" .. testname .. logext
local tlgfile = locate({testdir}, {testname .. tlgext, name .. tlgext})
if not tlgfile then
- return
+ return 1
end
-- Do additional log formatting if the engine is LuaTeX, there is no
-- LuaTeX-specific .tlg file and the default engine is not LuaTeX
@@ -604,23 +605,32 @@ function compare_tlg(name, engine)
and stdengine ~= "luatex"
and stdengine ~= "luajittex"
then
- local luatlgfile = testdir .. "/" .. name .. ".luatex" .. tlgext
+ local lualogfile = logfile
+ if cleanup then
+ lualogfile = testdir .. "/" .. testname .. ".tmp" .. logext
+ end
+ local luatlgfile = testdir .. "/" .. testname .. tlgext
formatlualog(tlgfile, luatlgfile, false)
- formatlualog(logfile, logfile, true)
- -- This allows code sharing below: we only need the .tlg name in one place
- tlgfile = luatlgfile
+ formatlualog(logfile, lualogfile, true)
+ errorlevel = execute(os_diffexe .. " "
+ .. normalize_path(luatlgfile .. " " .. lualogfile .. " > " .. difffile))
+ if cleanup then
+ remove(lualogfile)
+ remove(luatlgfile)
+ end
+ else
+ errorlevel = execute(os_diffexe .. " "
+ .. normalize_path(tlgfile .. " " .. logfile .. " > " .. difffile))
end
- errorlevel = execute(os_diffexe .. " "
- .. normalize_path(tlgfile .. " " .. logfile .. " > " .. difffile))
- if errorlevel == 0 then
- os.remove(difffile)
+ if errorlevel == 0 or cleanup then
+ remove(difffile)
end
return errorlevel
end
-- Run one of the test files: doesn't check the result so suitable for
-- both creating and verifying .tlg files
-function runtest(name, engine, hide, ext, makepdf)
+function runtest(name, engine, hide, ext, makepdf, breakout)
local lvtfile = name .. (ext or lvtext)
cp(lvtfile, fileexists(testfiledir .. "/" .. lvtfile)
and testfiledir or unpackdir, testdir)
@@ -653,8 +663,12 @@ function runtest(name, engine, hide, ext, makepdf)
checkopts = checkopts .. " -no-pdf"
end
-- Special casing for ConTeXt
+ local function setup(file)
+ return " -jobname=" .. name .. " " .. ' "\\input ' .. file .. '" '
+ end
if match(checkformat, "^context$") then
format = ""
+ function setup(file) return ' "' .. file .. '" ' end
if engine == "luatex" or engine == "luajittex" then
realengine = "context"
elseif engine == "pdftex" then
@@ -690,12 +704,20 @@ function runtest(name, engine, hide, ext, makepdf)
-- Ensure lines are of a known length
os_setenv .. " max_print_line=" .. maxprintline
.. os_concat ..
- realengine .. format .. " -jobname=" .. name .. " "
- .. asciiopt .. " " .. checkopts .. " \"\\input " .. lvtfile .. "\" "
+ realengine .. format
+ .. " " .. asciiopt .. " " .. checkopts
+ .. setup(lvtfile)
.. (hide and (" > " .. os_null) or "")
.. os_concat ..
runtest_tasks(jobname(lvtfile))
)
+ -- Break the loop if the result is stable
+ if breakout and i < checkruns then
+ formatlog(logfile, newfile, engine, errlevels)
+ if compare_tlg(name,engine,true) == 0 then
+ break
+ end
+ end
end
if makepdf and fileexists(testdir .. "/" .. name .. dviext) then
dvitopdf(name, testdir, engine, hide)