我仍在尝试理解l3build
测试是如何进行的,更具体地针对课程。
为此,我创建了一个sandbox
目录,其内容如下:
$ tree sandbox/
sandbox/
├── build.lua
├── myclass.cls
└── testfiles
└── myclass-test.lvt
可以使用以下命令生成此目录结构和这些各种文件的内容:
mkdir -p sandbox/testfiles
pdflatex generate-sandbox.tex
其中generate-sandbox.tex
有以下内容:
\begin{filecontents*}[overwrite]{sandbox/build.lua}
#!/usr/bin/env texlua
module = "myclass"
sourcefiles = {"*.cls"}
installfiles = sourcefiles
\end{filecontents*}
\begin{filecontents*}[overwrite]{sandbox/myclass.cls}
\ProvidesExplClass
{myclass}
{2023/03/24}
{0.1}
{
My~Nice~Class.
}
\NeedsTeXFormat{LaTeX2e}
\LoadClass { article }
\RequirePackage{tcolorbox}
\endinput
\end{filecontents*}
\begin{filecontents*}[overwrite]{sandbox/testfiles/myclass-test.lvt}
\input{regression-test}
\documentclass{myclass}
\begin{document}
\START
Foo.
\end{document}
\end{filecontents*}
\documentclass{article}
\begin{document}
\end{document}
到目前为止一切顺利。现在我想将测试的输出保存到文件myclass-test.lvt
中.tlg
:
cd sandbox
l3build save myclass-test
输出非常详细:
Creating and copying myclass-test.tlg
This is pdfTeX, Version 3.141592653-2.6-1.40.25 (TeX Live 2023) (preloaded format=pdflatex)
restricted \write18 enabled.
(./ascii.tcx)
entering extended mode
LaTeX2e <2022-11-01> patch level 1
L3 programming layer <2023-02-22> (./myclass-test.lvt (/usr/local/texlive/2023/texmf-dist/tex/latex/l3build/regression-test.tex{/usr/local/texlive/2023/texmf-var/fonts/map/pdftex/updmap/pdftex.map}) (./myclass.cls
Document Class: myclass 2023/03/24 v0.1 My\nobreakspace {}Nice\nobreakspace {}Class.
(/usr/local/texlive/2023/texmf-dist/tex/latex/base/article.cls
Document Class: article 2022/07/02 v1.4n Standard LaTeX document class
(/usr/local/texlive/2023/texmf-dist/tex/latex/base/size10.clo)) (/usr/local/texlive/2023/texmf-dist/tex/latex/tcolorbox/tcolorbox.sty (/usr/local/texlive/2023/texmf-dist/tex/latex/pgf/basiclayer/pgf.sty (/usr/local/texlive/2023/texmf-dist/tex/latex/pgf/utilities/pgfrcs.sty (/usr/local/texlive/2023/texmf-dist/tex/generic/pgf/utilities/pgfutil-common.tex) (/usr/local/texlive/2023/texmf-dist/tex/generic/pgf/utilities/pgfutil-latex.def) (/usr/local/texlive/2023/texmf-dist/tex/generic/pgf/utilities/pgfrcs.code.tex (/usr/local/texlive/2023/texmf-dist/tex/generic/pgf/pgf.revision.tex))) (/usr/local/texlive/2023/texmf-dist/tex/latex/pgf/basiclayer/pgfcore.sty (/usr/local/texlive/2023/texmf-dist/tex/latex/graphics/graphicx.sty (/usr/local/texlive/2023/texmf-dist/tex/latex/graphics/keyval.sty) (/usr/local/texlive/2023/texmf-dist/tex/latex/graphics/graphics.sty (/usr/local/texlive/2023/texmf-dist/tex/latex/graphics/trig.sty) (/usr/local/texlive/2023/texmf-dist/tex/latex/graphics-cfg/graphics.cfg) (/usr/local/texlive/2023/texmf-dist/tex/latex/graphics-def/pdftex.def))) (/usr/local/texlive/2023/texmf-dist/tex/latex/pgf/systemlayer/pgfsys.sty (/usr/local/texlive/2023/texmf-dist/tex/generic/pgf/systemlayer/pgfsys.code.tex (/usr/local/texlive/2023/texmf-dist/tex/generic/pgf/utilities/pgfkeys.code.tex (/usr/local/texlive/2023/texmf-dist/tex/generic/pgf/utilities/pgfkeyslibraryfiltered.code.tex)) (/usr/local/texlive/2023/texmf-dist/tex/generic/pgf/systemlayer/pgf.cfg) (/usr/local/texlive/2023/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-pdftex.def (/usr/local/texlive/2023/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-common-pdf.def))) (/usr/local/texlive/2023/texmf-dist/tex/generic/pgf/systemlayer/pgfsyssoftpath.code.tex) (/usr/local/texlive/2023/texmf-dist/tex/generic/pgf/systemlayer/pgfsysprotocol.code.tex)) (/usr/local/texlive/2023/texmf-dist/tex/latex/xcolor/xcolor.sty (/usr/local/texlive/2023/texmf-dist/tex/latex/graphics-cfg/color.cfg) (/usr/local/texlive/2023/texmf-dist/tex/latex/graphics/mathcolor.ltx)) (/usr/local/texlive/2023/texmf-dist/tex/generic/pgf/basiclayer/pgfcore.code.tex (/usr/local/texlive/2023/texmf-dist/tex/generic/pgf/math/pgfmath.code.tex (/usr/local/texlive/2023/texmf-dist/tex/generic/pgf/math/pgfmathutil.code.tex) (/usr/local/texlive/2023/texmf-dist/tex/generic/pgf/math/pgfmathparser.code.tex) (/usr/local/texlive/2023/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.code.tex) (/usr/local/texlive/2023/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.basic.code.tex) (/usr/local/texlive/2023/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.trigonometric.code.tex) (/usr/local/texlive/2023/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.random.code.tex) (/usr/local/texlive/2023/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.comparison.code.tex) (/usr/local/texlive/2023/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.base.code.tex) (/usr/local/texlive/2023/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.round.code.tex) (/usr/local/texlive/2023/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.misc.code.tex) (/usr/local/texlive/2023/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.integerarithmetics.code.tex) (/usr/local/texlive/2023/texmf-dist/tex/generic/pgf/math/pgfmathcalc.code.tex) (/usr/local/texlive/2023/texmf-dist/tex/generic/pgf/math/pgfmathfloat.code.tex)) (/usr/local/texlive/2023/texmf-dist/tex/generic/pgf/math/pgfint.code.tex) (/usr/local/texlive/2023/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepoints.code.tex) (/usr/local/texlive/2023/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepathconstruct.code.tex) (/usr/local/texlive/2023/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepathusage.code.tex) (/usr/local/texlive/2023/texmf-dist/tex/generic/pgf/basiclayer/pgfcorescopes.code.tex) (/usr/local/texlive/2023/texmf-dist/tex/generic/pgf/basiclayer/pgfcoregraphicstate.code.tex) (/usr/local/texlive/2023/texmf-dist/tex/generic/pgf/basiclayer/pgfcoretransformations.code.tex) (/usr/local/texlive/2023/texmf-dist/tex/generic/pgf/basiclayer/pgfcorequick.code.tex) (/usr/local/texlive/2023/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreobjects.code.tex) (/usr/local/texlive/2023/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepathprocessing.code.tex) (/usr/local/texlive/2023/texmf-dist/tex/generic/pgf/basiclayer/pgfcorearrows.code.tex) (/usr/local/texlive/2023/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreshade.code.tex) (/usr/local/texlive/2023/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreimage.code.tex) (/usr/local/texlive/2023/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreexternal.code.tex) (/usr/local/texlive/2023/texmf-dist/tex/generic/pgf/basiclayer/pgfcorelayers.code.tex) (/usr/local/texlive/2023/texmf-dist/tex/generic/pgf/basiclayer/pgfcoretransparency.code.tex) (/usr/local/texlive/2023/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepatterns.code.tex) (/usr/local/texlive/2023/texmf-dist/tex/generic/pgf/basiclayer/pgfcorerdf.code.tex))) (/usr/local/texlive/2023/texmf-dist/tex/generic/pgf/modules/pgfmoduleshapes.code.tex) (/usr/local/texlive/2023/texmf-dist/tex/generic/pgf/modules/pgfmoduleplot.code.tex) (/usr/local/texlive/2023/texmf-dist/tex/latex/pgf/compatibility/pgfcomp-version-0-65.sty) (/usr/local/texlive/2023/texmf-dist/tex/latex/pgf/compatibility/pgfcomp-version-1-18.sty)) (/usr/local/texlive/2023/texmf-dist/tex/latex/tools/verbatim.sty) (/usr/local/texlive/2023/texmf-dist/tex/latex/environ/environ.sty (/usr/local/texlive/2023/texmf-dist/tex/latex/trimspaces/trimspaces.sty)) (/usr/local/texlive/2023/texmf-dist/tex/latex/etoolbox/etoolbox.sty))) (/usr/local/texlive/2023/texmf-dist/tex/latex/l3backend/l3backend-pdftex.def)
No file myclass-test.aux.
(/usr/local/texlive/2023/texmf-dist/tex/context/base/mkii/supp-pdf.mkii
[Loading MPS to PDF converter (version 2006.09.02).]
) (/usr/local/texlive/2023/texmf-dist/tex/latex/epstopdf-pkg/epstopdf-base.sty (/usr/local/texlive/2023/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg))
START-TEST-LOG
This is a generated file for the l3build validation system.
Don't change this file in any respect.
[1] (./myclass-test.aux)
END-TEST-LOG
)</usr/local/texlive/2023/texmf-dist/fonts/type1/public/amsfonts/cm/cmr10.pfb>
Output written on myclass-test.pdf (1 page, 13363 bytes).
Transcript written on myclass-test.log.
但该文件的内容myclass-test.tlg
看起来没什么用:
This is a generated file for the l3build validation system.
Don't change this file in any respect.
[1
] (myclass-test.aux)
我是否遗漏了什么?
答案1
你的测试是
\START
Foo.
\end{document}
因此,规范化的日志或多或少是空的,但不一定是无用的,也许未来的版本会产生错误,日志变得非空,l3build 会发出警告。
特别添加
\AtEndDocument{\oops}
到你的 .cls 文件。现在使用以下代码测试你的新功能:
l3build check
您将收到警告
Check failed with difference files
- ./build/test/myclass-test.luatex.diff
- ./build/test/myclass-test.pdftex.diff
- ./build/test/myclass-test.xetex.diff
所以 tlg 不是没用的。
*** ./build/test/myclass-test.tlg Fri Mar 24 22:31:53 2023
--- ./build/test/myclass-test.pdftex.log Fri Mar 24 22:31:55 2023
***************
*** 1,4 ****
--- 1,13 ----
This is a generated file for the l3build validation system.
Don't change this file in any respect.
+ ! Undefined control sequence.
+ \__hook enddocument ->\oops
+ \ifpgf@external@grabshipout \pgfutil@ifundefined...
+ l. ...\end{document}
+ The control sequence at the end of the top line
+ of your error message was never \def'ed. If you have
+ misspelled it (e.g., `\hobx'), type `I' and the correct
+ spelling (e.g., `I\hbox'). Otherwise just continue,
+ and I'll forget about whatever was undefined.
[1
] (myclass-test.aux)
通常,虽然你想把一些测试输出到日志中,但你可以使用\typeout
或\showoutput
或regression-test
有特定的\TEST...
命令来制作结构化的日志输出