From 5a84fce7e99699dd60753e925e53a942f5cea1d4 Mon Sep 17 00:00:00 2001 From: Yukai Chou Date: Mon, 6 Nov 2023 12:14:46 +0800 Subject: [PATCH] Short-circuit `check --rerun` if `testdir` doesn't exist --- CHANGELOG.md | 3 +++ l3build-check.lua | 9 ++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fcd5201..7cd3508 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,9 @@ this project uses date-based 'snapshot' version identifiers. ### Changed - Document default value of `ctanpkg` as a valid lua expression +### Fixed +- Short-circuit `check --rerun` if `testdir` doesn't exist + ## [2023-11-01] ### Changed diff --git a/l3build-check.lua b/l3build-check.lua index 3279f2c..851b426 100644 --- a/l3build-check.lua +++ b/l3build-check.lua @@ -926,7 +926,14 @@ end function check(names) local errorlevel = 0 if testfiledir ~= "" and direxists(testfiledir) then - if not options["rerun"] then + if options["rerun"] then + -- direxists() returns a boolean, not integer + errorlevel = direxists(testdir) and 0 or 1 + if errorlevel ~= 0 then + print("\n Test directory \"" .. testdir .. "\" doesn't exist. Try again without \"--rerun\".\n") + return errorlevel + end + else errorlevel = checkinit() if errorlevel ~= 0 then return errorlevel