From 7225a3d4513137a8e13a5db39538e007b8faa886 Mon Sep 17 00:00:00 2001 From: roboo Date: Mon, 22 Aug 2016 20:57:26 +0200 Subject: Change APPVEYOR_OPENSSL to OPENSSL_DIRS for better test readability --- test/test_environment.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/test_environment.lua b/test/test_environment.lua index 37bd38f1..ab6c3edd 100644 --- a/test/test_environment.lua +++ b/test/test_environment.lua @@ -153,6 +153,7 @@ end function test_env.set_args() -- if at least Lua/LuaJIT version argument was found on input start to parse other arguments to env. variables test_env.TYPE_TEST_ENV = "minimal" + test_env.OPENSSL_DIRS = "" test_env.RESET_ENV = true for _, argument in ipairs(arg) do @@ -168,7 +169,7 @@ function test_env.set_args() test_env.TRAVIS = true elseif argument == "appveyor" then test_env.APPVEYOR = true - test_env.APPVEYOR_OPENSSL = "OPENSSL_LIBDIR=C:\\OpenSSL-Win32\\lib OPENSSL_INCDIR=C:\\OpenSSL-Win32\\include" + test_env.OPENSSL_DIRS = "OPENSSL_LIBDIR=C:\\OpenSSL-Win32\\lib OPENSSL_INCDIR=C:\\OpenSSL-Win32\\include" elseif argument:find("^os=") then test_env.TEST_TARGET_OS = argument:match("^os=(.*)$") else -- cgit v1.2.3-55-g6feb From 6d9c9997645c07ed93719d85e260d9ffbc2d1d25 Mon Sep 17 00:00:00 2001 From: roboo Date: Mon, 22 Aug 2016 21:01:23 +0200 Subject: Change APPVEYOR_OPENSSL to OPENSSL_DIRS for better test readability --- spec/build_spec.lua | 18 +++--------------- spec/install_spec.lua | 12 ++---------- spec/pack_spec.lua | 6 +----- spec/upload_spec.lua | 12 ++---------- 4 files changed, 8 insertions(+), 40 deletions(-) diff --git a/spec/build_spec.lua b/spec/build_spec.lua index b4f838ca..8f08f0a0 100644 --- a/spec/build_spec.lua +++ b/spec/build_spec.lua @@ -120,11 +120,7 @@ describe("LuaRocks build tests #blackbox #b_build", function() end) it("LuaRocks build luasec with skipping dependency checks", function() - if test_env.APPVEYOR then - assert.is_true(run.luarocks_bool("build luasec " .. test_env.APPVEYOR_OPENSSL .. " --nodeps")) - else - assert.is_true(run.luarocks_bool("build luasec --nodeps")) - end + 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")) end) @@ -150,11 +146,7 @@ describe("LuaRocks build tests #blackbox #b_build", function() end it("LuaRocks build luasec only deps", function() - if test_env.APPVEYOR then - assert.is_true(run.luarocks_bool(test_env.quiet("build luasec " .. test_env.APPVEYOR_OPENSSL .. " --only-deps"))) - else - assert.is_true(run.luarocks_bool(test_env.quiet("build luasec --only-deps"))) - end + assert.is_true(run.luarocks_bool(test_env.quiet("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")) end) @@ -189,12 +181,8 @@ describe("LuaRocks build tests #blackbox #b_build", function() it("LuaRocks build with https", function() assert.is_true(run.luarocks_bool("download --rockspec validate-args 1.5.4-1")) + assert.is_true(run.luarocks_bool(test_env.quiet("install luasec " .. test_env.OPENSSL_DIRS))) - if test_env.APPVEYOR then - assert.is_true(run.luarocks_bool(test_env.quiet("install luasec " .. test_env.APPVEYOR_OPENSSL))) - else - assert.is_true(run.luarocks_bool(test_env.quiet("install luasec"))) - end 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")) diff --git a/spec/install_spec.lua b/spec/install_spec.lua index 2b6cb77f..e5b9e2cc 100644 --- a/spec/install_spec.lua +++ b/spec/install_spec.lua @@ -66,22 +66,14 @@ describe("LuaRocks install tests #blackbox #b_install", function() end) it("LuaRocks install luasec and show luasocket (dependency)", function() - if test_env.APPVEYOR then - assert.is_true(run.luarocks_bool(test_env.quiet("install luasec " .. test_env.APPVEYOR_OPENSSL))) - else - assert.is_true(run.luarocks_bool(test_env.quiet("install luasec"))) - end + assert.is_true(run.luarocks_bool(test_env.quiet("install luasec " .. test_env.OPENSSL_DIRS))) assert.is_true(run.luarocks_bool("show luasocket")) end) end) describe("LuaRocks install - more complex tests", function() it('LuaRocks install luasec with skipping dependency checks', function() - if test_env.APPVEYOR then - assert.is_true(run.luarocks_bool(test_env.quiet("install luasec " .. test_env.APPVEYOR_OPENSSL .. " --nodeps"))) - else - assert.is_true(run.luarocks_bool(test_env.quiet("install luasec --nodeps"))) - end + assert.is_true(run.luarocks_bool(test_env.quiet("install luasec " .. test_env.OPENSSL_DIRS .. " --nodeps"))) assert.is_true(run.luarocks_bool(test_env.quiet("show luasec"))) if env_variables.TYPE_TEST_ENV == "minimal" then assert.is_false(run.luarocks_bool(test_env.quiet("show luasocket"))) diff --git a/spec/pack_spec.lua b/spec/pack_spec.lua index 21f33b02..3191e80c 100644 --- a/spec/pack_spec.lua +++ b/spec/pack_spec.lua @@ -49,11 +49,7 @@ describe("LuaRocks pack tests #blackbox #b_pack", function() end) it("LuaRocks pack src", function() - if test_env.APPVEYOR then - assert.is_true(run.luarocks_bool(test_env.quiet("install luasec " .. test_env.APPVEYOR_OPENSSL))) - else - assert.is_true(run.luarocks_bool(test_env.quiet("install luasec"))) - end + assert.is_true(run.luarocks_bool(test_env.quiet("install luasec " .. test_env.OPENSSL_DIRS))) assert.is_true(run.luarocks_bool("download --rockspec luasocket 3.0rc1-2")) assert.is_true(run.luarocks_bool("pack luasocket-3.0rc1-2.rockspec")) assert.is_true(test_env.remove_files(lfs.currentdir(), "luasocket-")) diff --git a/spec/upload_spec.lua b/spec/upload_spec.lua index af4c36d3..ff39cb96 100644 --- a/spec/upload_spec.lua +++ b/spec/upload_spec.lua @@ -63,18 +63,10 @@ describe("LuaRocks upload tests #blackbox #b_upload", function() end) it("LuaRocks upload rockspec with api-key", function() - if test_env.APPVEYOR then - assert.is_true(run.luarocks_bool("upload " .. testing_paths.testing_server .. "/luasocket-3.0rc1-2.rockspec " .. test_env.APPVEYOR_OPENSSL .. " --api-key=123", {LUAROCKS_CONFIG = testing_paths.testing_dir .. "/luarocks_site.lua"})) - else - assert.is_true(run.luarocks_bool("upload " .. testing_paths.testing_server .. "/luasocket-3.0rc1-2.rockspec --api-key=123", {LUAROCKS_CONFIG = testing_paths.testing_dir .. "/luarocks_site.lua"})) - end + assert.is_true(run.luarocks_bool("upload " .. testing_paths.testing_server .. "/luasocket-3.0rc1-2.rockspec " .. test_env.OPENSSL_DIRS .. " --api-key=123", {LUAROCKS_CONFIG = testing_paths.testing_dir .. "/luarocks_site.lua"})) end) it("LuaRocks upload rockspec with api-key and skip-pack", function() - if test_env.APPVEYOR then - assert.is_true(run.luarocks_bool("upload --skip-pack " .. testing_paths.testing_server .. "/luasocket-3.0rc1-2.rockspec " .. test_env.APPVEYOR_OPENSSL .. " --api-key=123", {LUAROCKS_CONFIG = testing_paths.testing_dir .. "/luarocks_site.lua"})) - else - assert.is_true(run.luarocks_bool("upload --skip-pack " .. testing_paths.testing_server .. "/luasocket-3.0rc1-2.rockspec --api-key=123", {LUAROCKS_CONFIG = testing_paths.testing_dir .. "/luarocks_site.lua"})) - end + assert.is_true(run.luarocks_bool("upload --skip-pack " .. testing_paths.testing_server .. "/luasocket-3.0rc1-2.rockspec " .. test_env.OPENSSL_DIRS .. " --api-key=123", {LUAROCKS_CONFIG = testing_paths.testing_dir .. "/luarocks_site.lua"})) end) end) end) -- cgit v1.2.3-55-g6feb From 523af94efbedba37bf62279b88e1334fb64c4924 Mon Sep 17 00:00:00 2001 From: Hisham Date: Mon, 22 Aug 2016 16:01:43 -0300 Subject: Add support for testing using MinGW --- appveyor.yml | 18 +++++++++++++++++- test/test_environment.lua | 11 ++++++----- 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 66a12896..0220514f 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -7,10 +7,25 @@ environment: matrix: - LUA: "lua 5.1" + COMPILER: "msvc" - LUA: "lua 5.2" + COMPILER: "msvc" - LUA: "lua 5.3" + COMPILER: "msvc" - LUA: "luajit 2.0" + COMPILER: "msvc" - LUA: "luajit 2.1" + COMPILER: "msvc" + - LUA: "lua 5.1" + COMPILER: "mingw" + - LUA: "lua 5.2" + COMPILER: "mingw" + - LUA: "lua 5.3" + COMPILER: "mingw" + - LUA: "luajit 2.0" + COMPILER: "mingw" + - LUA: "luajit 2.1" + COMPILER: "mingw" init: @@ -28,7 +43,8 @@ build_script: - luarocks install busted 1> NUL 2> NUL test_script: - - busted --lpath=.//?.lua --exclude-tags=ssh,unix,mock -Xhelper appveyor + - set PATH=C:\MinGW\bin;%PATH% # Add MinGW compiler to the path + - busted --lpath=.//?.lua --exclude-tags=ssh,unix,mock -Xhelper appveyor,%COMPILER% after_test: - if "%LUA%"=="lua 5.1" (luarocks show bit32 || luarocks install bit32) diff --git a/test/test_environment.lua b/test/test_environment.lua index 37bd38f1..f7cdcaa1 100644 --- a/test/test_environment.lua +++ b/test/test_environment.lua @@ -171,6 +171,10 @@ function test_env.set_args() test_env.APPVEYOR_OPENSSL = "OPENSSL_LIBDIR=C:\\OpenSSL-Win32\\lib OPENSSL_INCDIR=C:\\OpenSSL-Win32\\include" elseif argument:find("^os=") then test_env.TEST_TARGET_OS = argument:match("^os=(.*)$") + elseif argument == "mingw" then + test_env.MINGW = true + elseif argument == "msvc" then + test_env.MINGW = false else help() end @@ -629,11 +633,8 @@ local function install_luarocks(install_env_vars) local testing_paths = test_env.testing_paths title("Installing LuaRocks") if test_env.TEST_TARGET_OS == "windows" then - if test_env.LUA_V then - assert(execute_bool("install.bat /LUA " .. testing_paths.luadir .. " /LV " .. test_env.LUA_V .. " /P " .. testing_paths.testing_lrprefix .. " /NOREG /NOADMIN /F /Q /CONFIG " .. testing_paths.testing_lrprefix .. "/etc/luarocks", false, install_env_vars)) - else - assert(execute_bool("install.bat /LUA " .. testing_paths.luadir .. " /P " .. testing_paths.testing_lrprefix .. " /NOREG /NOADMIN /F /Q /CONFIG " .. testing_paths.testing_lrprefix .. "/etc/luarocks", false, install_env_vars)) - end + local compiler_flag = test_env.MINGW and "/MW" or "" + assert(execute_bool("install.bat /LUA " .. testing_paths.luadir .. " " .. compiler_flag .. " /P " .. testing_paths.testing_lrprefix .. " /NOREG /NOADMIN /F /Q /CONFIG " .. testing_paths.testing_lrprefix .. "/etc/luarocks", false, install_env_vars)) assert(execute_bool(testing_paths.win_tools .. "/cp " .. testing_paths.testing_lrprefix .. "/lua/luarocks/site_config* " .. testing_paths.src_dir .. "/luarocks/site_config.lua")) else local configure_cmd = "./configure --with-lua=" .. testing_paths.luadir .. " --prefix=" .. testing_paths.testing_lrprefix -- cgit v1.2.3-55-g6feb From ec177a4227d14ad28556baa5132376337feea7fb Mon Sep 17 00:00:00 2001 From: Hisham Date: Mon, 22 Aug 2016 17:24:22 -0300 Subject: Build Lua using the same compiler as the one we're testing --- appveyor.yml | 20 ++++++++++---------- test/test_environment.lua | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 0220514f..94fd6289 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -7,23 +7,23 @@ environment: matrix: - LUA: "lua 5.1" - COMPILER: "msvc" - - LUA: "lua 5.2" - COMPILER: "msvc" - - LUA: "lua 5.3" - COMPILER: "msvc" - - LUA: "luajit 2.0" - COMPILER: "msvc" - - LUA: "luajit 2.1" - COMPILER: "msvc" + COMPILER: "vs" - LUA: "lua 5.1" COMPILER: "mingw" + - LUA: "lua 5.2" + COMPILER: "vs" - LUA: "lua 5.2" COMPILER: "mingw" + - LUA: "lua 5.3" + COMPILER: "vs" - LUA: "lua 5.3" COMPILER: "mingw" + - LUA: "luajit 2.0" + COMPILER: "vs" - LUA: "luajit 2.0" COMPILER: "mingw" + - LUA: "luajit 2.1" + COMPILER: "vs" - LUA: "luajit 2.1" COMPILER: "mingw" @@ -36,7 +36,7 @@ init: before_build: - set PATH=C:\Python27\Scripts;%PATH% # Add directory containing 'pip' to PATH - pip install hererocks - - hererocks env --%LUA% -rlatest + - hererocks env --%LUA% -rlatest --target=%COMPILER% - call env\bin\activate build_script: diff --git a/test/test_environment.lua b/test/test_environment.lua index f7cdcaa1..764cd65f 100644 --- a/test/test_environment.lua +++ b/test/test_environment.lua @@ -173,7 +173,7 @@ function test_env.set_args() test_env.TEST_TARGET_OS = argument:match("^os=(.*)$") elseif argument == "mingw" then test_env.MINGW = true - elseif argument == "msvc" then + elseif argument == "vs" then test_env.MINGW = false else help() -- cgit v1.2.3-55-g6feb From 35ff15f4ce2f5345df07d8512db65f170a50d4ab Mon Sep 17 00:00:00 2001 From: Hisham Date: Mon, 22 Aug 2016 17:40:29 -0300 Subject: Put MinGW in PATH for hererocks too --- appveyor.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 94fd6289..1d29b18d 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -32,6 +32,8 @@ init: # Setup Lua development/build environment # Make VS 2015 command line tools available - call "%ProgramFiles(x86)%\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" %platform% +# Add MinGW compiler to the path +- set PATH=C:\MinGW\bin;%PATH% before_build: - set PATH=C:\Python27\Scripts;%PATH% # Add directory containing 'pip' to PATH @@ -43,7 +45,6 @@ build_script: - luarocks install busted 1> NUL 2> NUL test_script: - - set PATH=C:\MinGW\bin;%PATH% # Add MinGW compiler to the path - busted --lpath=.//?.lua --exclude-tags=ssh,unix,mock -Xhelper appveyor,%COMPILER% after_test: -- cgit v1.2.3-55-g6feb From 0e5cc18334cce0680d1b7be1050b2e67e019e286 Mon Sep 17 00:00:00 2001 From: Hisham Date: Mon, 22 Aug 2016 18:05:07 -0300 Subject: Run failing test with --verbose --- spec/build_spec.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/build_spec.lua b/spec/build_spec.lua index b4f838ca..f2c14e8e 100644 --- a/spec/build_spec.lua +++ b/spec/build_spec.lua @@ -92,7 +92,7 @@ describe("LuaRocks build tests #blackbox #b_build", function() describe("LuaRocks build - basic builds", function() it("LuaRocks build luadoc", function() - assert.is_true(run.luarocks_bool(test_env.quiet("build luadoc"))) + assert.is_true(run.luarocks_bool("build luadoc --verbose")) end) it("LuaRocks build luacov diff version", function() -- cgit v1.2.3-55-g6feb From af41c31d62c4e44c9f5c12a8ce10d6d49aa05347 Mon Sep 17 00:00:00 2001 From: Hisham Date: Mon, 22 Aug 2016 18:36:30 -0300 Subject: Use Unix makefile by default on MinGW; Makefile.win is a leftover from Kepler days, and those are usually NMAKE makefiles for MSVC. --- src/luarocks/cfg.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/src/luarocks/cfg.lua b/src/luarocks/cfg.lua index d84ebc6e..bcb30342 100644 --- a/src/luarocks/cfg.lua +++ b/src/luarocks/cfg.lua @@ -468,6 +468,7 @@ if cfg.platforms.mingw32 then defaults.variables.LD = "mingw32-gcc" defaults.variables.CFLAGS = "-O2" defaults.variables.LIBFLAG = "-shared" + defaults.makefile = "Makefile" defaults.external_deps_patterns = { bin = { "?.exe", "?.bat" }, -- mingw lookup list from http://stackoverflow.com/a/15853231/1793220 -- cgit v1.2.3-55-g6feb From a57e1f97870bb25aec22b886b731689e61884ed5 Mon Sep 17 00:00:00 2001 From: Peter Melnichenko Date: Mon, 22 Aug 2016 19:55:21 +0300 Subject: Remove a redundant check in install.bat check_flags() already ensures that if bundled Lua is being installed LUA_VERSION is 5.1. --- install.bat | 3 --- 1 file changed, 3 deletions(-) diff --git a/install.bat b/install.bat index e28734dc..7ed59525 100644 --- a/install.bat +++ b/install.bat @@ -763,9 +763,6 @@ vars.INCDIR = S"$PREFIX\\include" vars.LUA_SHORTV = vars.LUA_VERSION:gsub("%.", "") if INSTALL_LUA then - if vars.LUA_VERSION ~= "5.1" then - die("Cannot install own copy of Lua because only 5.1 is bundled") - end vars.LUA_INTERPRETER = "lua5.1" vars.LUA_BINDIR = vars.BINDIR vars.LUA_LIBDIR = vars.LIBDIR -- cgit v1.2.3-55-g6feb From b603e64b7e41e718157e98d1bcfa8673351b87f9 Mon Sep 17 00:00:00 2001 From: Peter Melnichenko Date: Mon, 22 Aug 2016 20:03:15 +0300 Subject: install.bat: get rid of vars.LUA_LIB_NAMES Generate list of names when needed instead of pregenerating a list of 5.1 and then changing it when LUA_VERSION is different. --- install.bat | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/install.bat b/install.bat index 7ed59525..bdde4413 100644 --- a/install.bat +++ b/install.bat @@ -24,10 +24,6 @@ vars.LUA_LIBDIR = nil vars.LUA_LIBNAME = nil vars.LUA_VERSION = "5.1" vars.LUA_SHORTV = nil -- "51" --- MinGW does not generate .lib, nor needs it to link, but MSVC does --- so .lib must be listed first to ensure they are found first if present. --- To prevent MSVC trying to link to a .dll, which won't work. -vars.LUA_LIB_NAMES = "lua5.1.lib lua51.lib lua5.1.dll lua51.dll liblua.dll.a" vars.LUA_RUNTIME = nil vars.UNAME_M = nil vars.COMPILER_ENV_CMD = nil @@ -273,14 +269,8 @@ local function check_flags() die("Bundled Lua version is 5.1, cannot install "..vars.LUA_VERSION) end end - if vars.LUA_VERSION ~= "5.1" then - if vars.LUA_VERSION == "5.2" then - vars.LUA_LIB_NAMES = vars.LUA_LIB_NAMES:gsub("5([%.]?)1", "5%12") - elseif vars.LUA_VERSION == "5.3" then - vars.LUA_LIB_NAMES = vars.LUA_LIB_NAMES:gsub("5([%.]?)1", "5%13") - else - die("Bad argument: /LV must either be 5.1, 5.2, or 5.3") - end + if not vars.LUA_VERSION:match("^5%.[123]$") then + die("Bad argument: /LV must either be 5.1, 5.2, or 5.3") end if USE_MSVC_MANUAL and USE_MINGW then die("Cannot combine option /MSVC and /MW") @@ -339,7 +329,6 @@ local function look_for_interpreter(directory) else vars.LUA_VERSION = version vars.LUA_SHORTV = version:gsub("%.", "") - vars.LUA_LIB_NAMES = vars.LUA_LIB_NAMES:gsub("5([%.]?)[123]", "5%1" .. version:sub(-1)) end end @@ -358,6 +347,10 @@ local function look_for_interpreter(directory) end local function look_for_link_libraries(directory) + -- MinGW does not generate .lib, nor needs it to link, but MSVC does, + -- so .lib must be listed first to ensure they are found first if present, + -- to prevent MSVC trying to link to a .dll, which won't work. + local names = {S"lua$LUA_VERSION.lib", S"lua$LUA_SHORTV.lib", S"lua$LUA_VERSION.dll", S"lua$LUA_SHORTV.dll", "liblua.dll.a"} local directories if vars.LUA_LIBDIR then directories = {vars.LUA_LIBDIR} @@ -366,7 +359,7 @@ local function look_for_link_libraries(directory) end for _, dir in ipairs(directories) do - for name in vars.LUA_LIB_NAMES:gmatch("[^%s]+") do + for _, name in ipairs(names) do local full_name = dir .. "\\" .. name print(" checking for " .. full_name) if exists(full_name) then @@ -379,7 +372,7 @@ local function look_for_link_libraries(directory) end if vars.LUA_LIBDIR then - die(S"link library (one of; $LUA_LIB_NAMES) not found in $LUA_LIBDIR") + die(("Link library (one of %s) not found in %s"):format(table.concat(names, ", "), vars.LUA_LIBDIR)) end return false end -- cgit v1.2.3-55-g6feb From 4c837a0c953f0dd83485d65979893c3c773eb1ba Mon Sep 17 00:00:00 2001 From: Peter Melnichenko Date: Mon, 22 Aug 2016 20:14:43 +0300 Subject: install.bat: get rid of string splitting function --- install.bat | 33 +++------------------------------ 1 file changed, 3 insertions(+), 30 deletions(-) diff --git a/install.bat b/install.bat index bdde4413..cfa080e5 100644 --- a/install.bat +++ b/install.bat @@ -53,32 +53,6 @@ local function die(message) os.exit(1) end -local function split_string(str, delim, maxNb) - -- Eliminate bad cases... - if string.find(str, delim) == nil then - return { str } - end - if maxNb == nil or maxNb < 1 then - maxNb = 0 -- No limit - end - local result = {} - local pat = "(.-)" .. delim .. "()" - local nb = 0 - local lastPos - for part, pos in string.gmatch(str, pat) do - nb = nb + 1 - result[nb] = part - lastPos = pos - if nb == maxNb then break end - end - -- Handle the last field - if nb ~= maxNb then - result[nb + 1] = string.sub(str, lastPos) - end - return result -end - - local function exec(cmd) --print(cmd) local status = os.execute("type NUL && "..cmd) @@ -567,16 +541,15 @@ local function get_possible_lua_directories() -- No prefix given, so use PATH. local path = os.getenv("PATH") or "" - path = path:gsub(";+", ";") -- Remove duplicates. - local directories = split_string(path, ";") - for i, dir in ipairs(directories) do + local directories = {} + for dir in path:gmatch("[^;]+") do -- Remove trailing backslashes, but not from a drive letter like `C:\`. dir = dir:gsub("([^:])\\+$", "%1") -- Remove trailing `bin` subdirectory, the searcher will check there anyway. if dir:upper():match("[:\\]BIN$") then dir = dir:sub(1, -5) end - directories[i] = dir + table.insert(directories, dir) end -- Finally add some other default paths. table.insert(directories, [[c:\lua5.1.2]]) -- cgit v1.2.3-55-g6feb From 00c12a63ed41c1506b84d5682d8c457c40ae8872 Mon Sep 17 00:00:00 2001 From: Hisham Date: Tue, 23 Aug 2016 13:21:57 -0300 Subject: Revert verbose after debugging --- spec/build_spec.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/build_spec.lua b/spec/build_spec.lua index f2c14e8e..b4f838ca 100644 --- a/spec/build_spec.lua +++ b/spec/build_spec.lua @@ -92,7 +92,7 @@ describe("LuaRocks build tests #blackbox #b_build", function() describe("LuaRocks build - basic builds", function() it("LuaRocks build luadoc", function() - assert.is_true(run.luarocks_bool("build luadoc --verbose")) + assert.is_true(run.luarocks_bool(test_env.quiet("build luadoc"))) end) it("LuaRocks build luacov diff version", function() -- cgit v1.2.3-55-g6feb