[latex3-commits] [git/LaTeX3-latex3-l3build] master: New variables includetests/excludetests (fixes #49) (3aaedf4)

Joseph Wright joseph.wright at morningstar2.co.uk
Wed Aug 1 13:24:24 CEST 2018


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

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

commit 3aaedf41c7b32b8a21f91258b846a8259e6c5a2e
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Wed Aug 1 12:14:42 2018 +0100

    New variables includetests/excludetests (fixes #49)


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

3aaedf41c7b32b8a21f91258b846a8259e6c5a2e
 CHANGELOG.md          |    2 ++
 l3build-check.lua     |   38 ++++++++++++++++++++++++++++----------
 l3build-variables.lua |    4 ++++
 l3build.dtx           |   12 ++++++++++++
 4 files changed, 46 insertions(+), 10 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 71e933a..839c24f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -10,6 +10,8 @@ this project uses date-based 'snapshot' version identifiers.
 ### Added
 - `CHANGELOG.md`
 - `--dirty` option
+- `includetests` and `excludetests` variables for controlling which tests
+  run
 - `target_list` table to allow control of targets without redefining
   `main()`
 
diff --git a/l3build-check.lua b/l3build-check.lua
index d4af1dd..f9c9910 100644
--- a/l3build-check.lua
+++ b/l3build-check.lua
@@ -804,18 +804,36 @@ function check(names)
     names = names or { }
     -- No names passed: find all test files
     if not next(names) then
-      for _,i in pairs(filelist(testfiledir, "*" .. lvtext)) do
-        insert(names, jobname(i))
+      local excludenames = { }
+      for _,glob in pairs(excludetests) do
+        for _,name in pairs(filelist(testfiledir, glob .. lvtext)) do
+          excludenames[jobname(name)] = true
+        end
+        for _,name in pairs(filelist(unpackdir, glob .. lvtext)) do
+          excludenames[jobname(name)] = true
+        end
+        for _,name in pairs(filelist(testfiledir, glob .. pvtext)) do
+          excludenames[jobname(name)] = true
+        end
       end
-      for _,i in pairs(filelist(testfiledir, "*" .. pvtext)) do
-        insert(names, jobname(i))
+      local function addname(name)
+        if not excludenames[jobname(name)] then
+          insert(names,jobname(name))
+        end
       end
-      for _,i in ipairs(filelist(unpackdir, "*" .. lvtext)) do
-        if fileexists(testfiledir .. "/" .. i) then
-          print("Duplicate test file: " .. i)
-          return 1
-        else
-          insert(names, jobname(i))
+      for _,glob in pairs(includetests) do
+        for _,name in pairs(filelist(testfiledir, glob .. lvtext)) do
+          addname(name)
+        end
+        for _,name in pairs(filelist(testfiledir, glob .. pvtext)) do
+          addname(name)
+        end
+        for _,name in pairs(filelist(unpackdir, glob .. lvtext)) do
+          if fileexists(testfiledir .. "/" .. name) then
+            print("Duplicate test file: " .. i)
+            return 1
+          end
+          addname(name)
         end
       end
       sort(names)
diff --git a/l3build-variables.lua b/l3build-variables.lua
index 5a56c5a..98ce7fd 100644
--- a/l3build-variables.lua
+++ b/l3build-variables.lua
@@ -117,6 +117,10 @@ checkengines = checkengines or {"pdftex", "xetex", "luatex"}
 checkformat  = checkformat  or "latex"
 stdengine    = stdengine    or "pdftex"
 
+-- The tests themselves
+includetests = includetests or {"*"}
+excludetests = excludetests or { }
+
 -- Configs for testing
 checkconfigs = checkconfigs or {"build"}
 
diff --git a/l3build.dtx b/l3build.dtx
index 19447b4..7aea2e0 100644
--- a/l3build.dtx
+++ b/l3build.dtx
@@ -111,6 +111,9 @@
 \luavarset{pdfext}{".pdf"}{Extension of PDF file for checking and saving}
 \luavarset{psext} {".ps"} {Extension of PostScript files}
 \luavarseparator
+\luavarset{includetests}{\{"*"\}}{Test names to include when checking}
+\luavarset{excludetests}{\{\}}   {Test names to exclude when checking}
+\luavarseparator
 \luavarset{checkdeps}  {\{\}}{List of dependencies for running checks}
 \luavarset{typesetdeps}{\{\}}{List of dependencies for typesetting docs}
 \luavarset{unpackdeps} {\{\}}{List of dependencies for unpacking}
@@ -632,6 +635,15 @@
 %
 % \luavartypeset
 %
+% \subsection{Selective running of tests}
+%
+% The variables |includetests| and |excludetests| may be used to select which
+% tests are run: these variables take test \emph{names} not full file names.
+% The list of tests in |excludetests| overrides any matches in |includetests|,
+% meaning that tests can be disabled selectively. It also makes it possible
+% to disable test on for example a platform basis: the Lua core variable
+% |os.type| may be used to set |excludetests| only on some systems.
+%
 % \subsection{Multiple sets of tests}
 %
 % In most cases, a single set of tests will be appropriate for the module, with





More information about the latex3-commits mailing list