Skip to content

Commit

Permalink
Run engine sanity check per config
Browse files Browse the repository at this point in the history
  • Loading branch information
muzimuzhi authored and josephwright committed Feb 26, 2023
1 parent 26a593f commit 06dfccb
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 21 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ this project uses date-based 'snapshot' version identifiers.

## [Unreleased]

### Changed
- Run engine sanity check per config

### Fixed
- Restore epoch settings for `dvitopdf()`
- Use plural form of variable `ps2pdfopts` consistently in code and doc, and
Expand Down
8 changes: 4 additions & 4 deletions l3build-arguments.lua
Original file line number Diff line number Diff line change
Expand Up @@ -291,16 +291,16 @@ end
options = argparse()

-- Sanity check
function check_engines()
function check_engines(config)
if options["engine"] and not options["force"] then
-- Make a lookup table
local t = { }
-- Make a lookup table
local t = { }
for _, engine in pairs(checkengines) do
t[engine] = true
end
for _, engine in pairs(options["engine"]) do
if not t[engine] then
print("\n! Error: Engine \"" .. engine .. "\" not set up for testing!")
print("\n! Error: Engine \"" .. engine .. "\" not set up for testing with configuration " .. config .. "!")
print("\n Valid values are:")
for _, engine in ipairs(checkengines) do
print(" - " .. engine)
Expand Down
37 changes: 20 additions & 17 deletions l3build.lua
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,6 @@ if options["epoch"] then
end
epoch = normalise_epoch(epoch)

-- Sanity check
check_engines()

--
-- Deal with multiple configs for tests
--
Expand Down Expand Up @@ -205,22 +202,28 @@ if #checkconfigs > 1 then
end
end
if #checkconfigs == 1 and
checkconfigs[1] ~= "build" and
(options["target"] == "check" or options["target"] == "save" or options["target"] == "clean") then
local configname = gsub(checkconfigs[1], "%.lua$", "")
local config = "./" .. configname .. ".lua"
if fileexists(config) then
local savedtestfiledir = testfiledir
dofile(config)
testdir = testdir .. "-" .. configname
-- Reset testsuppdir if required
if savedtestfiledir ~= testfiledir and
testsuppdir == savedtestfiledir .. "/support" then
testsuppdir = testfiledir .. "/support"
end
if checkconfigs[1] == "build" then
-- Sanity check for default config
check_engines("build.lua")
else
print("Error: Cannot find configuration " .. checkconfigs[1])
exit(1)
local configname = gsub(checkconfigs[1], "%.lua$", "")
local config = "./" .. configname .. ".lua"
if fileexists(config) then
local savedtestfiledir = testfiledir
dofile(config)
-- Sanity check for non-default config
check_engines(configname .. ".lua")
testdir = testdir .. "-" .. configname
-- Reset testsuppdir if required
if savedtestfiledir ~= testfiledir and
testsuppdir == savedtestfiledir .. "/support" then
testsuppdir = testfiledir .. "/support"
end
else
print("Error: Cannot find configuration " .. configname .. ".lua")
exit(1)
end
end
end

Expand Down

0 comments on commit 06dfccb

Please sign in to comment.