Diff options
| author | Bryce Kwon <bryce@brycekwon.com> | |
|---|---|---|
| committer | Bryce Kwon <bryce@brycekwon.com> | |
| commit | ||
| parent | ||
| tree | ||
| download | ||
Run each standalone Lua version once
A plain lua is usually one of the versioned names again, as lua and
lua5.5 are here, so every 5.5 check ran twice, while names such as
lua54 and lua-5.4 were never looked for. A test now names the version
that ran, since "under lua" did not say which one it was.
| -rw-r--r-- | tests/extensions/lib.sh | 32 | |
| -rwxr-xr-x | tests/t0501-about-render.sh | 4 | |
| -rwxr-xr-x | tests/t0502-syntax-highlight.sh | 4 | |
| -rwxr-xr-x | tests/t0503-link-commits.sh | 2 | |
| -rwxr-xr-x | tests/t0504-email-avatar.sh | 6 | |
| -rwxr-xr-x | tests/t0506-link-trailers.sh | 2 |
6 files changed, 36 insertions, 14 deletions
diff --git a/tests/extensions/lib.sh b/tests/extensions/lib.sh index 4ca7522..d490655 100644 --- a/tests/extensions/lib.sh +++ b/tests/extensions/lib.sh @@ -8,18 +8,40 @@ EXTENSIONS_DIRECTORY=$(cd "$TEST_OUTPUT_DIRECTORY/../custom/extensions" && pwd) EXT_TEST_DIRECTORY=$(cd "$TEST_OUTPUT_DIRECTORY/extensions" && pwd) +# Prints the version an interpreter reports, LuaJIT by its own name rather +# than the 5.1 it is compatible with, or the name it was given when it does +# not run. +lua_version() { + "$1" -e 'io.write(jit and jit.version or _VERSION)' 2>/dev/null || + printf '%s' "$1" +} + # The interpreters on the path whose version the extensions claim, 5.1 to # 5.5 with LuaJIT counting as 5.1, so no script is failed on a version it -# never claimed to run on. +# never claimed to run on. Systems spell a versioned name in one of three +# ways, and a plain lua is usually one of those again, so each version runs +# once, under the first name found for it. interpreters= -for ext_lua_bin in luajit lua5.1 lua5.2 lua5.3 lua5.4 lua5.5 lua +ext_lua_versions= +for ext_lua_bin in luajit lua5.1 lua51 lua-5.1 lua5.2 lua52 lua-5.2 \ + lua5.3 lua53 lua-5.3 lua5.4 lua54 lua-5.4 lua5.5 lua55 lua-5.5 lua do command -v "$ext_lua_bin" >/dev/null 2>&1 || continue - case "$("$ext_lua_bin" -e 'io.write(_VERSION)' 2>/dev/null)" in - "Lua 5."[1-5]) - interpreters="$interpreters $ext_lua_bin" + ext_lua_version=$(lua_version "$ext_lua_bin") + case "$ext_lua_version" in + "Lua 5."[1-5]|"LuaJIT 2."*) + ;; + *) + continue + ;; + esac + case "$ext_lua_versions" in + *"|$ext_lua_version|"*) + continue ;; esac + ext_lua_versions="$ext_lua_versions|$ext_lua_version|" + interpreters="$interpreters $ext_lua_bin" done test -n "$interpreters" || say 'no standalone lua on the path, unit checks skipped' diff --git a/tests/t0501-about-render.sh b/tests/t0501-about-render.sh index 2cf84ed..94c5e82 100755 --- a/tests/t0501-about-render.sh +++ b/tests/t0501-about-render.sh @@ -15,11 +15,11 @@ CGIT_TEST_NO_CREATE_REPOS=YesPlease for lua in $interpreters do - test_expect_success "unit checks under $lua" " + test_expect_success "unit checks under $(lua_version "$lua")" " '$lua' '$EXT_TEST_DIRECTORY/test-about-render.lua' '$EXTENSIONS_DIRECTORY/about-render.lua' " - test_expect_success "fallback checks without lpeg under $lua" " + test_expect_success "fallback checks without lpeg under $(lua_version "$lua")" " '$lua' '$EXT_TEST_DIRECTORY/test-about-render.lua' '$EXTENSIONS_DIRECTORY/about-render.lua' nolpeg " done diff --git a/tests/t0502-syntax-highlight.sh b/tests/t0502-syntax-highlight.sh index 4b32f82..2d929e4 100755 --- a/tests/t0502-syntax-highlight.sh +++ b/tests/t0502-syntax-highlight.sh @@ -17,13 +17,13 @@ CGIT_TEST_NO_CREATE_REPOS=YesPlease for lua in $interpreters do - test_expect_success "highlighting checks under $lua" " + test_expect_success "highlighting checks under $(lua_version "$lua")" " CGIT_SCINTILLUA_PATH='$EXT_TEST_DIRECTORY/fake-lexers' \ '$lua' '$EXT_TEST_DIRECTORY/test-syntax-highlight.lua' \ '$EXTENSIONS_DIRECTORY/syntax-highlight.lua' highlight " - test_expect_success "fallback checks without lexers under $lua" " + test_expect_success "fallback checks without lexers under $(lua_version "$lua")" " mkdir -p empty-lexers && CGIT_SCINTILLUA_PATH=\"\$PWD/empty-lexers\" \ '$lua' '$EXT_TEST_DIRECTORY/test-syntax-highlight.lua' \ diff --git a/tests/t0503-link-commits.sh b/tests/t0503-link-commits.sh index 06f54dc..32f8d3e 100755 --- a/tests/t0503-link-commits.sh +++ b/tests/t0503-link-commits.sh @@ -13,7 +13,7 @@ CGIT_TEST_NO_CREATE_REPOS=YesPlease for lua in $interpreters do - test_expect_success "unit checks under $lua" " + test_expect_success "unit checks under $(lua_version "$lua")" " '$lua' '$EXT_TEST_DIRECTORY/test-link-commits.lua' '$EXTENSIONS_DIRECTORY/link-commits.lua' " done diff --git a/tests/t0504-email-avatar.sh b/tests/t0504-email-avatar.sh index b584f3e..10b9fca 100755 --- a/tests/t0504-email-avatar.sh +++ b/tests/t0504-email-avatar.sh @@ -18,16 +18,16 @@ for lua in $interpreters do for script in email-gravatar email-libravatar do - test_expect_success "$script checks under $lua" " + test_expect_success "$script checks under $(lua_version "$lua")" " '$lua' '$EXT_TEST_DIRECTORY/test-email-avatar.lua' '$EXTENSIONS_DIRECTORY/$script.lua' stub " - test_expect_success "$script checks without luaossl under $lua" " + test_expect_success "$script checks without luaossl under $(lua_version "$lua")" " '$lua' '$EXT_TEST_DIRECTORY/test-email-avatar.lua' '$EXTENSIONS_DIRECTORY/$script.lua' missing " if "$lua" -e "require([[openssl.digest]])" >/dev/null 2>&1 then - test_expect_success "$script checks with real luaossl under $lua" " + test_expect_success "$script checks with real luaossl under $(lua_version "$lua")" " '$lua' '$EXT_TEST_DIRECTORY/test-email-avatar.lua' '$EXTENSIONS_DIRECTORY/$script.lua' real " fi diff --git a/tests/t0506-link-trailers.sh b/tests/t0506-link-trailers.sh index 42c65fd..7faafca 100755 --- a/tests/t0506-link-trailers.sh +++ b/tests/t0506-link-trailers.sh @@ -13,7 +13,7 @@ CGIT_TEST_NO_CREATE_REPOS=YesPlease for lua in $interpreters do - test_expect_success "unit checks under $lua" " + test_expect_success "unit checks under $(lua_version "$lua")" " '$lua' '$EXT_TEST_DIRECTORY/test-link-trailers.lua' '$EXTENSIONS_DIRECTORY/link-trailers.lua' " done |
