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 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