tests: run tests on Lua 5.4 and LuaJIT 2.1

master
Hisham Muhammad 2022-04-16 18:53:07 -03:00
parent a405d1a5f6
commit 0f82063a51
21 changed files with 233 additions and 82 deletions

View File

@ -43,7 +43,7 @@ jobs:
TestMatrix:
strategy:
matrix:
lua-version: ["5.3", "luajit"]
lua-version: ["5.4", "luajit"]
os: ["ubuntu-latest", "macos-latest"]
runs-on: ${{ matrix.os }}
@ -96,7 +96,7 @@ jobs:
- uses: leafo/gh-actions-lua@v8.0.0
with:
luaVersion: "5.3"
luaVersion: "5.4"
- name: Smoke Test
run: |

View File

@ -9,50 +9,18 @@ environment:
LUAROCKS_VER: 3.0.0
matrix:
# Lua 5.1 tests
- LUAV: "5.1"
# Lua 5.4 tests
- LUAV: "5.4"
LUAT: "lua"
COMPILER: "vs"
FILES: ""
EXCLUDE: "integration"
- LUAV: "5.1"
- LUAV: "5.4"
LUAT: "lua"
COMPILER: "vs"
FILES: ""
EXCLUDE: "unit"
- LUAV: "5.1"
LUAT: "lua"
COMPILER: "mingw"
FILES: "spec//build_spec.lua"
EXCLUDE: ""
# Lua 5.2 tests
- LUAV: "5.2"
LUAT: "lua"
COMPILER: "vs"
FILES: ""
EXCLUDE: "integration"
- LUAV: "5.2"
LUAT: "lua"
COMPILER: "vs"
FILES: ""
EXCLUDE: "unit"
- LUAV: "5.2"
LUAT: "lua"
COMPILER: "mingw"
FILES: "spec//build_spec.lua"
EXCLUDE: ""
# Lua 5.3 tests
- LUAV: "5.3"
LUAT: "lua"
COMPILER: "vs"
FILES: ""
EXCLUDE: "integration"
- LUAV: "5.3"
LUAT: "lua"
COMPILER: "vs"
FILES: ""
EXCLUDE: "unit"
- LUAV: "5.3"
- LUAV: "5.4"
LUAT: "lua"
COMPILER: "mingw"
FILES: "spec//build_spec.lua"
@ -82,7 +50,9 @@ init:
- set PATH=C:\MinGW\bin;%PATH%
before_build:
- set PATH=C:\Python37\Scripts;%PATH% # Add directory containing 'pip' to PATH
- set PATH=C:\Python37;C:\Python37\Scripts;%PATH% # Add directory containing 'pip' to PATH
- IF NOT EXIST lua_install-%LUAV%\bin\activate.bat ( pip install --upgrade certifi )
- FOR /F "tokens=* USEBACKQ" %%F IN (`python -c "import certifi;print(certifi.where())"`) DO ( SET SSL_CERT_FILE=%%F )
- IF NOT EXIST lua_install-%LUAV%\bin\activate.bat ( pip install hererocks )
- IF NOT EXIST lua_install-%LUAV%\bin\activate.bat ( hererocks lua_install-%LUAV% --%LUAT% %LUAV% --luarocks latest --target=%COMPILER% )
- call lua_install-%LUAV%\bin\activate
@ -101,16 +71,10 @@ after_test:
- cd testrun && codecov -f luacov.report.out -X gcov
cache:
- lua_install-5.1
- lua_install-5.2
- lua_install-5.3
- lua_install-5.4
- lua_install-2.1
- testrun/testing_cache-5.1
- testrun/testing_cache-5.2
- testrun/testing_cache-5.3
- testrun/testing_cache-5.4
- testrun/testing_cache-2.1
- testrun/testing_server-5.1
- testrun/testing_server-5.2
- testrun/testing_server-5.3
- testrun/testing_server-5.4
- testrun/testing_server-2.1
- testrun/binary-samples

View File

