From 84b4fe99cac37850a97858e0b641043bd3178d8a Mon Sep 17 00:00:00 2001 From: Hisham Muhammad Date: Wed, 4 Oct 2017 11:14:42 -0300 Subject: Use versioned files only. (#734) Let's take the opportunity of a new major version to make an important cleanup: getting rid of the error-prone unversioned configuration files. This drops support for: * Unversioned config.lua -> use config-5.x.lua * Unversioned luarocks/site_config.lua -> it always generates luarocks/core/site_config_5_x.lua * Unversioned lib/luarocks/rocks -> it always uses lib/luarocks/rocks-5.x --- spec/build_spec.lua | 40 ++++++++++++++++---------------- spec/config_spec.lua | 12 ++-------- spec/deps_spec.lua | 64 +++++++++++++++++++++++++-------------------------- spec/doc_spec.lua | 6 ++--- spec/install_spec.lua | 12 +++++----- spec/list_spec.lua | 3 +-- spec/make_spec.lua | 10 ++++---- spec/remove_spec.lua | 20 ++++++++-------- spec/util_spec.lua | 63 +++++++------------------------------------------- 9 files changed, 87 insertions(+), 143 deletions(-) (limited to 'spec') diff --git a/spec/build_spec.lua b/spec/build_spec.lua index 2ff7cbe6..ffae144d 100644 --- a/spec/build_spec.lua +++ b/spec/build_spec.lua @@ -63,22 +63,22 @@ describe("LuaRocks build tests #blackbox #b_build", function() it("LuaRocks build lpeg branch=master", function() assert.is_true(run.luarocks_bool("build --branch=master lpeg")) - assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) + assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) end) it("LuaRocks build lpeg deps-mode=123", function() assert.is_false(run.luarocks_bool("build --deps-mode=123 lpeg --verbose")) - assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) + assert.is.falsy(lfs.attributes(testing_paths.testing_sys_rocks .. "/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) end) it("LuaRocks build lpeg only-sources example", function() assert.is_true(run.luarocks_bool("download --rockspec lpeg")) assert.is_false(run.luarocks_bool("build --only-sources=\"http://example.com\" lpeg-1.0.0-1.rockspec")) - assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) + assert.is.falsy(lfs.attributes(testing_paths.testing_sys_rocks .. "/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) assert.is_true(run.luarocks_bool("download --source lpeg")) assert.is_true(run.luarocks_bool("build --only-sources=\"http://example.com\" lpeg-1.0.0-1.src.rock")) - assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) + assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) assert.is_true(os.remove("lpeg-1.0.0-1.rockspec")) assert.is_true(os.remove("lpeg-1.0.0-1.src.rock")) @@ -86,7 +86,7 @@ describe("LuaRocks build tests #blackbox #b_build", function() it("LuaRocks build lpeg with empty tree", function() assert.is_false(run.luarocks_bool("build --tree=\"\" lpeg")) - assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) + assert.is.falsy(lfs.attributes(testing_paths.testing_sys_rocks .. "/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) end) end) @@ -97,17 +97,17 @@ describe("LuaRocks build tests #blackbox #b_build", function() it("LuaRocks build luacov diff version", function() assert.is_true(run.luarocks_bool("build luacov 0.11.0-1")) - assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luacov/0.11.0-1/luacov-0.11.0-1.rockspec")) + assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/luacov/0.11.0-1/luacov-0.11.0-1.rockspec")) end) it("LuaRocks build command stdlib", function() assert.is_true(run.luarocks_bool("build stdlib")) - assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/stdlib/41.0.0-1/stdlib-41.0.0-1.rockspec")) + assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/stdlib/41.0.0-1/stdlib-41.0.0-1.rockspec")) end) it("LuaRocks build install bin luarepl", function() assert.is_true(run.luarocks_bool("build luarepl")) - assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luarepl/0.4-1/luarepl-0.4-1.rockspec")) + assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/luarepl/0.4-1/luarepl-0.4-1.rockspec")) end) it("LuaRocks build supported platforms lpty", function() @@ -115,24 +115,24 @@ describe("LuaRocks build tests #blackbox #b_build", function() assert.is_false(run.luarocks_bool("build lpty")) --Error: This rockspec for lpty does not support win32, windows platforms else assert.is_true(run.luarocks_bool("build lpty")) - assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lpty/1.0.1-1/lpty-1.0.1-1.rockspec")) + assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/lpty/1.0.1-1/lpty-1.0.1-1.rockspec")) end end) it("LuaRocks build luasec with skipping dependency checks", function() assert.is_true(run.luarocks_bool("build luasec " .. test_env.OPENSSL_DIRS .. " --nodeps")) - assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luasec/0.6-1/luasec-0.6-1.rockspec")) + assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/luasec/0.6-1/luasec-0.6-1.rockspec")) end) it("LuaRocks build 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.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lmathx/20120430.51-1/lmathx-20120430.51-1.rockspec")) + 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.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lmathx/20120430.52-1/lmathx-20120430.52-1.rockspec")) + 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.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lmathx/20150505-1/lmathx-20150505-1.rockspec")) + assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/lmathx/20150505-1/lmathx-20150505-1.rockspec")) end end) end) @@ -148,15 +148,15 @@ describe("LuaRocks build tests #blackbox #b_build", function() it("LuaRocks build luasec only deps", function() assert.is_true(run.luarocks_bool("build luasec " .. test_env.OPENSSL_DIRS .. " --only-deps")) assert.is_false(run.luarocks_bool("show luasec")) - assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luasec/0.6-1/luasec-0.6-1.rockspec")) + assert.is.falsy(lfs.attributes(testing_paths.testing_sys_rocks .. "/luasec/0.6-1/luasec-0.6-1.rockspec")) end) it("LuaRocks build only deps of downloaded rockspec of lxsh", function() assert.is_true(run.luarocks_bool("download --rockspec lxsh 0.8.6-2")) assert.is.truthy(run.luarocks("build lxsh-0.8.6-2.rockspec --only-deps")) assert.is_false(run.luarocks_bool("show lxsh")) - assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) - assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) + assert.is.falsy(lfs.attributes(testing_paths.testing_sys_rocks .. "/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) + assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) assert.is_true(os.remove("lxsh-0.8.6-2.rockspec")) end) @@ -164,8 +164,8 @@ describe("LuaRocks build tests #blackbox #b_build", function() assert.is_true(run.luarocks_bool("download --source lxsh 0.8.6-2")) assert.is.truthy(run.luarocks("build lxsh-0.8.6-2.src.rock --only-deps")) assert.is_false(run.luarocks_bool("show lxsh")) - assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) - assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) + assert.is.falsy(lfs.attributes(testing_paths.testing_sys_rocks .. "/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) + assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) assert.is_true(os.remove("lxsh-0.8.6-2.src.rock")) end) @@ -174,7 +174,7 @@ describe("LuaRocks build tests #blackbox #b_build", function() assert.is_true(run.luarocks_bool("build validate-args-1.5.4-1.rockspec")) assert.is.truthy(run.luarocks("show validate-args")) - assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/validate-args/1.5.4-1/validate-args-1.5.4-1.rockspec")) + assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/validate-args/1.5.4-1/validate-args-1.5.4-1.rockspec")) assert.is_true(os.remove("validate-args-1.5.4-1.rockspec")) end) @@ -185,7 +185,7 @@ describe("LuaRocks build tests #blackbox #b_build", function() assert.is_true(run.luarocks_bool("build validate-args-1.5.4-1.rockspec")) assert.is.truthy(run.luarocks("show validate-args")) - assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/validate-args/1.5.4-1/validate-args-1.5.4-1.rockspec")) + assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/validate-args/1.5.4-1/validate-args-1.5.4-1.rockspec")) assert.is_true(os.remove("validate-args-1.5.4-1.rockspec")) end) diff --git a/spec/config_spec.lua b/spec/config_spec.lua index cdb5ccc4..6be586c2 100644 --- a/spec/config_spec.lua +++ b/spec/config_spec.lua @@ -12,7 +12,7 @@ describe("LuaRocks config tests #blackbox #b_config", function() before_each(function() test_env.setup_specs() test_env.unload_luarocks() -- need to be required here, because site_config is created after first loading of specs - site_config = require("luarocks.site_config") + site_config = require("luarocks.core.site_config_" .. test_env.lua_version:gsub("%.", "_")) end) describe("LuaRocks config - basic tests", function() @@ -64,15 +64,7 @@ describe("LuaRocks config tests #blackbox #b_config", function() describe("LuaRocks config - more complex tests", function() local scdir = testing_paths.testing_lrprefix .. "/etc/luarocks" - local versioned_scname = scdir .. "/config-" .. env_variables.LUA_VERSION .. ".lua" - local scname = scdir .. "/config.lua" - - local configfile - if test_env.TEST_TARGET_OS == "windows" then - configfile = versioned_scname - else - configfile = scname - end + local configfile = scdir .. "/config-" .. env_variables.LUA_VERSION .. ".lua" it("LuaRocks fail system config", function() os.rename(configfile, configfile .. ".bak") diff --git a/spec/deps_spec.lua b/spec/deps_spec.lua index e453c9a1..8c4effcd 100644 --- a/spec/deps_spec.lua +++ b/spec/deps_spec.lua @@ -23,59 +23,59 @@ describe("LuaRocks deps tests #blackbox #b_deps", function() assert.is_true(run.luarocks_bool("build --tree=system lpeg")) assert.is_true(run.luarocks_bool("build --deps-mode=one --tree=" .. testing_paths.testing_tree .. " lxsh")) - assert.is.truthy(lfs.attributes(testing_paths.testing_tree .. "/lib/luarocks/rocks/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) - assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) - assert.is.truthy(lfs.attributes(testing_paths.testing_tree .. "/lib/luarocks/rocks/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) - assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) + assert.is.truthy(lfs.attributes(testing_paths.testing_rocks .. "/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) + assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) + assert.is.truthy(lfs.attributes(testing_paths.testing_rocks .. "/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) + assert.is.falsy(lfs.attributes(testing_paths.testing_sys_rocks .. "/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) end) it("LuaRocks deps mode order", function() assert.is_true(run.luarocks_bool("build --tree=system lpeg")) assert.is_true(run.luarocks_bool("build --deps-mode=order --tree=" .. testing_paths.testing_tree .. " lxsh")) - assert.is.falsy(lfs.attributes(testing_paths.testing_tree .. "/lib/luarocks/rocks/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) - assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) - assert.is.truthy(lfs.attributes(testing_paths.testing_tree .. "/lib/luarocks/rocks/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) - assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) + assert.is.falsy(lfs.attributes(testing_paths.testing_rocks .. "/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) + assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) + assert.is.truthy(lfs.attributes(testing_paths.testing_rocks .. "/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) + assert.is.falsy(lfs.attributes(testing_paths.testing_sys_rocks .. "/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) end) it("LuaRocks deps mode order sys", function() assert.is_true(run.luarocks_bool("build --tree=" .. testing_paths.testing_tree .. " lpeg")) assert.is_true(run.luarocks_bool("build --deps-mode=order --tree=" .. testing_paths.testing_sys_tree .. " lxsh")) - assert.is.truthy(lfs.attributes(testing_paths.testing_tree .. "/lib/luarocks/rocks/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) - assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) - assert.is.falsy(lfs.attributes(testing_paths.testing_tree .. "/lib/luarocks/rocks/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) - assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) + assert.is.truthy(lfs.attributes(testing_paths.testing_rocks .. "/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) + assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) + assert.is.falsy(lfs.attributes(testing_paths.testing_rocks .. "/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) + assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) end) it("LuaRocks deps mode all sys", function() assert.is_true(run.luarocks_bool("build --tree=" .. testing_paths.testing_tree .. " lpeg")) assert.is_true(run.luarocks_bool("build --deps-mode=all --tree=" .. testing_paths.testing_sys_tree .. " lxsh")) - assert.is.truthy(lfs.attributes(testing_paths.testing_tree .. "/lib/luarocks/rocks/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) - assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) - assert.is.falsy(lfs.attributes(testing_paths.testing_tree .. "/lib/luarocks/rocks/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) - assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) + assert.is.truthy(lfs.attributes(testing_paths.testing_rocks .. "/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) + assert.is.falsy(lfs.attributes(testing_paths.testing_sys_rocks .. "/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) + assert.is.falsy(lfs.attributes(testing_paths.testing_rocks .. "/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) + assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) end) it("LuaRocks deps mode none", function() assert.is_true(run.luarocks_bool("build --tree=" .. testing_paths.testing_tree .. " lpeg")) assert.is_true(run.luarocks_bool("build --deps-mode=none lxsh")) - assert.is.truthy(lfs.attributes(testing_paths.testing_tree .. "/lib/luarocks/rocks/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) - assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) - assert.is.falsy(lfs.attributes(testing_paths.testing_tree .. "/lib/luarocks/rocks/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) - assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) + assert.is.truthy(lfs.attributes(testing_paths.testing_rocks .. "/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) + assert.is.falsy(lfs.attributes(testing_paths.testing_sys_rocks .. "/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) + assert.is.falsy(lfs.attributes(testing_paths.testing_rocks .. "/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) + assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) end) it("LuaRocks nodeps alias", function() assert.is_true(run.luarocks_bool("build --tree=" .. testing_paths.testing_tree .. " --nodeps lxsh")) - assert.is.falsy(lfs.attributes(testing_paths.testing_tree .. "/lib/luarocks/rocks/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) - assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) - assert.is.truthy(lfs.attributes(testing_paths.testing_tree .. "/lib/luarocks/rocks/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) - assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) + assert.is.falsy(lfs.attributes(testing_paths.testing_rocks .. "/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) + assert.is.falsy(lfs.attributes(testing_paths.testing_sys_rocks .. "/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) + assert.is.truthy(lfs.attributes(testing_paths.testing_rocks .. "/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) + assert.is.falsy(lfs.attributes(testing_paths.testing_sys_rocks .. "/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) end) it("LuaRocks deps mode make order", function() @@ -89,10 +89,10 @@ describe("LuaRocks deps tests #blackbox #b_deps", function() test_env.remove_dir("lxsh-0.8.6-2") assert.is_true(os.remove("lxsh-0.8.6-2.src.rock")) - assert.is.falsy(lfs.attributes(testing_paths.testing_tree .. "/lib/luarocks/rocks/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) - assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) - assert.is.truthy(lfs.attributes(testing_paths.testing_tree .. "/lib/luarocks/rocks/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) - assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) + assert.is.falsy(lfs.attributes(testing_paths.testing_rocks .. "/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) + assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) + assert.is.truthy(lfs.attributes(testing_paths.testing_rocks .. "/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) + assert.is.falsy(lfs.attributes(testing_paths.testing_sys_rocks .. "/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) end) it("LuaRocks deps mode make order sys", function() @@ -106,9 +106,9 @@ describe("LuaRocks deps tests #blackbox #b_deps", function() test_env.remove_dir("lxsh-0.8.6-2") assert.is_true(os.remove("lxsh-0.8.6-2.src.rock")) - assert.is.truthy(lfs.attributes(testing_paths.testing_tree .. "/lib/luarocks/rocks/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) - assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) - assert.is.falsy(lfs.attributes(testing_paths.testing_tree .. "/lib/luarocks/rocks/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) - assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) + assert.is.truthy(lfs.attributes(testing_paths.testing_rocks .. "/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) + assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) + assert.is.falsy(lfs.attributes(testing_paths.testing_rocks .. "/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) + assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) end) end) diff --git a/spec/doc_spec.lua b/spec/doc_spec.lua index a04d3c14..ea42cd6b 100644 --- a/spec/doc_spec.lua +++ b/spec/doc_spec.lua @@ -28,12 +28,12 @@ describe("LuaRocks doc tests #blackbox #b_doc", function() end) it("LuaRocks doc with no home page and no doc folder", function() assert.is_true(run.luarocks_bool("install c3")) - test_env.remove_dir(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/c3/1.0-1/doc") + test_env.remove_dir(testing_paths.testing_sys_rocks .. "/c3/1.0-1/doc") assert.is_false(run.luarocks_bool("doc c3")) end) it("LuaRocks doc with no doc folder opening descript.homepage", function() assert.is_true(run.luarocks_bool("install luarepl")) - test_env.remove_dir(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luarepl/0.4-1/doc") + test_env.remove_dir(testing_paths.testing_sys_rocks .. "/luarepl/0.4-1/doc") local output = run.luarocks("doc luarepl") assert.is.truthy(output:find("Local documentation directory not found")) end) @@ -53,7 +53,7 @@ describe("LuaRocks doc tests #blackbox #b_doc", function() it("LuaRocks doc of luacov and list doc folder", function() assert.is_true(run.luarocks_bool("install luacov")) local output = assert.is.truthy(run.luarocks("doc luacov --list")) - assert.is.truthy(output:find("/lib/luarocks/rocks/luacov/0.11.0--1/doc/")) + assert.is.truthy(output:find("/lib/luarocks/rocks%-.*/luacov/0.11.0%-1/doc/", 1)) end) it("LuaRocks doc of luacov local", function() diff --git a/spec/install_spec.lua b/spec/install_spec.lua index 74f8f493..92b780d3 100644 --- a/spec/install_spec.lua +++ b/spec/install_spec.lua @@ -83,9 +83,9 @@ describe("LuaRocks install tests #blackbox #b_install", function() assert.is_true(run.luarocks_bool("show luasec")) if env_variables.TYPE_TEST_ENV == "minimal" then assert.is_false(run.luarocks_bool(test_env.quiet("show luasocket"))) - assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luasocket")) + assert.is.falsy(lfs.attributes(testing_paths.testing_sys_rocks .. "/luasocket")) end - assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luasec")) + assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/luasec")) end) it('LuaRocks install - handle relative path in --tree #632', function() @@ -170,22 +170,22 @@ describe("LuaRocks install tests #blackbox #b_install", function() assert.is_true(run.luarocks_bool("install say 1.2")) assert.is_true(run.luarocks_bool("install luassert")) assert.is_true(run.luarocks_bool("install say 1.0")) - assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/say/1.2-1")) + assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/say/1.2-1")) end) it("LuaRocks install break dependencies force", function() assert.is_true(run.luarocks_bool("install say 1.2")) assert.is_true(run.luarocks_bool("install luassert")) local output = run.luarocks("install --force say 1.0") assert.is.truthy(output:find("Checking stability of dependencies")) - assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/say/1.2-1")) + assert.is.falsy(lfs.attributes(testing_paths.testing_sys_rocks .. "/say/1.2-1")) end) it("LuaRocks install break dependencies force fast", function() assert.is_true(run.luarocks_bool("install say 1.2")) assert.is_true(run.luarocks_bool("install luassert")) - assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/say/1.2-1")) + assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/say/1.2-1")) local output = run.luarocks("install --force-fast say 1.0") assert.is.falsy(output:find("Checking stability of dependencies")) - assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/say/1.0-1")) + assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/say/1.0-1")) end) end) end) diff --git a/spec/list_spec.lua b/spec/list_spec.lua index 1b082ab6..b9a8e4c4 100644 --- a/spec/list_spec.lua +++ b/spec/list_spec.lua @@ -22,8 +22,7 @@ describe("LuaRocks list tests #blackbox #b_list", function() it("LuaRocks list porcelain", function() local output = run.luarocks("list --porcelain") - local path = testing_paths.testing_sys_tree:gsub("-", "--") -- !not sure! why this is good - assert.is.truthy(output:find("luacov\t0.11.0--1\tinstalled\t" .. path .. "/lib/luarocks/rocks" )) + assert.is.truthy(output:find("luacov\t0.11.0-1\tinstalled\t" .. testing_paths.testing_sys_rocks, 1, true)) end) it("LuaRocks install outdated and list it", function() diff --git a/spec/make_spec.lua b/spec/make_spec.lua index ab2d49a3..4c406c68 100644 --- a/spec/make_spec.lua +++ b/spec/make_spec.lua @@ -35,7 +35,7 @@ describe("LuaRocks make tests #blackbox #b_make", function() -- test it assert.is_true(run.luarocks_bool("show luasocket")) - assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luasocket/3.0rc1-2/luasocket-3.0rc1-2.rockspec")) + assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/luasocket/3.0rc1-2/luasocket-3.0rc1-2.rockspec")) -- delete downloaded and unpacked files lfs.chdir(testing_paths.luarocks_dir) @@ -63,7 +63,7 @@ describe("LuaRocks make tests #blackbox #b_make", function() assert.is_true(run.luarocks_bool("make")) assert.is_true(run.luarocks_bool("show lxsh")) - assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lxsh/0.8.6-3/lxsh-0.8.6-3.rockspec")) + assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/lxsh/0.8.6-3/lxsh-0.8.6-3.rockspec")) end) it("LuaRocks make unnamed rockspec", function() @@ -71,7 +71,7 @@ describe("LuaRocks make tests #blackbox #b_make", function() assert.is_true(run.luarocks_bool("make")) assert.is_true(run.luarocks_bool("show lxsh")) - assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) + assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) os.remove("rockspec") end) @@ -81,7 +81,7 @@ describe("LuaRocks make tests #blackbox #b_make", function() assert.is.truthy(output:match("Error: Inconsistency between rockspec filename")) assert.is_false(run.luarocks_bool("show lxsh")) - assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) + assert.is.falsy(lfs.attributes(testing_paths.testing_sys_rocks .. "/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) end) it("LuaRocks make ambiguous unnamed rockspec", function() @@ -91,7 +91,7 @@ describe("LuaRocks make tests #blackbox #b_make", function() assert.is.truthy(output:match("Error: Please specify which rockspec file to use")) assert.is_false(run.luarocks_bool("show lxsh")) - assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) + assert.is.falsy(lfs.attributes(testing_paths.testing_sys_rocks .. "/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) end) it("LuaRocks make pack binary rock", function() diff --git a/spec/remove_spec.lua b/spec/remove_spec.lua index 03b3681e..4d3f5cdc 100644 --- a/spec/remove_spec.lua +++ b/spec/remove_spec.lua @@ -37,16 +37,16 @@ describe("LuaRocks remove tests #blackbox #b_remove", function() it("LuaRocks remove built abelhas", function() assert.is_true(run.luarocks_bool("build abelhas 1.0")) - assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/abelhas")) + assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/abelhas")) assert.is_true(run.luarocks_bool("remove abelhas 1.0")) - assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/abelhas")) + assert.is.falsy(lfs.attributes(testing_paths.testing_sys_rocks .. "/abelhas")) end) it("LuaRocks remove built abelhas with uppercase name", function() assert.is_true(run.luarocks_bool("build abelhas 1.0")) - assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/abelhas")) + assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/abelhas")) assert.is_true(run.luarocks_bool("remove Abelhas 1.0")) - assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/abelhas")) + assert.is.falsy(lfs.attributes(testing_paths.testing_sys_rocks .. "/abelhas")) end) end) @@ -56,28 +56,28 @@ describe("LuaRocks remove tests #blackbox #b_remove", function() end) it("LuaRocks remove fail, break dependencies", function() - assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luasocket")) + assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/luasocket")) assert.is_true(run.luarocks_bool("build lualogging")) assert.is_false(run.luarocks_bool("remove luasocket")) - assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luasocket")) + assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/luasocket")) end) it("LuaRocks remove force", function() - assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luasocket")) + assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/luasocket")) assert.is_true(run.luarocks_bool("build lualogging")) local output = run.luarocks("remove --force luasocket") - assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luasocket")) + assert.is.falsy(lfs.attributes(testing_paths.testing_sys_rocks .. "/luasocket")) assert.is.truthy(output:find("Checking stability of dependencies")) end) it("LuaRocks remove force fast", function() - assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luasocket")) + assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/luasocket")) assert.is_true(run.luarocks_bool("build lualogging")) local output = run.luarocks("remove --force-fast luasocket") - assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luasocket")) + assert.is.falsy(lfs.attributes(testing_paths.testing_sys_rocks .. "/luasocket")) assert.is.falsy(output:find("Checking stability of dependencies")) end) end) diff --git a/spec/util_spec.lua b/spec/util_spec.lua index 988d8ef0..25cc51d8 100644 --- a/spec/util_spec.lua +++ b/spec/util_spec.lua @@ -55,66 +55,19 @@ describe("Basic tests #blackbox #b_util", function() end) it("LuaRocks test site config", function() - assert.is.truthy(os.rename("src/luarocks/site_config.lua", "src/luarocks/site_config.lua.tmp")) - assert.is.falsy(lfs.attributes("src/luarocks/site_config.lua")) - assert.is.truthy(lfs.attributes("src/luarocks/site_config.lua.tmp")) + local scname = "src/luarocks/core/site_config_"..test_env.lua_version:gsub("%.", "_")..".lua" + + assert.is.truthy(os.rename(scname, scname..".tmp")) + assert.is.falsy(lfs.attributes(scname)) + assert.is.truthy(lfs.attributes(scname..".tmp")) assert.is.truthy(run.luarocks("")) - assert.is.truthy(os.rename("src/luarocks/site_config.lua.tmp", "src/luarocks/site_config.lua")) - assert.is.falsy(lfs.attributes("src/luarocks/site_config.lua.tmp")) - assert.is.truthy(lfs.attributes("src/luarocks/site_config.lua")) + assert.is.truthy(os.rename(scname..".tmp", scname)) + assert.is.falsy(lfs.attributes(scname..".tmp")) + assert.is.truthy(lfs.attributes(scname)) end) - -- Disable versioned config temporarily, because it always takes - -- precedence over config.lua (config-5.x.lua is installed by default on Windows, - -- but not on Unix, so on Unix the os.rename commands below will fail silently, but this is harmless) - describe("LuaRocks config - more complex tests", function() - local scdir = testing_paths.testing_lrprefix .. "/etc/luarocks" - local versioned_scname = scdir .. "/config-" .. env_variables.LUA_VERSION .. ".lua" - local scname = scdir .. "/config.lua" - - local configfile - if test_env.TEST_TARGET_OS == "windows" then - configfile = versioned_scname - else - configfile = scname - end - - it("LuaRocks fail system config", function() - os.rename(versioned_scname, versioned_scname .. "bak") - local ok = run.luarocks_bool("config --system-config") - os.rename(versioned_scname .. ".bak", versioned_scname) - assert.is_false(ok) - end) - - it("LuaRocks system config", function() - lfs.mkdir(testing_paths.testing_lrprefix) - lfs.mkdir(testing_paths.testing_lrprefix .. "/etc/") - lfs.mkdir(scdir) - - local sysconfig = io.open(configfile, "w+") - sysconfig:write(" ") - sysconfig:close() - - local output = run.luarocks("config --system-config") - os.remove(configfile) - assert.are.same(output, configfile) - end) - - it("LuaRocks fail system config invalid", function() - lfs.mkdir(testing_paths.testing_lrprefix) - lfs.mkdir(testing_paths.testing_lrprefix .. "/etc/") - lfs.mkdir(scdir) - - local sysconfig = io.open(configfile, "w+") - sysconfig:write("if if if") - sysconfig:close() - local ok = run.luarocks_bool("config --system-config") - os.remove(configfile) - assert.is_false(ok) - end) - end) end) test_env.unload_luarocks() -- cgit v1.2.3-55-g6feb