From a05ba7ce42ae4e42f80b5cacdd8770ae5e6cc04b Mon Sep 17 00:00:00 2001 From: Peter Melnichenko Date: Fri, 8 Jul 2016 20:28:43 +0300 Subject: Infer Lua version using luarocks.cfg when not on travis --- test/test_environment.lua | 32 ++++++-------------------------- 1 file changed, 6 insertions(+), 26 deletions(-) diff --git a/test/test_environment.lua b/test/test_environment.lua index a48a59a3..6de7a4e2 100644 --- a/test/test_environment.lua +++ b/test/test_environment.lua @@ -7,9 +7,8 @@ LuaRocks test-suite INFORMATION New test-suite for LuaRocks project, using unit testing framework Busted. REQUIREMENTS - Tests require to have Lua installed and added to PATH. Be sure sshd is - running on your system, or use '--exclude-tags=ssh', to not execute tests - which require sshd. + Be sure sshd is running on your system, or use '--exclude-tags=ssh', + to not execute tests which require sshd. USAGE busted [-Xhelper ] ARGUMENTS @@ -343,30 +342,11 @@ local function reset_environment(testing_paths, md5sums) end local function create_paths(luaversion_full) - local testing_paths = {} + local cfg = require("luarocks.cfg") - testing_paths.luadir = "" - - if test_env.TRAVIS then - testing_paths.luadir = lfs.currentdir() .. "/lua_install" - testing_paths.lua = testing_paths.luadir .. "/bin/lua" - elseif test_env.LUA_V then - if exists("/usr/bin/lua") then - testing_paths.luadir = "/usr" - testing_paths.lua = testing_paths.luadir .. "/bin/lua" - elseif exists("/usr/local/bin/lua") then - testing_paths.luadir = "/usr/local" - testing_paths.lua = testing_paths.luadir .. "/bin/lua" - end - elseif test_env.LUAJIT_V then - if exists("/usr/bin/luajit") then - testing_paths.luadir = "/usr" - testing_paths.lua = testing_paths.luadir .. "/bin/luajit" - elseif exists("/usr/local/bin/luajit") then - testing_paths.luadir = "/usr/local" - testing_paths.lua = testing_paths.luadir .. "/bin/luajit" - end - end + local testing_paths = {} + testing_paths.luadir = cfg.variables.LUA_BINDIR:gsub("/bin/?$", "") + testing_paths.lua = cfg.variables.LUA_BINDIR .. "/" .. cfg.lua_interpreter testing_paths.luarocks_tmp = "/tmp/luarocks_testing" --windows? -- cgit v1.2.3-55-g6feb