[latex3-commits] [git/LaTeX3-latex3-l3build] master: Enable PDF checking for all engines (4310564)

Joseph Wright joseph.wright at morningstar2.co.uk
Fri Aug 3 16:16:44 CEST 2018


Repository : https://github.com/latex3/l3build
On branch  : master
Link       : https://github.com/latex3/l3build/commit/4310564d3605007384b93c09851de80cbe924b89

>---------------------------------------------------------------

commit 4310564d3605007384b93c09851de80cbe924b89
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Fri Aug 3 15:07:52 2018 +0100

    Enable PDF checking for all engines
    
    This likely makes most sense where the same test is used
    multiple times.


>---------------------------------------------------------------

4310564d3605007384b93c09851de80cbe924b89
 l3build-check.lua              |   86 ++++++++++++++++----------------
 l3build.dtx                    |    8 +--
 testfiles/00-test-2.luatex.tpf |  108 ++++++++++++++++++++++++++++++++++++++++
 testfiles/00-test-2.ptex.tpf   |   57 +++++++++++++++++++++
 testfiles/00-test-2.uptex.tpf  |   57 +++++++++++++++++++++
 testfiles/00-test-2.xetex.tpf  |   97 ++++++++++++++++++++++++++++++++++++
 6 files changed, 365 insertions(+), 48 deletions(-)

diff --git a/l3build-check.lua b/l3build-check.lua
index 919559c..46c26e0 100644
--- a/l3build-check.lua
+++ b/l3build-check.lua
@@ -533,6 +533,7 @@ end
 -- Run one test which may have multiple engine-dependent comparisons
 -- Should create a difference file for each failed test
 function runcheck(name, hide)
+  if not testexists(name) then return 1 end
   local checkengines = checkengines
   if options["engine"] then
     checkengines = options["engine"]
@@ -548,30 +549,25 @@ function runcheck(name, hide)
     return errorlevel
   end
   local errorlevel = 0
-  -- First check by log
-  if fileexists(testfiledir .. "/" .. name .. lvtext) then
-    for _,i in pairs(checkengines) do
-    -- Allow for luatex == luajittex for .tlg purposes
-      local engine = i
-      if i == "luajittex" then
-        engine = "luatex"
-      end
-      setup_check(name, engine)
-      local errlevel = 0
-      errlevel = check_and_diff(lvtext,i,engine,compare_tlg)
-      if errlevel ~= 0 and options["halt-on-error"] then
-        return 1
-      end
-      if errlevel > errorlevel then
-        errorlevel = errlevel
-      end
+  for _,engine in pairs(checkengines) do
+    local enginename = engine
+    -- Allow for luatex == luajittex for .tlg/.tpf purposes
+    if engine == "luajittex" then
+      engine = "luatex"
+    end
+    setup_check(name,engine)
+    local errlevel = 0
+    if fileexists(testfiledir .. "/" .. name .. lvtext) then
+      errlevel = check_and_diff(lvtext,engine,enginename,compare_tlg)
+    elseif fileexists(testfiledir .. "/" .. name .. pvtext) then
+      errlevel = check_and_diff(pvtext,engine,enginename,compare_pdf,true)
+    end
+    if errlevel ~= 0 and options["halt-on-error"] then
+      return 1
+    end
+    if errlevel > errorlevel then
+      errorlevel = errlevel
     end
-  end
-  -- Then check by PDF
-  if fileexists(testfiledir .. "/" .. name .. pvtext) then
-    setup_check(name, stdengine)
-    errorlevel = check_and_diff(pvtext,stdengine,stdengine,compare_pdf,true)
-      + errorlevel
   end
   -- Return everything
   return errorlevel
@@ -596,7 +592,7 @@ function setup_check(name, engine)
       )
       exit(1)
     end
-    runtest(name, engine, true, lveext, true, false)
+    runtest(name, engine, true, lveext)
     ren(testdir, testname .. logext, testname .. tlgext)
   else
     -- Install comparison files found
@@ -614,9 +610,9 @@ end
 
 function compare_pdf(name,engine,cleanup)
   local testname = name .. "." .. engine
-  local difffile = testdir .. "/" .. name .. pdfext .. os_diffext
+  local difffile = testdir .. "/" .. testname .. pdfext .. os_diffext
   local pdffile  = testdir .. "/" .. testname .. pdfext
