Diff options
Diffstat (limited to 'tests/extensions/lib.sh')
| -rw-r--r-- | tests/extensions/lib.sh | 18 |
1 file changed, 18 insertions, 0 deletions
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 |
