[latex3-commits] [latex3/l3build] main: Improve log for failed checks with no diff files (8949ef3)

github at latex-project.org github at latex-project.org
Mon Nov 6 08:18:39 CET 2023


Repository : https://github.com/latex3/l3build
On branch  : main
Link       : https://github.com/latex3/l3build/commit/8949ef352358a895ae81f1d99765238456cde275

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

commit 8949ef352358a895ae81f1d99765238456cde275
Author: Yukai Chou <muzimuzhi at gmail.com>
Date:   Mon Nov 6 12:49:43 2023 +0800

    Improve log for failed checks with no diff files


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

8949ef352358a895ae81f1d99765238456cde275
 CHANGELOG.md      |  1 +
 l3build-check.lua | 26 +++++++++++++++++++++-----
 l3build.lua       | 11 +----------
 3 files changed, 23 insertions(+), 15 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index fcd5201..01371c4 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,6 +9,7 @@ this project uses date-based 'snapshot' version identifiers.
 
 ### Changed
 - Document default value of `ctanpkg` as a valid lua expression
+- Improve log for failed checks with no diff files
 
 ## [2023-11-01]
 
diff --git a/l3build-check.lua b/l3build-check.lua
index 3279f2c..91db26a 100644
--- a/l3build-check.lua
+++ b/l3build-check.lua
@@ -1031,7 +1031,7 @@ function check(names)
       end
     end
     if errorlevel ~= 0 then
-      checkdiff()
+      checkdiff() -- this leaves "config" parameter of "checkdiff()" nil
       if options["show-saves"] then
         showsavecommands(failurelist)
       end
@@ -1043,10 +1043,26 @@ function check(names)
 end
 
 -- A short auxiliary to print the list of differences for check
-function checkdiff()
-  print("\n  Check failed with difference files")
-  for _,i in ipairs(ordered_filelist(testdir, "*" .. os_diffext)) do
-    print("  - " .. testdir .. "/" .. i)
+function checkdiff(config)
+  local diff_files = ordered_filelist(testdir, "*" .. os_diffext)
+  if next(diff_files) then
+    if config then
+      print("Failed tests for configuration \"" .. config .. "\":")
+      local testdir = testdir
+      if config ~= "build" then
+        testdir = testdir .. "-" .. config
+      end
+    end
+    print("\n  Check failed with difference files")
+    for _,i in ipairs(diff_files) do
+      print("  - " .. testdir .. "/" .. i)
+    end
+  else
+    if config then
+      print("Check failed for configuration \"" .. config .. "\" with no difference files.")
+    else
+      print("Check failed with no difference files.")
+    end
   end
   print("")
 end
diff --git a/l3build.lua b/l3build.lua
index cf8f66c..146ded5 100644
--- a/l3build.lua
+++ b/l3build.lua
@@ -165,16 +165,7 @@ if #checkconfigs > 1 then
     end
     if next(failed) then
       for _,config in ipairs(failed) do
-        print("Failed tests for configuration \"" .. config .. "\":")
-        print("\n  Check failed with difference files")
-        local testdir = testdir
-        if config ~= "build" then
-          testdir = testdir .. "-" .. config
-        end
-        for _,i in ipairs(ordered_filelist(testdir,"*" .. os_diffext)) do
-          print("  - " .. testdir .. "/" .. i)
-        end
-        print("")
+        checkdiff(config)
       end
       if options["show-saves"] then
         local savecmds, recheckcmds = "", ""





More information about the latex3-commits mailing list.