From 719d902b61ad27369a90b4bfdf9a31f651e6fd6e Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Sat, 7 Nov 2026 10:19:22 -1000 Subject: Decide every unit check skip in the shell Where a standalone Lua had no lpeg, the harness skipped the markdown and man checks itself, behind a note the test library hides, and the test passed on the six checks left. The real luaossl checks were left out the same way. Each now shows as a skip under a prerequisite named for the interpreter, and a misspelt mode fails rather than running the default. --- tests/extensions/lib.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'tests/extensions/lib.sh') diff --git a/tests/extensions/lib.sh b/tests/extensions/lib.sh index 8584446..56098d0 100644 --- a/tests/extensions/lib.sh +++ b/tests/extensions/lib.sh @@ -49,6 +49,24 @@ done # the count, as skipped, rather than vanishing from it. test -z "$interpreters" || test_set_prereq STANDALONE_LUA +# Leaves in lua_prereq the name of a prerequisite that holds when the +# interpreter given first can load every module named after it, so a check +# needing a module shows as skipped under an interpreter that lacks it. +lua_module_prereq() { + lua_prereq=$(printf '%s' "$*" | tr -c 'A-Za-z0-9' '_' | tr 'a-z' 'A-Z') + lua_prereq_bin=$1 + shift + lua_prereq_code= + for lua_prereq_module + do + lua_prereq_code="$lua_prereq_code require('$lua_prereq_module')" + done + if "$lua_prereq_bin" -e "$lua_prereq_code" >/dev/null 2>&1 + then + test_set_prereq "$lua_prereq" + fi +} + # Asks whether cgit's own Lua can require every module named, by pointing a # throwaway commit-filter at the given repository and reading its answer off # the rendered commit page. Filters need a page to run on, which is why a -- cgit 2.12.1