2

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 ?

4
  • 3
    typically you simply set the checkruns variable, e.g. checkruns=3. Commented Dec 22, 2023 at 13:57
  • 1
    Humm humm, Yes, I missed that option in the documentation... I was probably working too late yesterday... Additionally, can this option be set only for some testfiles ?
    – R. N
    Commented Dec 22, 2023 at 14:01
  • 3
    you can separate testfiles in different folders and use a config-file to change the settings. Commented Dec 22, 2023 at 14:13
  • If you want to turn your comments into an anwser, I will accept it.
    – R. N
    Commented Dec 22, 2023 at 14:22

1 Answer 1

2

I am turning @Ulrike Fischer comments into an anwser.

There is simply the option checkruns=3 available for that purpose. In addition, if the multiple checkruns are concerning only some files, they can be separated in a different folder and use the checkconfigs={<file>} option to point toward a specific setting configuration file related to that folder (and files).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .