summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/l3build
diff options
context:
space:
mode:
authorNorbert Preining <preining@logic.at>2016-06-17 15:17:17 +0000
committerNorbert Preining <preining@logic.at>2016-06-17 15:17:17 +0000
commitcc9c5c66b9e6ae378ed92da735b5dd16bd94f0d5 (patch)
treebcbadeace80dabfa7116db9a37a03438fa31c33d /Master/texmf-dist/tex/latex/l3build
parentb77a348b68095e25ff53806034cd68543066a39d (diff)
l3build (17Jun)
git-svn-id: svn://tug.org/texlive/trunk@41469 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/l3build')
-rw-r--r--Master/texmf-dist/tex/latex/l3build/l3build.lua257
-rw-r--r--Master/texmf-dist/tex/latex/l3build/regression-test.tex35
2 files changed, 218 insertions, 74 deletions
diff --git a/Master/texmf-dist/tex/latex/l3build/l3build.lua b/Master/texmf-dist/tex/latex/l3build/l3build.lua
index edb88994984..4348135b50d 100644
--- a/Master/texmf-dist/tex/latex/l3build/l3build.lua
+++ b/Master/texmf-dist/tex/latex/l3build/l3build.lua
@@ -17,8 +17,8 @@
--]]
-- Version information: should be identical to that in l3build.dtx
-release_date = "2016/03/26"
-release_ver = "6466"
+release_date = "2016/06/14"
+release_ver = "6608"
-- "module" is a deprecated function in Lua 5.2: as we want the name
-- for other purposes, and it should eventually be 'free', simply
@@ -149,6 +149,7 @@ makeindexopts = makeindexopts or ""
-- Other required settings
asciiengines = asciiengines or {"pdftex"}
checkruns = checkruns or 1
+epoch = epoch or 1463734800
maxprintline = maxprintline or 79
packtdszip = packtdszip or false -- Not actually needed but clearer
scriptname = scriptname or "build.lua" -- Script used in each directory
@@ -157,9 +158,12 @@ versionform = versionform or ""
-- Extensions for various file types: used to abstract out stuff a bit
bakext = bakext or ".bak"
+dviext = dviext or ".dvi"
logext = logext or ".log"
lveext = lveext or ".lve"
lvtext = lvtext or ".lvt"
+pdfext = pdfext or ".pdf"
+psext = psext or ".ps"
tlgext = tlgext or ".tlg"
-- Run time options
@@ -176,6 +180,7 @@ function argparse()
["halt-on-error"] = "halt" ,
["halt-on-failure"] = "halt" ,
help = "help" ,
+ pdf = "pdf" ,
quiet = "quiet" ,
version = "version"
}
@@ -185,6 +190,7 @@ function argparse()
e = "engine" ,
h = "help" ,
H = "halt" ,
+ p = "pdf" ,
q = "quiet" ,
v = "version"
}
@@ -194,6 +200,7 @@ function argparse()
engine = true ,
halt = false,
help = false,
+ pdf = false,
quiet = false,
version = true
}
@@ -303,6 +310,7 @@ optdate = userargs["date"]
optengines = userargs["engine"]
opthalt = userargs["halt"]
opthelp = userargs["help"]
+optpdf = userargs["pdf"]
optquiet = userargs["quiet"]
optversion = userargs["version"]
@@ -387,6 +395,8 @@ end
-- the support functions
if os.type == "windows" then
os_ascii = "@echo."
+ os_cmpexe = os.getenv("cmpexe") or "fc /b"
+ os_cmpext = os.getenv("cmpext") or ".cmp"
os_concat = "&"
os_diffext = os.getenv("diffext") or ".fc"
os_diffexe = os.getenv("diffexe") or "fc /n"
@@ -399,6 +409,8 @@ if os.type == "windows" then
os_yes = "for /l %I in (1,1,200) do @echo y"
else
os_ascii = "echo \"\""
+ os_cmpexe = os.getenv("cmpexe") or "cmp"
+ os_cmpext = os.getenv("cmpext") or ".cmp"
os_concat = ";"
os_diffext = os.getenv("diffext") or ".diff"
os_diffexe = os.getenv("diffexe") or "diff -c --strip-trailing-cr"
@@ -607,6 +619,8 @@ function allmodules(target)
.. (opthalt and " -H" or "")
.. date
.. engines
+ .. (optpdf and " -p" or "")
+ .. (optquiet and " -q" or "")
.. version
)
if errorlevel ~= 0 then
@@ -828,7 +842,7 @@ function formatlog(logfile, newfile, engine)
break
elseif line == "OMIT" then
skipping = true
- elseif line == "TIMO" then
+ elseif string.match(line, "^%)?TIMO$") then
skipping = false
elseif not prestart and not skipping then
line = normalize(line)
@@ -1045,8 +1059,8 @@ function listmodules()
return modules
end
--- Runs a single test: needs the name of the test rather than the .lvt file
--- One 'test' here may apply to multiple engines
+-- Run one test which may have multiple engine-dependent comparisons
+-- Should create a difference file for each failed test
function runcheck(name, hide)
local checkengines = checkengines
if optengines then
@@ -1055,73 +1069,122 @@ function runcheck(name, hide)
local errorlevel = 0
for _,i in ipairs(checkengines) do
-- Allow for luatex == luajittex for .tlg purposes
- local enginename = i
- if i == "luajittex" then
- enginename = "luatex"
- newfile = testdir .. "/" .. name .. "." .. i .. logext
- end
- local testname = name .. "." .. enginename
- local difffile = testdir .. "/" .. testname .. os_diffext
- local newfile = newfile or testdir .. "/" .. testname .. logext
- -- Use engine-specific file if available
- local tlgfile = locate(
- {testfiledir, unpackdir},
- {testname .. tlgext, name .. tlgext}
- )
- if tlgfile then
- cp(name .. tlgext, testfiledir, testdir)
- else
- -- Attempt to generate missing test goal from expectation
- tlgfile = testdir .. "/" .. testname .. tlgext
- if not locate({unpackdir, testfiledir}, {name .. lveext}) then
- print(
- "Error: failed to find " .. tlgext .. " or "
- .. lveext .. " file for " .. name .. "!"
- )
- os.exit(1)
- end
- runtest(name, i, hide, lveext)
- ren(testdir, testname .. logext, testname .. tlgext)
+ local engine = i
+ if i == "luajitex" then
+ engine = "luatex"
end
+ setup_check(name, engine)
runtest(name, i, hide, lvtext)
- if os_windows then
- tlgfile = unix_to_win(tlgfile)
- end
+ -- Generation of results heavily depends on test type
local errlevel
- -- Do additional log formatting if the engine is LuaTeX, there is no
- -- LuaTeX-specific .tlg file and the default engine is not LuaTeX
- if enginename == "luatex"
- and not string.match(tlgfile, "%.luatex" .. "%" .. tlgext)
- and stdengine ~= "luatex"
- and stdengine ~= "luajittex" then
- local luatlgfile = testdir .. "/" .. name .. ".luatex" .. tlgext
- if os_windows then
- luatlgfile = unix_to_win(luatlgfile)
- end
- formatlualog(tlgfile, luatlgfile)
- formatlualog(newfile, newfile)
- errlevel = os.execute(
- os_diffexe .. " " .. luatlgfile .. " " .. newfile
- .. " > " .. difffile
- )
+ if optpdf then
+ errlevel = compare_pdf(name, engine)
else
- errlevel = os.execute(
- os_diffexe .. " " .. tlgfile .. " " .. newfile .. " > " .. difffile
- )
+ errlevel = compare_tlg(name, engine)
end
- if errlevel == 0 then
- os.remove(difffile)
- else
- if opthalt then
- checkdiff()
- return errlevel
- end
+ if errlevel ~= 0 and opthalt then
+ checkdiff()
+ return errlevel
+ end
+ if errlevel > errorlevel then
errorlevel = errlevel
end
end
return errorlevel
end
+function setup_check(name, engine)
+ local testname = name .. "." .. engine
+ local refext = ((optpdf and pdfext) or tlgext)
+ local reffile = locate(
+ {testfiledir, unpackdir},
+ {testname .. refext, name .. refext}
+ )
+ -- Attempt to generate missing reference file from expectation
+ if not reffile then
+ if not locate({unpackdir, testfiledir}, {name .. lveext}) then
+ print(
+ "Error: failed to find " .. refext .. " or "
+ .. lveext .. " file for " .. name .. "!"
+ )
+ os.exit(1)
+ end
+ runtest(name, engine, hide, lveext)
+ reffile = testdir .. "/" .. testname .. refext
+ if not optpdf then
+ ren(testdir, testname .. logext, testname .. tlgext)
+ end
+ else
+ cp(
+ string.match(reffile, ".*/(.*)"),
+ string.match(reffile, "(.*)/.*"),
+ testdir
+ )
+ end
+ if optpdf then
+ local reffile = string.match(reffile, ".*/(.*)")
+ ren(
+ testdir,
+ reffile,
+ string.gsub(reffile, pdfext .. "$", ".ref" .. pdfext)
+ )
+ end
+end
+
+function compare_pdf(name, engine)
+ local errorlevel
+ local testname = name .. "." .. engine
+ local cmpfile = testdir .. "/" .. testname .. os_cmpext
+ local pdffile = testdir .. "/" .. testname .. pdfext
+ local refpdffile = locate(
+ {testdir}, {testname .. ".ref" .. pdfext, name .. ".ref" .. pdfext}
+ )
+ if os_windows then
+ refpdffile = unix_to_win(refpdffile)
+ end
+ errorlevel = os.execute(
+ os_cmpexe .. " " .. refpdffile .. " " .. pdffile .. " > " .. cmpfile
+ )
+ if errorlevel == 0 then
+ os.remove(cmpfile)
+ end
+ return errorlevel
+end
+
+function compare_tlg(name, engine)
+ 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 os_windows then
+ tlgfile = unix_to_win(tlgfile)
+ end
+ -- Do additional log formatting if the engine is LuaTeX, there is no
+ -- LuaTeX-specific .tlg file and the default engine is not LuaTeX
+ if engine == "luatex"
+ and not string.match(tlgfile, "%.luatex" .. "%" .. tlgext)
+ and stdengine ~= "luatex"
+ and stdengine ~= "luajittex"
+ then
+ local luatlgfile = testdir .. "/" .. name .. ".luatex" .. tlgext
+ if os_windows then
+ luatlgfile = unix_to_win(luatlgfile)
+ end
+ formatlualog(tlgfile, luatlgfile)
+ formatlualog(logfile, logfile)
+ -- This allows code sharing below: we only need the .tlg name in one place
+ tlgfile = luatlgfile
+ end
+ errorlevel = os.execute(
+ os_diffexe .. " " .. tlgfile .. " " .. logfile .. " > " .. difffile
+ )
+ if errorlevel == 0 then
+ os.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)
@@ -1154,7 +1217,9 @@ function runtest(name, engine, hide, ext)
-- Special casing for XeTeX engine
local checkopts = checkopts
if string.match(engine, "xetex") then
- checkopts = checkopts .. " -no-pdf"
+ if not optpdf then
+ checkopts = checkopts .. " -no-pdf"
+ end
end
local logfile = testdir .. "/" .. name .. logext
local newfile = testdir .. "/" .. name .. "." .. engine .. logext
@@ -1175,14 +1240,26 @@ function runtest(name, engine, hide, ext)
-- Avoid spurious output from (u)pTeX
os_setenv .. " GUESS_INPUT_KANJI_ENCODING=0"
.. os_concat ..
+ -- Fix the time of the run
+ os_setenv .. " SOURCE_DATE_EPOCH=" .. epoch
+ .. os_concat ..
+ os_setenv .. " SOURCE_DATE_EPOCH_TEX_PRIMITIVES=1"
+ .. os_concat ..
-- Ensure lines are of a known length
os_setenv .. " max_print_line=" .. maxprintline
.. os_concat ..
realengine .. format .. " "
.. checkopts .. " " .. asciiopt .. lvtfile
.. (hide and (" > " .. os_null) or "")
+ .. os_concat ..
+ runtest_tasks(stripext(lvtfile))
)
end
+ if optpdf then
+ if fileexists(testdir .. "/" .. name .. dviext) then
+ dvitopdf(name, testdir, engine, hide)
+ end
+ end
formatlog(logfile, newfile, engine)
-- Store secondary files for this engine
for _,i in ipairs(filelist(testdir, name .. ".???")) do
@@ -1199,6 +1276,34 @@ function runtest(name, engine, hide, ext)
end
end
+-- A hook to allow additional tasks to run for the tests
+runtest_tasks = runtest_tasks or function(name)
+ return ""
+end
+
+function dvitopdf(name, dir, engine, hide)
+ if string.match(engine, "^u?ptex$") then
+ run(
+ dir,
+ os_setenv .. " SOURCE_DATE_EPOCH=" .. epoch
+ .. os_concat ..
+ "dvipdfmx " .. name .. dviext
+ .. (hide and (" > " .. os_null) or "")
+ )
+ else
+ run(
+ dir,
+ os_setenv .. " SOURCE_DATE_EPOCH=" .. epoch
+ .. os_concat ..
+ "dvips " .. name .. dviext
+ .. (hide and (" > " .. os_null) or "")
+ .. os_concat ..
+ "ps2pdf " .. name .. psext
+ .. (hide and (" > " .. os_null) or "")
+ )
+ end
+end
+
-- Strip the extension from a file name (if present)
function stripext(file)
local name = string.match(file, "^(.*)%.")
@@ -1325,7 +1430,7 @@ typeset = typeset or function(file)
)
end
errorlevel = cycle(name)
- if errorlevel ~= 0 then
+ if errorlevel == 0 then
errorlevel = cycle(name)
end
end
@@ -1336,7 +1441,7 @@ end
-- Standard versions of the main targets for building modules
-- Simply print out how to use the build system
-help = help or function()
+function help()
print("usage: " .. arg[0] .. " <command> [<options>] [<names>]")
print("")
print("The most commonly used l3build commands are:")
@@ -1361,8 +1466,9 @@ help = help or function()
print(" --date|-d Sets the date to insert into sources")
print(" --engine|-e Sets the engine to use for running test")
print(" --halt-on-error|-H Stops running tests after the first failure")
- print(" --version|-v Sets the version to insert into sources")
+ print(" --pdf|-p Check/save PDF files")
print(" --quiet|-q Suppresses TeX output when unpacking")
+ print(" --version|-v Sets the version to insert into sources")
print("")
print("See l3build.pdf for further details.")
end
@@ -1419,6 +1525,9 @@ function checkdiff()
for _,i in ipairs(filelist(testdir, "*" .. os_diffext)) do
print(" - " .. testdir .. "/" .. i)
end
+ for _,i in ipairs(filelist(testdir, "*" .. os_cmpext)) do
+ print(" - " .. testdir .. "/" .. i)
+ end
print("")
end
@@ -1666,13 +1775,21 @@ function save(names)
local engine
for _,engine in pairs(engines) do
local tlgengine = ((engine == stdengine and "") or "." .. engine)
- local tlgfile = name .. tlgengine .. tlgext
- local newfile = name .. "." .. engine .. logext
+ local tlgfile = name .. tlgengine .. tlgext
+ local spdffile = name .. tlgengine .. pdfext
+ local newfile = name .. "." .. engine .. logext
+ local pdffile = name .. "." .. engine .. pdfext
+ local refext = ((optpdf and pdfext) or tlgext)
if testexists(name) then
- print("Creating and copying " .. tlgfile)
+ print("Creating and copying " .. refext)
runtest(name, engine, false, lvtext)
- ren(testdir, newfile, tlgfile)
- cp(tlgfile, testdir, testfiledir)
+ if optpdf then
+ ren(testdir, pdffile, spdffile)
+ cp(spdffile, testdir, testfiledir)
+ else
+ ren(testdir, newfile, tlgfile)
+ cp(tlgfile, testdir, testfiledir)
+ end
if fileexists(unpackdir .. "/" .. tlgfile) then
print(
"Saved " .. tlgext
diff --git a/Master/texmf-dist/tex/latex/l3build/regression-test.tex b/Master/texmf-dist/tex/latex/l3build/regression-test.tex
index a4256a227dc..c6ea45f02ac 100644
--- a/Master/texmf-dist/tex/latex/l3build/regression-test.tex
+++ b/Master/texmf-dist/tex/latex/l3build/regression-test.tex
@@ -57,7 +57,6 @@
\showboxdepth=\maxdimen
\def\loggingoutput{\tracingoutput1
\showboxbreadth\maxdimen\showboxdepth\maxdimen}
-
\newlinechar=`\^^J
\long\def\LONGTYPEOUT#1{%
\begingroup
@@ -209,15 +208,43 @@
\SEPARATOR
\LONGTYPEOUT{}%
}
-
\def \TRUE {\TYPE{TRUE}}
\def \FALSE {\TYPE{FALSE}}
\def \YES {\TYPE{YES}}
\def \NO {\TYPE{NO}}
-
\def \NEWLINE {\TYPE{^^J}}
+\ifnum 0%
+ \ifx\pdfoutput\@undefined\else\ifnum\pdfoutput>0 1\fi\fi
+ \ifx\outputmode\@undefined\else\ifnum\outputmode>0 1\fi\fi
+ >0 %
+ \ifx\pdfvariable\@undefined
+ \pdfinfo{/Producer (\ifx\directlua\@undefined pdf\else Lua\fi TeX)}
+ \ifx\pdfinfoomitdate\@undefined\else
+ \pdfinfoomitdate = 1 %
+ \pdfsuppressptexinfo = 1 %
+ \pdftrailerid{}
+ \fi
+ \else
+ \pdfextension info{/Producer (LuaTeX)}
+ \pdfvariable suppressoptionalinfo \numexpr
+ 0
+ + 1 % PTEX.Fullbanner
+ + 32 % CreationDate
+ + 64 % ModDate
+ \relax
+ \fi
+\else
+ \special{%
+ pdf: docinfo
+ <<
+ /Creator (TeX)
+ /CreationDate ()
+ /ModDate ()
+ /Producer (\ifx\XeTeXversion\@undefined\else x\fi dvipdfmx)
+ >>
+ }
+\fi
\reset@catcodes
-
%%
%%
%% End of file `regression-test.tex'.