I want to use l3build
to perform regression tests on some LaTeX code that I have.
My difficulties start when I need multiple compilation to do such regression tests.
For example, I want to check if a table of content is correctly printing the sections of my test-document.
If, I do it manually, with the 1st compilation, the table of content is missing, and at 2nd compilation everything is fine. But, if I do it with l3build
I do not manage to compile a 2nd time.
From the documentation, I found that runtest_tasks
could be an option.
However, it seems not to work correctly in my case.
I think that I missed a little something, but since I found no example, it is hard for me to find this little something.
Here is a MWE: build.lua:
checksearch = true -- Enable command printing during check phase
-- Function to check if a file name matches a certain pattern
local function match_pattern(filename, pattern)
return true
-- string.match(filename, pattern) ~=nil
end
-- Define the runtest_tasks function
runtest_tasks = function(name, run)
if run == 1 then
print("Debug: name =", name, "run =", run, current_engine )
-- Run additional tasks for files matching a specific pattern
if match_pattern(name, "mytest") then
print("")
print("Executing additional tasks for files matching the pattern.")
print("tex(name)")
-- Add your specific tasks here
errorlevel = tex(name..'.lvt') -- second compilation
print("Executing additional tasks DONE")
return "echo "..errorlevel -- I get 256, and no table of content printed
else
return "echo "..0
end
else
return "echo "..0
end
end
and a mytest.lvt
\input regression-test.tex\relax
\documentclass{article}
\begin{document}
\START
\showoutput
\TEST{toc section}{
\tableofcontents
\newpage
\section{test}
}
\END
\vfil\break
\end{document}
So how to perform a regression test with l3build
requiring multiple runs/compilations ?
checkruns=3
.