From 0f82063a51cd9197edd214e0427fe4e84ae9c0b9 Mon Sep 17 00:00:00 2001 From: Hisham Muhammad Date: Sat, 16 Apr 2022 18:53:07 -0300 Subject: tests: run tests on Lua 5.4 and LuaJIT 2.1 --- .github/workflows/test.yml | 4 +- appveyor.yml | 56 +++---------- binary/lua-zlib-1.2-0.rockspec | 2 +- spec/build_spec.lua | 11 +-- spec/fixtures/a_repo/manifest | 18 +++++ spec/fixtures/a_repo/manifest-5.1 | 18 +++++ spec/fixtures/a_repo/manifest-5.1.zip | Bin 358 -> 343 bytes spec/fixtures/a_repo/manifest-5.2 | 18 +++++ spec/fixtures/a_repo/manifest-5.2.zip | Bin 358 -> 343 bytes spec/fixtures/a_repo/manifest-5.3 | 18 +++++ spec/fixtures/a_repo/manifest-5.3.zip | Bin 358 -> 343 bytes spec/fixtures/a_repo/manifest-5.4 | 90 +++++++++++++++++++++ spec/fixtures/a_repo/manifest-5.4.zip | Bin 0 -> 343 bytes spec/fixtures/a_repo/manifests/a_user/manifest-5.4 | 14 ++++ .../a_repo/manifests/another_user/manifest-5.4 | 14 ++++ spec/init_spec.lua | 4 +- spec/install_spec.lua | 8 +- spec/test_spec.lua | 2 +- spec/unpack_spec.lua | 25 +++--- spec/util/test_env.lua | 9 +-- spec/util/versions.lua | 4 +- 21 files changed, 233 insertions(+), 82 deletions(-) create mode 100644 spec/fixtures/a_repo/manifest-5.4 create mode 100644 spec/fixtures/a_repo/manifest-5.4.zip create mode 100644 spec/fixtures/a_repo/manifests/a_user/manifest-5.4 create mode 100644 spec/fixtures/a_repo/manifests/another_user/manifest-5.4 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 370afb32..c5d3a0e4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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: | diff --git a/appveyor.yml b/appveyor.yml index 7011c80c..b084cff5 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -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 diff --git a/binary/lua-zlib-1.2-0.rockspec b/binary/lua-zlib-1.2-0.rockspec index 4e32448f..9d3adc8f 100644 --- a/binary/lua-zlib-1.2-0.rockspec +++ b/binary/lua-zlib-1.2-0.rockspec @@ -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 = { diff --git a/spec/build_spec.lua b/spec/build_spec.lua index ba6c1a94..653f2160 100644 --- a/spec/build_spec.lua +++ b/spec/build_spec.lua @@ -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) diff --git a/spec/fixtures/a_repo/manifest b/spec/fixtures/a_repo/manifest index 5ab87d25..a5f770a1 100644 --- a/spec/fixtures/a_repo/manifest +++ b/spec/fixtures/a_repo/manifest @@ -68,5 +68,23 @@ repository = { arch = "src" } } + }, + non_lua_file = { + ["1.0-1"] = { + { + arch = "rockspec" + }, + { + arch = "src" + } + }, + ["1.0-2"] = { + { + arch = "rockspec" + }, + { + arch = "src" + } + } } } diff --git a/spec/fixtures/a_repo/manifest-5.1 b/spec/fixtures/a_repo/manifest-5.1 index 5ab87d25..a5f770a1 100644 --- a/spec/fixtures/a_repo/manifest-5.1 +++ b/spec/fixtures/a_repo/manifest-5.1 @@ -68,5 +68,23 @@ repository = { arch = "src" } } + }, + non_lua_file = { + ["1.0-1"] = { + { + arch = "rockspec" + }, + { + arch = "src" + } + }, + ["1.0-2"] = { + { + arch = "rockspec" + }, + { + arch = "src" + } + } } } diff --git a/spec/fixtures/a_repo/manifest-5.1.zip b/spec/fixtures/a_repo/manifest-5.1.zip index 65e316df..e63d6f1f 100644 Binary files a/spec/fixtures/a_repo/manifest-5.1.zip and b/spec/fixtures/a_repo/manifest-5.1.zip differ diff --git a/spec/fixtures/a_repo/manifest-5.2 b/spec/fixtures/a_repo/manifest-5.2 index 5ab87d25..a5f770a1 100644 --- a/spec/fixtures/a_repo/manifest-5.2 +++ b/spec/fixtures/a_repo/manifest-5.2 @@ -68,5 +68,23 @@ repository = { arch = "src" } } + }, + non_lua_file = { + ["1.0-1"] = { + { + arch = "rockspec" + }, + { + arch = "src" + } + }, + ["1.0-2"] = { + { + arch = "rockspec" + }, + { + arch = "src" + } + } } } diff --git a/spec/fixtures/a_repo/manifest-5.2.zip b/spec/fixtures/a_repo/manifest-5.2.zip index b4334a65..cec28c07 100644 Binary files a/spec/fixtures/a_repo/manifest-5.2.zip and b/spec/fixtures/a_repo/manifest-5.2.zip differ diff --git a/spec/fixtures/a_repo/manifest-5.3 b/spec/fixtures/a_repo/manifest-5.3 index 5ab87d25..a5f770a1 100644 --- a/spec/fixtures/a_repo/manifest-5.3 +++ b/spec/fixtures/a_repo/manifest-5.3 @@ -68,5 +68,23 @@ repository = { arch = "src" } } + }, + non_lua_file = { + ["1.0-1"] = { + { + arch = "rockspec" + }, + { + arch = "src" + } + }, + ["1.0-2"] = { + { + arch = "rockspec" + }, + { + arch = "src" + } + } } } diff --git a/spec/fixtures/a_repo/manifest-5.3.zip b/spec/fixtures/a_repo/manifest-5.3.zip index bab15712..23df5c30 100644 Binary files a/spec/fixtures/a_repo/manifest-5.3.zip and b/spec/fixtures/a_repo/manifest-5.3.zip differ diff --git a/spec/fixtures/a_repo/manifest-5.4 b/spec/fixtures/a_repo/manifest-5.4 new file mode 100644 index 00000000..a5f770a1 --- /dev/null +++ b/spec/fixtures/a_repo/manifest-5.4 @@ -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" + } + } + } +} diff --git a/spec/fixtures/a_repo/manifest-5.4.zip b/spec/fixtures/a_repo/manifest-5.4.zip new file mode 100644 index 00000000..14b5621e Binary files /dev/null and b/spec/fixtures/a_repo/manifest-5.4.zip differ diff --git a/spec/fixtures/a_repo/manifests/a_user/manifest-5.4 b/spec/fixtures/a_repo/manifests/a_user/manifest-5.4 new file mode 100644 index 00000000..74b0c618 --- /dev/null +++ b/spec/fixtures/a_repo/manifests/a_user/manifest-5.4 @@ -0,0 +1,14 @@ +commands = {} +modules = {} +repository = { + a_rock = { + ["2.0-1"] = { + { + arch = "rockspec" + }, + { + arch = "src" + } + } + } +} diff --git a/spec/fixtures/a_repo/manifests/another_user/manifest-5.4 b/spec/fixtures/a_repo/manifests/another_user/manifest-5.4 new file mode 100644 index 00000000..185aed08 --- /dev/null +++ b/spec/fixtures/a_repo/manifests/another_user/manifest-5.4 @@ -0,0 +1,14 @@ +commands = {} +modules = {} +repository = { + a_rock = { + ["3.0-1"] = { + { + arch = "src" + }, + { + arch = "rockspec" + } + } + } +} diff --git a/spec/init_spec.lua b/spec/init_spec.lua index 3bde313a..dadeb300 100644 --- a/spec/init_spec.lua +++ b/spec/init_spec.lua @@ -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) diff --git a/spec/install_spec.lua b/spec/install_spec.lua index 1154e9b9..c3aa0064 100644 --- a/spec/install_spec.lua +++ b/spec/install_spec.lua @@ -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() diff --git a/spec/test_spec.lua b/spec/test_spec.lua index 21844d63..33643097 100644 --- a/spec/test_spec.lua +++ b/spec/test_spec.lua @@ -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", diff --git a/spec/unpack_spec.lua b/spec/unpack_spec.lua index 9b1e2b9a..00d6781f 100644 --- a/spec/unpack_spec.lua +++ b/spec/unpack_spec.lua @@ -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) diff --git a/spec/util/test_env.lua b/spec/util/test_env.lua index 6a466bae..c32e9978 100644 --- a/spec/util/test_env.lua +++ b/spec/util/test_env.lua @@ -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 diff --git a/spec/util/versions.lua b/spec/util/versions.lua index b0d5c453..0d3b8796 100644 --- a/spec/util/versions.lua +++ b/spec/util/versions.lua @@ -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", -- cgit v1.2.3-55-g6feb