From 4ef2c181d9f76d01c1a6b58232e5d0dfe8679bf7 Mon Sep 17 00:00:00 2001 From: Hisham Muhammad Date: Mon, 6 Jun 2022 15:25:47 -0300 Subject: tests: accept full path in -Xhelper lua_interpreter --- spec/util/test_env.lua | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/spec/util/test_env.lua b/spec/util/test_env.lua index c32e9978..1d67d30d 100644 --- a/spec/util/test_env.lua +++ b/spec/util/test_env.lua @@ -654,15 +654,20 @@ local function create_paths(luaversion_full) testing_paths.lua_interpreter = test_env.LUA_INTERPRETER or "lua" end - local bindirs = { - testing_paths.luadir .. "/bin", - testing_paths.luadir, - } - for _, bindir in ipairs(bindirs) do - local lua = bindir .. "/" .. testing_paths.lua_interpreter - if test_env.exists(lua) then - testing_paths.lua_bindir = bindir - testing_paths.lua = lua + local locations + if testing_paths.lua_interpreter:match("[/\\]") then + locations = { testing_paths.lua_interpreter } + else + locations = { + testing_paths.luadir .. "/bin/" .. testing_paths.lua_interpreter, + testing_paths.luadir .. "/" .. testing_paths.lua_interpreter, + } + end + + for _, location in ipairs(locations) do + if test_env.exists(location) then + testing_paths.lua_bindir = location:match("(.*)[/\\][^/\\]*$") + testing_paths.lua = location break end end -- cgit v1.2.3-55-g6feb