如何使用 l3build 執行多次運行/編譯來檢查測試檔?

如何使用 l3build 執行多次運行/編譯來檢查測試檔?

我想用l3build它對我擁有的一些 LaTeX 程式碼執行回歸測試。當我需要多次編譯來進行此類回歸測試時,我的困難就開始了。例如,我想檢查目錄是否正確列印了我的測試文件的各個部分。

如果我手動執行此操作,則在第一次編譯時,目錄丟失,而在第二次編譯時,一切都很好。但是,如果我這樣做,l3build我將無法進行第二次編譯。

從文檔中,我發現這runtest_tasks可能是一個選擇。但是,在我的情況下它似乎無法正常工作。我認為我錯過了一些東西,但由於我沒有找到例子,所以我很難找到這個小東西。

這是一個 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

和一個 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}

那麼如何執行l3build需要多次運行/編譯的回歸測試呢?

答案1

我正在把 @Ulrike Fischer 的評論變成一個答案。

只是有一個選項checkruns=3可用於此目的。此外,如果多次檢查運行僅涉及某些文件,則可以將它們分隔在不同的資料夾中,並使用該checkconfigs={<file>}選項指向與該資料夾(和檔案)相關的特定設定設定檔。

相關內容