From 06dfccbccee2e3f47063cda4d8f376d49da04c57 Mon Sep 17 00:00:00 2001 From: Yukai Chou Date: Thu, 23 Feb 2023 18:39:11 +0800 Subject: [PATCH] Run engine sanity check per config --- CHANGELOG.md | 3 +++ l3build-arguments.lua | 8 ++++---- l3build.lua | 37 ++++++++++++++++++++----------------- 3 files changed, 27 insertions(+), 21 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dc3ce33d..17065815 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/l3build-arguments.lua b/l3build-arguments.lua index 49c80a75..76b661e2 100644 --- a/l3build-arguments.lua +++ b/l3build-arguments.lua @@ -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) diff --git a/l3build.lua b/l3build.lua index ff80523b..c66cd9a0 100644 --- a/l3build.lua +++ b/l3build.lua @@ -118,9 +118,6 @@ if options["epoch"] then end epoch = normalise_epoch(epoch) --- Sanity check -check_engines() - -- -- Deal with multiple configs for tests -- @@ -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