From 365c5a4bb52dead8d9f040d9857da448b194ada9 Mon Sep 17 00:00:00 2001 From: Hisham Muhammad Date: Fri, 13 Jul 2018 22:51:33 -0300 Subject: Tests: support running with the default detected OpenSSL locations --- spec/build_spec.lua | 9 +++------ spec/install_spec.lua | 6 ++---- spec/upload_spec.lua | 6 ++---- spec/util/test_env.lua | 7 +++++-- 4 files changed, 12 insertions(+), 16 deletions(-) (limited to 'spec') diff --git a/spec/build_spec.lua b/spec/build_spec.lua index 982db801..0aaa6d63 100644 --- a/spec/build_spec.lua +++ b/spec/build_spec.lua @@ -202,8 +202,7 @@ describe("LuaRocks build tests #integration", function() end) it("LuaRocks build luasec with skipping dependency checks", function() - 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_true(run.luarocks_bool("build luasec 0.6-1 " .. test_env.openssl_dirs .. " --nodeps")) assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/luasec/0.6-1/luasec-0.6-1.rockspec")) end) @@ -263,8 +262,7 @@ describe("LuaRocks build tests #integration", function() end it("LuaRocks build luasec only deps", function() - 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_true(run.luarocks_bool("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_rocks .. "/luasec/0.6-1/luasec-0.6-1.rockspec")) end) @@ -288,9 +286,8 @@ 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 " .. openssl_dirs)) + assert.is_true(run.luarocks_bool("install luasec " .. test_env.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 f4d8a418..8a5d8f09 100644 --- a/spec/install_spec.lua +++ b/spec/install_spec.lua @@ -85,8 +85,7 @@ describe("luarocks install #integration", function() end) it("installs a package with a dependency", function() - 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("install luasec " .. test_env.openssl_dirs)) assert.is_true(run.luarocks_bool("show luasocket")) end) end) @@ -139,8 +138,7 @@ describe("luarocks install #integration", function() describe("more complex tests", function() it('luasec with skipping dependency checks', function() - 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("install luasec " .. test_env.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 8290feca..76a27ee3 100644 --- a/spec/upload_spec.lua +++ b/spec/upload_spec.lua @@ -37,13 +37,11 @@ describe("LuaRocks upload tests #integration", function() after_each(test_env.mock_server_done) it("LuaRocks upload rockspec with api-key", function() - 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"})) + 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"})) end) it("LuaRocks upload rockspec with api-key and skip-pack", function() - 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"})) + 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"})) end) end) end) diff --git a/spec/util/test_env.lua b/spec/util/test_env.lua index db5cd203..d5bd90d3 100644 --- a/spec/util/test_env.lua +++ b/spec/util/test_env.lua @@ -208,8 +208,6 @@ 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_INCDIR = "" - test_env.OPENSSL_LIBDIR = "" test_env.RESET_ENV = true for _, argument in ipairs(arg) do @@ -277,6 +275,11 @@ function test_env.set_args() test_env.lib_extension = "so" end + test_env.openssl_dirs = "" + if test_env.OPENSSL_INCDIR then + test_env.openssl_dirs = "OPENSSL_INCDIR=" .. test_env.OPENSSL_INCDIR .. " OPENSSL_LIBDIR=" .. test_env.OPENSSL_LIBDIR + end + return true end -- cgit v1.2.3-55-g6feb