[latex3-commits] [git/LaTeX3-latex3-l3build] ordered-failure: Ordered output of test failures for l3build (3b53873)

Marcel Fabian Krüger tex at 2krueger.de
Tue Apr 12 15:17:14 CEST 2022


Repository : https://github.com/latex3/l3build
On branch  : ordered-failure
Link       : https://github.com/latex3/l3build/commit/3b538735955263bf4321382503e8194b987f68b7

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

commit 3b538735955263bf4321382503e8194b987f68b7
Author: Marcel Fabian Krüger <tex at 2krueger.de>
Date:   Tue Apr 12 15:16:55 2022 +0200

    Ordered output of test failures for l3build


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

3b538735955263bf4321382503e8194b987f68b7
 l3build-check.lua          | 12 ++++++------
 l3build-file-functions.lua |  5 +++++
 l3build-install.lua        |  4 ++--
 l3build.dtx                |  7 +++++++
 l3build.lua                |  2 +-
 5 files changed, 21 insertions(+), 9 deletions(-)

diff --git a/l3build-check.lua b/l3build-check.lua
index 94ffc67..2225005 100644
--- a/l3build-check.lua
+++ b/l3build-check.lua
@@ -827,7 +827,7 @@ function runtest(name, engine, hide, ext, test_type, breakout)
   test_type.rewrite(gen_file,new_file,engine,errlevels)
   -- Store secondary files for this engine
   for _,filetype in pairs(auxfiles) do
-    for _,file in pairs(filelist(testdir, filetype)) do
+    for _,file in ipairs(filelist(testdir, filetype)) do
       if match(file,"^" .. name .. "%.[^.]+$") then
         local newname = gsub(file,"(%.[^.]+)$","." .. engine .. "%1")
         if fileexists(testdir .. "/" .. newname) then
@@ -930,7 +930,7 @@ function check(names)
           excludepatterns[num_exclude] = glob_to_pattern(glob .. ext)
         end
         for _,glob in pairs(includetests) do
-          for _,name in pairs(filelist(testfiledir, glob .. ext)) do
+          for _,name in ipairs(filelist(testfiledir, glob .. ext)) do
             local exclude
             for i=1, num_exclude do
               if match(name, excludepatterns[i]) then
@@ -942,7 +942,7 @@ function check(names)
               insert(names,jobname(name))
             end
           end
-          for _,name in pairs(filelist(unpackdir, glob .. ext)) do
+          for _,name in ipairs(filelist(unpackdir, glob .. ext)) do
             local exclude
             for i=1, num_exclude do
               if not match(name, excludepatterns[i]) then
@@ -1027,7 +1027,7 @@ 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(filelist(testdir, "*" .. os_diffext)) do
+  for _,i in ipairs(ordered_filelist(testdir, "*" .. os_diffext)) do
     print("  - " .. testdir .. "/" .. i)
   end
   print("")
@@ -1035,7 +1035,7 @@ end
 
 function showfailedlog(name)
   print("\nCheck failed with log file")
-  for _,i in ipairs(filelist(testdir, name..".log")) do
+  for _,i in ipairs(ordered_filelist(testdir, name..".log")) do
     print("  - " .. testdir .. "/" .. i)
     print("")
     local f = open(testdir .. "/" .. i,"r")
@@ -1049,7 +1049,7 @@ end
 
 function showfaileddiff()
   print("\nCheck failed with difference file")
-  for _,i in ipairs(filelist(testdir, "*" .. os_diffext)) do
+  for _,i in ipairs(ordered_filelist(testdir, "*" .. os_diffext)) do
     print("  - " .. testdir .. "/" .. i)
     print("")
     local f = open(testdir .. "/" .. i,"r")
diff --git a/l3build-file-functions.lua b/l3build-file-functions.lua
index ca39333..dc5140a 100644
--- a/l3build-file-functions.lua
+++ b/l3build-file-functions.lua
@@ -283,6 +283,11 @@ function filelist(path, glob)
   end
   return files
 end
+function ordered_filelist(...)
+  local files = filelist(...)
+  table.sort(files)
+  return files
+end
 
 --- at class tree_entry_t
 --- at field src string path relative to the source directory
diff --git a/l3build-install.lua b/l3build-install.lua
index 6a28463..baea5a9 100644
--- a/l3build-install.lua
+++ b/l3build-install.lua
@@ -52,9 +52,9 @@ function uninstall()
     local installdir = gethome() .. "/" .. dir
     if options["dry-run"] then
       local files = filelist(installdir)
-      if next(files) then
+      if files[1] then
         print("\n" .. "For removal from " .. installdir .. ":")
-        for _,file in pairs(filelist(installdir)) do
+        for _,file in ipairs(ordered_filelist(installdir)) do
           print("- " .. file)
         end
       end
diff --git a/l3build.dtx b/l3build.dtx
index 6e6dde9..9d327fb 100644
--- a/l3build.dtx
+++ b/l3build.dtx
@@ -1743,6 +1743,13 @@
 %   all files in the \meta{path}.
 % \end{function}
 %
+% \begin{function}{ordered_filelist()}
+%   \begin{syntax}
+%     |ordered_filelist(|\meta{path}, \oarg{glob}|)|
+%   \end{syntax}
+%   Like |filelist()| but returning a sorted table.
+% \end{function}
+%
 % \begin{function}{glob_to_pattern()}
 %   \begin{syntax}
 %     |glob_to_pattern(|\meta{glob}|)|
diff --git a/l3build.lua b/l3build.lua
index 7556fb3..28c1bae 100644
--- a/l3build.lua
+++ b/l3build.lua
@@ -156,7 +156,7 @@ if #checkconfigs > 1 then
         if config ~= "build" then
           testdir = testdir .. "-" .. config
         end
-        for _,i in ipairs(filelist(testdir,"*" .. os_diffext)) do
+        for _,i in ipairs(ordered_filelist(testdir,"*" .. os_diffext)) do
           print("  - " .. testdir .. "/" .. i)
         end
         print("")





More information about the latex3-commits mailing list.