From 67a8c5c13f057163273c15dea73491a86f61c676 Mon Sep 17 00:00:00 2001 From: George Roman Date: Wed, 4 Jul 2018 00:44:00 +0300 Subject: Tests: separate OPENSSL_DIRS into OPENSSL_INCDIR and OPENSSL_LIBDIR --- spec/build_spec.lua | 9 ++++++--- spec/install_spec.lua | 6 ++++-- spec/upload_spec.lua | 7 +++++-- spec/util/test_env.lua | 18 +++++++++++++++--- 4 files changed, 30 insertions(+), 10 deletions(-) (limited to 'spec') diff --git a/spec/build_spec.lua b/spec/build_spec.lua index 74efccd5..c7fd2a22 100644 --- a/spec/build_spec.lua +++ b/spec/build_spec.lua @@ -161,7 +161,8 @@ describe("LuaRocks build tests #integration", function() end) it("LuaRocks build luasec with skipping dependency checks", function() - assert.is_true(run.luarocks_bool("build luasec 0.6-1 " .. test_env.OPENSSL_DIRS .. " --nodeps")) + local openssl_dirs = "OPENSSL_INCDIR=" .. test_env.OPENSSL_INCDIR .. " OPENSSL_LIBDIR=" .. test_env.OPENSSL_LIBDIR + assert.is_true(run.luarocks_bool("build luasec 0.6-1 " .. openssl_dirs .. " --nodeps")) assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/luasec/0.6-1/luasec-0.6-1.rockspec")) end) @@ -221,7 +222,8 @@ describe("LuaRocks build tests #integration", function() end it("LuaRocks build luasec only deps", function() - assert.is_true(run.luarocks_bool("build luasec " .. test_env.OPENSSL_DIRS .. " --only-deps")) + local openssl_dirs = "OPENSSL_INCDIR=" .. test_env.OPENSSL_INCDIR .. " OPENSSL_LIBDIR=" .. test_env.OPENSSL_LIBDIR + assert.is_true(run.luarocks_bool("build luasec " .. openssl_dirs .. " --only-deps")) assert.is_false(run.luarocks_bool("show luasec")) assert.is.falsy(lfs.attributes(testing_paths.testing_sys_rocks .. "/luasec/0.6-1/luasec-0.6-1.rockspec")) end) @@ -255,8 +257,9 @@ describe("LuaRocks build tests #integration", function() end) it("LuaRocks build with https", function() + local openssl_dirs = "OPENSSL_INCDIR=" .. test_env.OPENSSL_INCDIR .. " OPENSSL_LIBDIR=" .. test_env.OPENSSL_LIBDIR assert.is_true(run.luarocks_bool("download --rockspec validate-args 1.5.4-1")) - assert.is_true(run.luarocks_bool("install luasec " .. test_env.OPENSSL_DIRS)) + assert.is_true(run.luarocks_bool("install luasec " .. openssl_dirs)) assert.is_true(run.luarocks_bool("build validate-args-1.5.4-1.rockspec")) assert.is.truthy(run.luarocks("show validate-args")) diff --git a/spec/install_spec.lua b/spec/install_spec.lua index 431ca39d..f4d8a418 100644 --- a/spec/install_spec.lua +++ b/spec/install_spec.lua @@ -85,7 +85,8 @@ describe("luarocks install #integration", function() end) it("installs a package with a dependency", function() - assert.is_true(run.luarocks_bool("install luasec " .. test_env.OPENSSL_DIRS)) + local openssl_dirs = "OPENSSL_INCDIR=" .. test_env.OPENSSL_INCDIR .. " OPENSSL_LIBDIR=" .. test_env.OPENSSL_LIBDIR + assert.is_true(run.luarocks_bool("install luasec " .. openssl_dirs)) assert.is_true(run.luarocks_bool("show luasocket")) end) end) @@ -138,7 +139,8 @@ describe("luarocks install #integration", function() describe("more complex tests", function() it('luasec with skipping dependency checks', function() - assert.is_true(run.luarocks_bool("install luasec " .. test_env.OPENSSL_DIRS .. " --nodeps")) + local openssl_dirs = "OPENSSL_INCDIR=" .. test_env.OPENSSL_INCDIR .. " OPENSSL_LIBDIR=" .. test_env.OPENSSL_LIBDIR + assert.is_true(run.luarocks_bool("install luasec " .. openssl_dirs .. " --nodeps")) 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"))) diff --git a/spec/upload_spec.lua b/spec/upload_spec.lua index abf2e43d..8290feca 100644 --- a/spec/upload_spec.lua +++ b/spec/upload_spec.lua @@ -37,10 +37,13 @@ describe("LuaRocks upload tests #integration", function() after_each(test_env.mock_server_done) it("LuaRocks upload rockspec with api-key", function() - assert.is_true(run.luarocks_bool("upload " .. testing_paths.fixtures_dir .. "/a_rock-1.0-1.rockspec " .. test_env.OPENSSL_DIRS .. " --api-key=123", {LUAROCKS_CONFIG = testing_paths.testrun_dir .. "/luarocks_site.lua"})) + local openssl_dirs = "OPENSSL_INCDIR=" .. test_env.OPENSSL_INCDIR .. " OPENSSL_LIBDIR=" .. test_env.OPENSSL_LIBDIR + assert.is_true(run.luarocks_bool("upload " .. testing_paths.fixtures_dir .. "/a_rock-1.0-1.rockspec " .. openssl_dirs .. " --api-key=123", {LUAROCKS_CONFIG = testing_paths.testrun_dir .. "/luarocks_site.lua"})) end) + it("LuaRocks upload rockspec with api-key and skip-pack", function() - assert.is_true(run.luarocks_bool("upload --skip-pack " .. testing_paths.fixtures_dir .. "/a_rock-1.0-1.rockspec " .. test_env.OPENSSL_DIRS .. " --api-key=123", {LUAROCKS_CONFIG = testing_paths.testrun_dir .. "/luarocks_site.lua"})) + local openssl_dirs = "OPENSSL_INCDIR=" .. test_env.OPENSSL_INCDIR .. " OPENSSL_LIBDIR=" .. test_env.OPENSSL_LIBDIR + assert.is_true(run.luarocks_bool("upload --skip-pack " .. testing_paths.fixtures_dir .. "/a_rock-1.0-1.rockspec " .. openssl_dirs .. " --api-key=123", {LUAROCKS_CONFIG = testing_paths.testrun_dir .. "/luarocks_site.lua"})) end) end) end) diff --git a/spec/util/test_env.lua b/spec/util/test_env.lua index 51893e83..db5cd203 100644 --- a/spec/util/test_env.lua +++ b/spec/util/test_env.lua @@ -208,7 +208,8 @@ 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.OPENSSL_INCDIR = "" + test_env.OPENSSL_LIBDIR = "" test_env.RESET_ENV = true for _, argument in ipairs(arg) do @@ -224,7 +225,6 @@ function test_env.set_args() test_env.TRAVIS = true elseif argument == "appveyor" then test_env.APPVEYOR = true - 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=(.*)$") elseif argument == "mingw" then @@ -245,14 +245,26 @@ function test_env.set_args() if package.config:sub(1,1) == "\\" then test_env.TEST_TARGET_OS = "windows" + if test_env.APPVEYOR then + test_env.OPENSSL_INCDIR = "C:\\OpenSSL-Win32\\include" + test_env.OPENSSL_LIBDIR = "C:\\OpenSSL-Win32\\lib" + if test_env.MINGW then + test_env.OPENSSL_LIBDIR = "C:\\OpenSSL-Win32\\bin" + end + end else local system = execute_output("uname -s") if system == "Linux" then test_env.TEST_TARGET_OS = "linux" + if test_env.TRAVIS then + test_env.OPENSSL_INCDIR = "/usr/include" + test_env.OPENSSL_LIBDIR = "/usr/lib/x86_64-linux-gnu" + end elseif system == "Darwin" then test_env.TEST_TARGET_OS = "osx" if test_env.TRAVIS then - test_env.OPENSSL_DIRS = "OPENSSL_LIBDIR=/usr/local/opt/openssl/lib OPENSSL_INCDIR=/usr/local/opt/openssl/include" + test_env.OPENSSL_INCDIR = "/usr/local/opt/openssl/include" + test_env.OPENSSL_LIBDIR = "/usr/local/opt/openssl/lib" end end end -- cgit v1.2.3-55-g6feb