@ -1,7 +1,7 @@
package = "lua-zlib"
version = "1.2-0"
source = {
url = "git://github.com/brimworks/lua-zlib.git",
url = "git+https://github.com/brimworks/lua-zlib.git",
tag = "v1.2",
}
description = {

View File

@ -22,7 +22,6 @@ local extra_rocks = {
"/luafilesystem-${LUAFILESYSTEM}.src.rock",
"/luasocket-${LUASOCKET}.src.rock",
"/luasocket-${LUASOCKET}.rockspec",
"/stdlib-41.0.0-1.src.rock",
"spec/fixtures/a_rock-1.0-1.src.rock",
"/busted-2.0.0-1.rockspec",
"/busted-2.0.rc13-0.rockspec",
@ -141,11 +140,6 @@ describe("LuaRocks build #integration", function()
assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/luacov/${LUACOV}/luacov-${LUACOV}.rockspec"))
end)
it("command stdlib", function()
assert.is_true(run.luarocks_bool("build stdlib"))
assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/stdlib/41.0.0-1/stdlib-41.0.0-1.rockspec"))
end)
it("fails if the current platform is not supported", function()
test_env.run_in_tmp(function(tmpdir)
write_file("test-1.0-1.rockspec", [[
@ -273,13 +267,14 @@ describe("LuaRocks build #integration", function()
end)
it("lmathx deps partial match", function()
assert.is_true(run.luarocks_bool("build lmathx"))
if test_env.LUA_V == "5.1" or test_env.LUAJIT_V then
assert.is_true(run.luarocks_bool("build lmathx"))
assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/lmathx/20120430.51-1/lmathx-20120430.51-1.rockspec"))
elseif test_env.LUA_V == "5.2" then
assert.is_true(run.luarocks_bool("build lmathx"))
assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/lmathx/20120430.52-1/lmathx-20120430.52-1.rockspec"))
elseif test_env.LUA_V == "5.3" then
assert.is_true(run.luarocks_bool("build lmathx"))
assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/lmathx/20150505-1/lmathx-20150505-1.rockspec"))
end
end)

View File

@ -68,5 +68,23 @@ repository = {
arch = "src"
}
}
},
non_lua_file = {
["1.0-1"] = {
{
arch = "rockspec"
},
{
arch = "src"
}
},
["1.0-2"] = {
{
arch = "rockspec"
},
{
arch = "src"
}
}
}
}

View File

@ -68,5 +68,23 @@ repository = {
arch = "src"
}
}
},
non_lua_file = {
["1.0-1"] = {
{
arch = "rockspec"
},
{
arch = "src"
}
},
["1.0-2"] = {
{
arch = "rockspec"
},
{
arch = "src"
}
}
}
}

Binary file not shown.

View File

@ -68,5 +68,23 @@ repository = {
arch = "src"
}
}
},
non_lua_file = {
["1.0-1"] = {
{
arch = "rockspec"
},
{
arch = "src"
}
},
["1.0-2"] = {
{
arch = "rockspec"
},
{
arch = "src"
}
}
}
}

Binary file not shown.

View File

@ -68,5 +68,23 @@ repository = {
arch = "src"
}
}
},
non_lua_file = {
["1.0-1"] = {
{
arch = "rockspec"
},
{
arch = "src"
}
},
["1.0-2"] = {
{
arch = "rockspec"
},
{
arch = "src"
}
}
}
}

Binary file not shown.

90
spec/fixtures/a_repo/manifest-5.4 vendored Normal file
View File

@ -0,0 +1,90 @@
commands = {}
modules = {}
repository = {
a_build_dep = {
["1.0-1"] = {
{
arch = "src"
},
{
arch = "rockspec"
}
}
},
a_rock = {
["1.0-1"] = {
{
arch = "src"
},
{
arch = "rockspec"
}
},
["2.0-1"] = {
{
arch = "src"
}
}
},
busted_project = {
["0.1-1"] = {
{
arch = "src"
},
{
arch = "rockspec"
}
}
},
has_another_namespaced_dep = {
["1.0-1"] = {
{
arch = "rockspec"
},
{
arch = "src"
}
}
},
has_build_dep = {
["1.0-1"] = {
{
arch = "rockspec"
},
{
arch = "src"
},
{
arch = "all"
}
}
},
has_namespaced_dep = {
["1.0-1"] = {
{
arch = "rockspec"
},
{
arch = "src"
}
}
},
non_lua_file = {
["1.0-1"] = {
{
arch = "rockspec"
},
{
arch = "src"
}
},
["1.0-2"] = {
{
arch = "rockspec"
},
{
arch = "src"
}
}
}
}

