[latex3-commits] [latex3/l3build] main: Retain errorlevel on Windows during check target (35555b9)

github at latex-project.org github at latex-project.org
Mon Dec 11 17:20:00 CET 2023


Repository : https://github.com/latex3/l3build
On branch  : main
Link       : https://github.com/latex3/l3build/commit/35555b9e169623b71180cb2705598cd76c931b38

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

commit 35555b9e169623b71180cb2705598cd76c931b38
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Mon Dec 11 16:19:55 2023 +0000

     Retain errorlevel on Windows during check target
    
    See #324.


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

35555b9e169623b71180cb2705598cd76c931b38
 CHANGELOG.md      |  1 +
 l3build-check.lua | 40 ++++++++++++++++++++++++----------------
 2 files changed, 25 insertions(+), 16 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index ef5fdc2..b4916cc 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -14,6 +14,7 @@ this project uses date-based 'snapshot' version identifiers.
 
 ### Fixed
 - Short-circuit `check --rerun` if `testdir` doesn't exist
+- Retain errorlevel on Windows during `check` target
 
 ## [2023-11-01]
 
diff --git a/l3build-check.lua b/l3build-check.lua
index 5005042..75e2fc2 100644
--- a/l3build-check.lua
+++ b/l3build-check.lua
@@ -799,29 +799,37 @@ function runtest(name, engine, hide, ext, test_type, breakout)
   -- Ensure there is no stray .log file
   rmfile(testdir,name .. logext)
   local errlevels = {}
+  local preamble =
+    -- No use of localdir here as the files get copied to testdir:
+    -- avoids any paths in the logs
+    os_setenv .. " TEXINPUTS=." .. localtexmf()
+      .. (checksearch and os_pathsep or "")
+      .. os_concat ..
+    os_setenv .. " LUAINPUTS=." .. localtexmf()
+      .. (checksearch and os_pathsep or "")
+      .. os_concat ..
+    -- ensure epoch settings
+    set_epoch_cmd(epoch, forcecheckepoch) ..
+    -- Ensure lines are of a known length
+    os_setenv .. " max_print_line=" .. maxprintline
+      .. os_concat
   for i = 1, checkruns do
     errlevels[i] = runcmd(
-      -- No use of localdir here as the files get copied to testdir:
-      -- avoids any paths in the logs
-      os_setenv .. " TEXINPUTS=." .. localtexmf()
-        .. (checksearch and os_pathsep or "")
-        .. os_concat ..
-      os_setenv .. " LUAINPUTS=." .. localtexmf()
-        .. (checksearch and os_pathsep or "")
-        .. os_concat ..
-      -- ensure epoch settings
-      set_epoch_cmd(epoch, forcecheckepoch) ..
-      -- Ensure lines are of a known length
-      os_setenv .. " max_print_line=" .. maxprintline
-        .. os_concat ..
+      preamble ..
       binary .. format
         .. " " .. asciiopt .. " " .. checkopts
         .. setup(lvtfile)
-        .. (hide and (" > " .. os_null) or "")
-        .. os_concat ..
-      runtest_tasks(jobname(lvtfile),i),
+        .. (hide and (" > " .. os_null) or ""),
       testdir
     )
+    -- On Windows, concatenting here will suppress any non-zero errorlevel
+    -- from the main run, so we split into two parts.
+    if errlevels[i] == 0 then
+      local errorlevel =
+        runcmd(preamble .. runtest_tasks(jobname(lvtfile),i)
+        .. (hide and (" > " .. os_null) or ""),testdir)
+      if errorlevel ~= 0 then errlevels[i] = errorlevel end
+    end
     -- Break the loop if the result is stable
     if breakout and i < checkruns then
       if test_type.generated == pdfext then





More information about the latex3-commits mailing list.