-  local tpffile  = testdir .. "/" .. name .. tpfext
+  local tpffile  = locate({testdir}, {testname .. tpfext, name .. tpfext})
   if not tpffile then
     return 1
   end
@@ -793,6 +789,7 @@ function runtest(name, engine, hide, ext, pdfmode, breakout)
       end
     end
   end
+  return 0
 end
 
 -- A hook to allow additional tasks to run for the tests
@@ -950,36 +947,37 @@ function save(names)
     if testexists(name) then
       for _,engine in pairs(engines) do
         local testengine = ((engine == stdengine and "") or "." .. engine)        
-        if fileexists(testfiledir .. "/" .. name .. lvtext) then
-        -- Create one or more .tlg files        
-          print("Creating and copying " .. tlgext)
-          local tlgfile  = name .. testengine .. tlgext
-          local newfile  = name .. "." .. engine .. logext
-          runtest(name,engine,false,lvtext)
-          ren(testdir,newfile,tlgfile)
-          cp(tlgfile,testdir,testfiledir)
-          if fileexists(unpackdir .. "/" .. tlgfile) then
-            print("Saved " .. tlgext
+        local function save_test(test_ext,gen_ext,out_ext,pdfmode)
+          local out_file = name .. testengine .. out_ext
+          local gen_file = name .. "." .. engine .. gen_ext
+          print("Creating and copying " .. out_file)
+          runtest(name,engine,false,test_ext,pdfmode)
+          ren(testdir,gen_file,out_file)
+          cp(out_file,testdir,testfiledir)
+          if fileexists(unpackdir .. "/" .. out_file) then
+            print("Saved " .. out_ext
               .. " file overrides unpacked version of the same name")
+            return 1
           end
+          return 0
+        end
+        local errorlevel
+        if fileexists(testfiledir .. "/" .. name .. lvtext) then
+          errorlevel = save_test(lvtext,logext,tlgext)
         else
-          -- Create one .tpf file
-          print("Creating and copying " .. tpfext)
-          local tpffile  = name .. tpfext
-          local newfile  = name .. "." .. engine .. pdfext
-          runtest(name,engine,false,pvtext,true)
-          ren(testdir,newfile,tpffile)
-          cp(tpffile,testdir,testfiledir)
+          errorlevel = save_test(pvtext,pdfext,tpfext,true)
         end
-        return 0
+        if errorlevel ~=0 then return errorlevel end
       end
     elseif locate({unpackdir, testfiledir}, {name .. lveext}) then
       print("Saved " .. tlgext .. " file overrides a "
         .. lveext .. " file of the same name")
+      return 1
     else
       print('Test "'.. name .. '"not found')
       return 1     
     end
   end
+  return 0
 end
 
diff --git a/l3build.dtx b/l3build.dtx
index f15e1b9..231212a 100644
--- a/l3build.dtx
+++ b/l3build.dtx
@@ -1122,10 +1122,10 @@
 %   \item Removal of blank lines
 % \end{itemize}
 %
-% Testing on the result of typesetting \texttt{.pvt} files is carried out using
-% only the standard engine, as aspects of PDF files are not identical between
-% engines. To allow platform-independence, PDF-based tests must use only
-% Type1 or OpenType fonts: Type3 fonts are system-dependent.
+% To allow platform-independence, PDF-based tests must use only Type~1 or
+% OpenType fonts: Type3 fonts are system-dependent. PDF files are
+% engine-specific, thus one |.tpf| file should be stored per engine to be
+% tested.
 %
 % \section{Release-focussed features}
 %
diff --git a/testfiles/00-test-2.luatex.tpf b/testfiles/00-test-2.luatex.tpf
new file mode 100644
index 0000000..21892fe
--- /dev/null
+++ b/testfiles/00-test-2.luatex.tpf
@@ -0,0 +1,108 @@
+%PDF-1.5
+%ÐÔÅØ
+3 0 obj
+<</Length 120       >>
+stream
+BT
+/F16 9.96264 Tf 1 0 0 1 87.691 759.927 Tm [<004F00300057001D>]TJ
+1 0 0 1 82.461 747.972 Tm [<004F00300057001D>]TJ
+ET
+endstream
+endobj
+2 0 obj
+<</Type/Page/Contents 3 0 R/Resources 1 0 R/MediaBox[0 0 595.276 841.89]/Parent 5 0 R>>
+endobj
+1 0 obj
+<</Font<</F16 4 0 R>>/ProcSet[/PDF/Text]>>
+endobj
+6 0 obj
+[29[525]48[525]79[525]87[525]]
+endobj
+7 0 obj
+<</Length 11        >>
+[BINARY STREAM]
+endobj
+8 0 obj
+<</Subtype/CIDFontType0C/Length 1254      >>
+[BINARY STREAM]
+endobj
+9 0 obj
+<</Type/FontDescriptor/FontName/LWEKJG+LMMono10-Regular/Flags 4/FontBBox[-451 -316 731 1016]/Ascent 1016/CapHeight 611/Descent -316/ItalicAngle 0/StemV 175/XHeight 431/FontFile3 8 0 R/CIDSet 7 0 R>>
+endobj
+10 0 obj
+<</Length 729       >>
+stream
+%!PS-Adobe-3.0 Resource-CMap
+%%DocumentNeededResources: ProcSet (CIDInit)
+%%IncludeResource: ProcSet (CIDInit)
+%%BeginResource: CMap (TeX-LWEKJG-LMMono10-Regular-0)
+%%Title: (TeX-LWEKJG-LMMono10-Regular-0 TeX LWEKJG-LMMono10-Regular 0)
+%%Version: 1.000
+%%EndComments
+/CIDInit /ProcSet findresource begin
+12 dict begin
+begincmap
+/CIDSystemInfo
+<< /Registry (TeX)
+/Ordering (LWEKJG-LMMono10-Regular)
+/Supplement 0
+>> def
+/CMapName /TeX-Identity-LWEKJG-LMMono10-Regular def
+/CMapType 2 def
+1 begincodespacerange
+<0000> <FFFF>
+endcodespacerange
+0 beginbfrange
+endbfrange
+4 beginbfchar
+<001D> <0026>
+<0030> <0024>
+<004F> <0023>
+<0057> <0025>
+endbfchar
+endcmap
+CMapName currentdict /CMap defineresource pop
+end
+end
+%%EndResource
+%%EOF
+endstream
+endobj
+4 0 obj
+<</Type/Font/Subtype/Type0/Encoding/Identity-H/BaseFont/LWEKJG+LMMono10-Regular/DescendantFonts[11 0 R]/ToUnicode 10 0 R>>
+endobj
+11 0 obj
+<</Type/Font/Subtype/CIDFontType0/BaseFont/LWEKJG+LMMono10-Regular/FontDescriptor 9 0 R/W 6 0 R/CIDSystemInfo<</Registry (Adobe)/Ordering (Identity)/Supplement 0>>>>
+endobj
+5 0 obj
+<</Type/Pages /Count 1/Kids[2 0 R]>>
+endobj
+12 0 obj
+<</Type/Catalog/Pages 5 0 R>>
+endobj
+13 0 obj
+<<
+/Producer (LuaTeX)
+/Creator (TeX)/Trapped/False>>
+endobj
+xref
+0 14
+0000000000 65535 f 
+0000000294 00000 n 
+0000000191 00000 n 
+0000000015 00000 n 
+0000002797 00000 n 
+0000003117 00000 n 
+0000000352 00000 n 
+0000000398 00000 n 
+0000000465 00000 n 
+0000001797 00000 n 
+0000002011 00000 n 
+0000002935 00000 n 
+0000003169 00000 n 
+0000003215 00000 n 
+trailer
+<</Size 14/Root 12 0 R/Info 13 0 R/ID[<2EFA46759415D51C0244C6A720E97309> <2EFA46759415D51C0244C6A720E97309>]>>
+startxref
+3284
+%%EOF
diff --git a/testfiles/00-test-2.ptex.tpf b/testfiles/00-test-2.ptex.tpf
new file mode 100644
index 0000000..243ed47
--- /dev/null
+++ b/testfiles/00-test-2.ptex.tpf
@@ -0,0 +1,57 @@
+%PDF-1.5
+%äðíø
+5 0 obj
+<</Length 100>>
+stream
+ q 1 0 0 1 72 769.89 cm BT /F1 9.9626 Tf 15.691 -9.963 Td[(#$%&)]TJ -5.23 -11.955 Td[(#$%&)]TJ ET Q
+endstream
+endobj
+6 0 obj
+<</Font<</F1 4 0 R>>/ProcSet[/PDF/Text/ImageC/ImageB/ImageI]>>
+endobj
+3 0 obj
+<</Resources 6 0 R/Type/Page/Parent 7 0 R/Contents[5 0 R]>>
+endobj
+7 0 obj
+<</Type/Pages/Count 1/Kids[3 0 R]/MediaBox[0 0 595.28 841.89]>>
+endobj
+2 0 obj
+<</Creator(TeX)/Producer(dvipdfmx)/CreationDate(D:20160520090000-00'00')>>
+endobj
+1 0 obj
+<</Pages 7 0 R/Type/Catalog>>
+endobj
+8 0 obj
+[525 525 525 525]
+endobj
+9 0 obj
+<</Subtype/Type1C/Length 1021>>
+[BINARY STREAM]
+endobj
+4 0 obj
+<</Type/Font/Subtype/Type1/Widths 8 0 R/FirstChar 35/LastChar 38/BaseFont/APWWDF+CMTT10/FontDescriptor
+10 0 R>>
+endobj
+10 0 obj
+<</Type/FontDescriptor/CapHeight 611/Ascent 611/Descent -222/ItalicAngle 0/StemV
+69/Flags 6/FontBBox[-4 -233 537 696]/FontFile3 9 0 R/CharSet(/numbersign/dollar/percent/ampersand)/FontName/APWWDF+CMTT10>>
+endobj
+xref
+0 11
+0000000000 65535 f 
+0000000486 00000 n 
+0000000396 00000 n 
+0000000242 00000 n 
+0000001650 00000 n 
+0000000015 00000 n 
+0000000164 00000 n 
+0000000317 00000 n 
+0000000531 00000 n 
+0000000564 00000 n 
+0000001777 00000 n 
+trailer
+<</Root 1 0 R/Info 2 0 R/ID[<3ac55c091235ad23d6c25403368b8f1e><3ac55c091235ad23d6c25403368b8f1e>]/Size
+11>>
+startxref
+1998
+%%EOF
diff --git a/testfiles/00-test-2.uptex.tpf b/testfiles/00-test-2.uptex.tpf
new file mode 100644
index 0000000..243ed47
--- /dev/null
+++ b/testfiles/00-test-2.uptex.tpf
@@ -0,0 +1,57 @@
+%PDF-1.5
+%äðíø
+5 0 obj
+<</Length 100>>
+stream
+ q 1 0 0 1 72 769.89 cm BT /F1 9.9626 Tf 15.691 -9.963 Td[(#$%&)]TJ -5.23 -11.955 Td[(#$%&)]TJ ET Q
+endstream
+endobj
+6 0 obj
+<</Font<</F1 4 0 R>>/ProcSet[/PDF/Text/ImageC/ImageB/ImageI]>>
+endobj
+3 0 obj
+<</Resources 6 0 R/Type/Page/Parent 7 0 R/Contents[5 0 R]>>
+endobj
+7 0 obj
+<</Type/Pages/Count 1/Kids[3 0 R]/MediaBox[0 0 595.28 841.89]>>
+endobj
+2 0 obj
+<</Creator(TeX)/Producer(dvipdfmx)/CreationDate(D:20160520090000-00'00')>>
+endobj
+1 0 obj
+<</Pages 7 0 R/Type/Catalog>>
+endobj
+8 0 obj
+[525 525 525 525]
+endobj
+9 0 obj
+<</Subtype/Type1C/Length 1021>>
+[BINARY STREAM]
+endobj
+4 0 obj
+<</Type/Font/Subtype/Type1/Widths 8 0 R/FirstChar 35/LastChar 38/BaseFont/APWWDF+CMTT10/FontDescriptor
+10 0 R>>
+endobj
+10 0 obj
+<</Type/FontDescriptor/CapHeight 611/Ascent 611/Descent -222/ItalicAngle 0/StemV
+69/Flags 6/FontBBox[-4 -233 537 696]/FontFile3 9 0 R/CharSet(/numbersign/dollar/percent/ampersand)/FontName/APWWDF+CMTT10>>
+endobj
+xref
+0 11
+0000000000 65535 f 
+0000000486 00000 n 
+0000000396 00000 n 
+0000000242 00000 n 
+0000001650 00000 n 
+0000000015 00000 n 
+0000000164 00000 n 
+0000000317 00000 n 
+0000000531 00000 n 
+0000000564 00000 n 
+0000001777 00000 n 
+trailer
+<</Root 1 0 R/Info 2 0 R/ID[<3ac55c091235ad23d6c25403368b8f1e><3ac55c091235ad23d6c25403368b8f1e>]/Size
+11>>
+startxref
+1998
+%%EOF
diff --git a/testfiles/00-test-2.xetex.tpf b/testfiles/00-test-2.xetex.tpf
new file mode 100644
index 0000000..9a8486d
--- /dev/null
+++ b/testfiles/00-test-2.xetex.tpf
@@ -0,0 +1,97 @@
+%PDF-1.5
+%äðíø
+6 0 obj
+<</Length 124>>
+stream
+ q 1 0 0 1 72 769.89 cm BT /F1 9.9626 Tf 15.691 -9.963 Td[<004f00300057001d>]TJ -5.23 -11.955 Td[<004f00300057001d>]TJ ET Q
+endstream
+endobj
+7 0 obj
+<</Font<</F1 5 0 R>>/ProcSet[/PDF/Text/ImageC/ImageB/ImageI]>>
+endobj
+3 0 obj
+<</Resources 7 0 R/Type/Page/Parent 8 0 R/Contents[6 0 R]>>
+endobj
+8 0 obj
+<</Type/Pages/Count 1/Kids[3 0 R]/MediaBox[0 0 595.28 841.89]>>
+endobj
+2 0 obj
+<</Creator(TeX)/Producer(xdvipdfmx)/CreationDate(D:20160520090000-00'00')>>
+endobj
+1 0 obj
+<</Pages 8 0 R/Type/Catalog>>
+endobj
+9 0 obj
+<</Length 450>>
+stream
+/CIDInit /ProcSet findresource begin
+12 dict begin
+begincmap
+/CMapName /c:-texlive-2018-texmf-dist-fonts-opentype-public-lm-lmmono10-regular.otf,000-UTF16 def
+/CMapType 2 def
+/CIDSystemInfo <<
+  /Registry (Adobe)
+  /Ordering (UCS)
+  /Supplement 0
+>> def
+1 begincodespacerange
+<0000> <FFFF>
+endcodespacerange
+4 beginbfchar
+<001D> <0026>
+<0030> <0024>
+<004F> <0023>
+<0057> <0025>
+endbfchar
+endcmap
+CMapName currentdict /CMap defineresource pop
+end
+end
+endstream
+endobj
+11 0 obj
+<</Subtype/CIDFontType0C/Length 1229>>
+[BINARY STREAM]
+endobj
+12 0 obj
+[29[525]48[525]79[525]87[525]]
+endobj
+13 0 obj
+<</Length 11>>
+[BINARY STREAM]
+endobj
+4 0 obj
+<</Type/Font/Subtype/CIDFontType0/BaseFont/APWWDF+LMMono10-Regular/CIDSystemInfo<</Registry(Adobe)/Ordering(Identity)/Supplement
+0>>/FontDescriptor 10 0 R/DW 280/W 12 0 R>>
+endobj
+10 0 obj
+<</Type/FontDescriptor/Ascent 778/Descent -222/StemV 69/CapHeight 778/AvgWidth 500/FontBBox[-451
+-316 731 1016]/ItalicAngle 0/Flags 7/Style<</Panose<000000000509000000000000>>>/FontName/APWWDF+LMMono10-Regular/FontFile3
+11 0 R/CIDSet 13 0 R>>
+endobj
+5 0 obj
+<</Type/Font/Subtype/Type0/BaseFont/APWWDF+LMMono10-Regular-Identity-H/Encoding/Identity-H/DescendantFonts[4 0 R]/ToUnicode
+9 0 R>>
+endobj
+xref
+0 14
+0000000000 65535 f 
+0000000511 00000 n 
+0000000420 00000 n 
+0000000266 00000 n 
+0000002464 00000 n 
+0000002911 00000 n 
+0000000015 00000 n 
+0000000188 00000 n 
+0000000341 00000 n 
+0000000556 00000 n 
+0000002652 00000 n 
+0000001055 00000 n 
+0000002357 00000 n 
+0000002404 00000 n 
+trailer
+<</Root 1 0 R/Info 2 0 R/ID[<8ab21473a2ed67173943f0014488ccf6><8ab21473a2ed67173943f0014488ccf6>]/Size
+14>>
+startxref
+3058
+%%EOF





More information about the latex3-commits mailing list