[latex3-commits] [git/LaTeX3-latex3-l3build] master: Add --show-log-on-error (aad3db8)

Will Robertson wspr81 at gmail.com
Sun Feb 17 14:26:25 CET 2019


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

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

commit aad3db86389d18921b2c0caedf6173e114553369
Author: Will Robertson <wspr81 at gmail.com>
Date:   Sun Feb 17 23:55:07 2019 +1030

    Add --show-log-on-error
    
    Mainly for debugging travis so no desire for a short switch
    
    closes #88


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

aad3db86389d18921b2c0caedf6173e114553369
 CHANGELOG.md          |    5 +++++
 l3build-arguments.lua |    5 +++++
 l3build-check.lua     |   23 +++++++++++++++++++++--
 l3build.dtx           |    4 +++-
 4 files changed, 34 insertions(+), 3 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index a93fef6..20fde74 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,6 +7,11 @@ this project uses date-based 'snapshot' version identifiers.
 
 ## [Unreleased]
 
+### Added
+
+- Switch `--show-log-on-error` for use with `--halt-on-error`. Results in the `.log` file
+  being show in full on the console to aid in non-interactive debugging.
+
 ## [2019-02-10]
 
 ### Fixed
diff --git a/l3build-arguments.lua b/l3build-arguments.lua
index 4b28cd0..cbf68c6 100644
--- a/l3build-arguments.lua
+++ b/l3build-arguments.lua
@@ -133,6 +133,11 @@ option_list =
         desc  = "Skip setup: simply rerun tests",
         type  = "boolean"
       },
+    ["show-log-on-error"] =
+      {
+        desc  = "If 'halt-on-error' stops, show the full log of the failure",
+        type  = "boolean"
+      },
     shuffle =
       {
         desc  = "Shuffle order of tests",
diff --git a/l3build-check.lua b/l3build-check.lua
index 96c5d71..5e489df 100644
--- a/l3build-check.lua
+++ b/l3build-check.lua
@@ -544,9 +544,14 @@ function runcheck(name, hide)
   local function check_and_diff(ext,engine,comp,pdftest)
     runtest(name,engine,hide,ext,pdftest,true)
     local errorlevel = comp(name,engine)
-    if errorlevel ~= 0 and options["halt-on-error"] then
+    if errorlevel == 0 then
+      return errorlevel
+    end
+    if options["show-log-on-error"] then
+      showfailedlog(name)
+    end
+    if options["halt-on-error"] then
       showfaileddiff()
-      return 1
     end
     return errorlevel
   end
@@ -907,6 +912,20 @@ function checkdiff()
   print("")
 end
 
+function showfailedlog(name)
+  print("\nCheck failed with log file")
+  for _,i in ipairs(filelist(testdir, name..".log")) do
+    print("  - " .. testdir .. "/" .. i)
+    print("")
+    local f = open(testdir .. "/" .. i,"r")
+    local content = f:read("*all")
+    close(f)
+    print("-----------------------------------------------------------------------------------")
+    print(content)
+    print("-----------------------------------------------------------------------------------")
+  end
+end
+
 function showfaileddiff()
   print("\nCheck failed with difference file")
   for _,i in ipairs(filelist(testdir, "*" .. os_diffext)) do
diff --git a/l3build.dtx b/l3build.dtx
index 37e84a7..6815f60 100644
--- a/l3build.dtx
+++ b/l3build.dtx
@@ -352,10 +352,12 @@
 % \item |--halt-on-error| (|-H|) Specifies that checks
 %   should stop as soon as possible, rather than running all requested
 %   tests; the difference file is printed in the terminal directly in the case of failure
-%  \item |--last| Name of the last test to run
+% \item |--last| Name of the last test to run
 % \item |--message| (|-m|) Text for upload announcement
 % \item |--quiet| (|-q|) Suppresses output from unpacking
 % \item |--rerun| Run tests without unpacking/set up
+% \item |--show-log-on-error| To be used in addition to \textt{--halt-on-error} and results
+%   in the full \texttt{.log} file of a failed test to be shown on the console
 % \item |--shuffle| Shuffle the order in which tests run
 % \item |--texmfhome| Sets the location of the user tree for installing
 % \end{itemize}





More information about the latex3-commits mailing list