BIN
spec/fixtures/a_repo/manifest-5.4.zip vendored Normal file

Binary file not shown.

View File

@ -0,0 +1,14 @@
commands = {}
modules = {}
repository = {
a_rock = {
["2.0-1"] = {
{
arch = "rockspec"
},
{
arch = "src"
}
}
}
}

View File

@ -0,0 +1,14 @@
commands = {}
modules = {}
repository = {
a_rock = {
["3.0-1"] = {
{
arch = "src"
},
{
arch = "rockspec"
}
}
}
}

View File

@ -92,13 +92,13 @@ describe("luarocks init #integration", function()
lfs.mkdir(myproject)
lfs.chdir(myproject)
assert(run.luarocks("init --lua-versions=5.1,5.2,5.3"))
assert(run.luarocks("init --lua-versions=5.1,5.2,5.3,5.4"))
local rockspec_name = myproject .. "/myproject-dev-1.rockspec"
assert.truthy(lfs.attributes(rockspec_name))
local fd = assert(io.open(rockspec_name, "rb"))
local data = fd:read("*a")
fd:close()
assert.truthy(data:find("lua >= 5.1, < 5.4", 1, true))
assert.truthy(data:find("lua >= 5.1, < 5.5", 1, true))
end, finally)
end)

View File

@ -10,8 +10,8 @@ local V = test_env.V
test_env.unload_luarocks()
local extra_rocks = {
"/cprint-0.1-2.src.rock",
"/cprint-0.1-2.rockspec",
"/cprint-${CPRINT}.src.rock",
"/cprint-${CPRINT}.rockspec",
"/lpeg-${LPEG}.src.rock",
"/luassert-1.7.0-1.src.rock",
"/luasocket-${LUASOCKET}.src.rock",
@ -248,8 +248,8 @@ describe("luarocks install #integration", function()
it("binary rock of cprint", function()
assert.is_true(run.luarocks_bool("build --pack-binary-rock cprint"))
assert.is_true(run.luarocks_bool("install cprint-0.1-2." .. test_env.platform .. ".rock"))
assert.is_true(os.remove("cprint-0.1-2." .. test_env.platform .. ".rock"))
assert.is_true(run.luarocks_bool("install cprint-${CPRINT}." .. test_env.platform .. ".rock"))
assert.is_true(os.remove("cprint-${CPRINT}." .. test_env.platform .. ".rock"))
end)
it("accepts --no-manifest flag", function()

View File

@ -12,7 +12,7 @@ local extra_rocks = {
"/lua_cliargs-3.0-1.src.rock",
"/luafilesystem-${LUAFILESYSTEM}.src.rock",
"/luasystem-0.2.1-0.src.rock",
"/dkjson-2.5-2.src.rock",
"/dkjson-${DKJSON}.src.rock",
"/say-1.3-1.rockspec",
"/luassert-1.8.0-0.rockspec",
"/lua-term-0.7-1.rockspec",

View File

@ -1,12 +1,13 @@
local test_env = require("spec.util.test_env")
local lfs = require("lfs")
local run = test_env.run
local testing_paths = test_env.testing_paths
test_env.unload_luarocks()
local extra_rocks = {
"/cprint-0.1-2.src.rock",
"/cprint-0.1-2.rockspec",
"/cprint-${CPRINT}.src.rock",
"/cprint-${CPRINT}.rockspec",
"/luazip-1.2.4-1.rockspec"
}
@ -33,22 +34,22 @@ describe("luarocks unpack #integration", function()
describe("more complex tests", function()
it("download", function()
assert.is_true(run.luarocks_bool("unpack cprint"))
test_env.remove_dir("cprint-0.1-2")
test_env.remove_dir("cprint-${CPRINT}")
end)
it("src", function()
assert.is_true(run.luarocks_bool("download --source cprint"))
assert.is_true(run.luarocks_bool("unpack cprint-0.1-2.src.rock"))
os.remove("cprint-0.1-2.src.rock")
test_env.remove_dir("cprint-0.1-2")
assert.is_true(run.luarocks_bool("unpack cprint-${CPRINT}.src.rock"))
os.remove("cprint-${CPRINT}.src.rock")
test_env.remove_dir("cprint-${CPRINT}")
end)
it("src", function()
assert.is_true(run.luarocks_bool("download --rockspec cprint"))
assert.is_true(run.luarocks_bool("unpack cprint-0.1-2.rockspec"))
os.remove("cprint-0.1-2.rockspec")
assert.is_true(run.luarocks_bool("unpack cprint-${CPRINT}.rockspec"))
os.remove("cprint-${CPRINT}.rockspec")
os.remove("lua-cprint")
test_env.remove_dir("cprint-0.1-2")
test_env.remove_dir("cprint-${CPRINT}")
end)
-- #595 luarocks unpack of a git:// rockspec fails to copy the rockspec
@ -62,9 +63,9 @@ describe("luarocks unpack #integration", function()
it("binary", function()
assert.is_true(run.luarocks_bool("build cprint"))
assert.is_true(run.luarocks_bool("pack cprint"))
assert.is_true(run.luarocks_bool("unpack cprint-0.1-2." .. test_env.platform .. ".rock"))
test_env.remove_dir("cprint-0.1-2")
os.remove("cprint-0.1-2." .. test_env.platform .. ".rock")
assert.is_true(run.luarocks_bool("unpack cprint-${CPRINT}." .. test_env.platform .. ".rock"))
test_env.remove_dir("cprint-${CPRINT}")
os.remove("cprint-${CPRINT}." .. test_env.platform .. ".rock")
end)
end)
end)

View File

@ -446,7 +446,7 @@ local function download_rocks(urls, save_path)
else
-- check if already downloaded
if not test_env.exists(save_path .. "/" .. url) then
table.insert(to_download, luarocks_repo .. url)
table.insert(to_download, ((luarocks_repo .. url):gsub("org//", "org/")))
end
end
end
@ -972,7 +972,7 @@ local function prepare_mock_server_binary_rocks()
"wsapi-1.6.1-1.src.rock",
"rings-1.3.0-1.src.rock",
"wsapi-xavante-1.6.1-1.src.rock",
"dkjson-2.5-2.src.rock",
"dkjson-${DKJSON}.src.rock",
"restserver-0.1-1.src.rock",
"restserver-xavante-0.2-1.src.rock",
}
@ -1019,9 +1019,8 @@ function test_env.main()
table.insert(urls, "/luasocket-${LUASOCKET}.src.rock")
table.insert(urls, "/luasocket-${LUASOCKET}.rockspec")
table.insert(urls, "/md5-1.2-1.src.rock")
--table.insert(urls, "/lzlib-0.4.1.53-1.src.rock")
table.insert(urls, "/lua-zlib-1.2-0.src.rock")
table.insert(urls, "/lua-bz2-0.1.0-1.src.rock")
table.insert(urls, "/manifests/hisham/lua-zlib-1.2-0.src.rock")
table.insert(urls, "/manifests/hisham/lua-bz2-0.2.1.1-1.src.rock")
rocks = {"luafilesystem", "luasocket", "md5", "lua-zlib", "lua-bz2"}
if test_env.TEST_TARGET_OS ~= "windows" then
if test_env.lua_version == "5.1" then

View File

@ -2,7 +2,9 @@ return {
binaryheap = "0.4-1", -- dependency for copas
bit32 = "5.3.5.1-1", -- dependency for luaposix on Lua 5.1
cluacov = "0.1.2-1",
copas = "3.0.0-1",
copas = "3.0.0-2",
cprint = "0.2-1",
dkjson = "2.6-1",
lpeg = "1.0.0-1",
luacov = "0.15.0-1",
luafilesystem = "1.8.0-1",