aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Melnichenko <mpeterval@gmail.com>2017-09-11 13:57:36 +0300
committerGitHub <noreply@github.com>2017-09-11 13:57:36 +0300
commitea62f7c3d00656664824d9519507b5068406b5d0 (patch)
tree9f07370dee4bc435fb6eac5c42780547317a7ba0
parent54bb40a807772a5f93d6a0d262f5a22174d44883 (diff)
parent85701e003241798e36b81ed1e3ed285f7bf5c7a0 (diff)
downloadluarocks-ea62f7c3d00656664824d9519507b5068406b5d0.tar.gz
luarocks-ea62f7c3d00656664824d9519507b5068406b5d0.tar.bz2
luarocks-ea62f7c3d00656664824d9519507b5068406b5d0.zip
Merge pull request #728 from mpeterv/test-fixes
Fix spec failure under LuaJIT 2.1.0-beta3 + other test fixes
-rw-r--r--spec/upload_spec.lua11
-rw-r--r--test/test_environment.lua6
2 files changed, 8 insertions, 9 deletions
diff --git a/spec/upload_spec.lua b/spec/upload_spec.lua
index ff39cb96..6ec8e302 100644
--- a/spec/upload_spec.lua
+++ b/spec/upload_spec.lua
@@ -5,8 +5,6 @@ local testing_paths = test_env.testing_paths
5test_env.unload_luarocks() 5test_env.unload_luarocks()
6 6
7local extra_rocks = { 7local extra_rocks = {
8 "/lua-cjson-2.1.0-1.src.rock",
9
10 -- rocks needed for mock-server 8 -- rocks needed for mock-server
11 "/copas-2.0.1-1.src.rock", 9 "/copas-2.0.1-1.src.rock",
12 "/coxpcall-1.16.0-1.src.rock", 10 "/coxpcall-1.16.0-1.src.rock",
@@ -42,18 +40,17 @@ describe("LuaRocks upload tests #blackbox #b_upload", function()
42 end) 40 end)
43 41
44 it("LuaRocks upload api key invalid and skip-pack", function() 42 it("LuaRocks upload api key invalid and skip-pack", function()
45 assert.is_false(run.luarocks_bool("upload --api-key=\"invalid\" --skip-pack luacov-0.11.0-1.rockspec")) 43 assert.is_false(run.luarocks_bool("upload --api-key=\"invalid\" --skip-pack " .. testing_paths.testing_server .. "/luasocket-3.0rc1-2.rockspec"))
46 end) 44 end)
47 45
48 it("LuaRocks upload force #unix", function() 46 it("LuaRocks upload force #unix", function()
49 assert.is_true(run.luarocks_bool("install lua-cjson")) 47 assert.is_true(test_env.need_rock("dkjson"))
50 assert.is_false(run.luarocks_bool("upload --api-key=\"invalid\" --force luacov-0.11.0-1.rockspec")) 48 assert.is_false(run.luarocks_bool("upload --api-key=\"invalid\" --force " .. testing_paths.testing_server .. "/luasocket-3.0rc1-2.rockspec"))
51 assert.is_true(run.luarocks_bool("install lua-cjson"))
52 end) 49 end)
53 50
54 describe("LuaRocks upload tests with Xavante server #mock", function() 51 describe("LuaRocks upload tests with Xavante server #mock", function()
55 before_each(function() 52 before_each(function()
56 assert.is.truthy(test_env.need_rock("restserver-xavante")) 53 assert.is_true(test_env.need_rock("restserver-xavante"))
57 local final_command = test_env.execute_helper(testing_paths.lua .. " " .. testing_paths.testing_dir .. "/mock-server.lua &", true, test_env.env_variables) 54 local final_command = test_env.execute_helper(testing_paths.lua .. " " .. testing_paths.testing_dir .. "/mock-server.lua &", true, test_env.env_variables)
58 os.execute(final_command) 55 os.execute(final_command)
59 end) 56 end)
diff --git a/test/test_environment.lua b/test/test_environment.lua
index 6f6f1cfe..bc1e5277 100644
--- a/test/test_environment.lua
+++ b/test/test_environment.lua
@@ -285,7 +285,7 @@ end
285-- @param save_path string: path to directory, where to download rocks/rockspecs 285-- @param save_path string: path to directory, where to download rocks/rockspecs
286-- @return make_manifest boolean: true if new rocks downloaded 286-- @return make_manifest boolean: true if new rocks downloaded
287local function download_rocks(urls, save_path) 287local function download_rocks(urls, save_path)
288 local luarocks_repo = "https://www.luarocks.org" 288 local luarocks_repo = "https://luarocks.org"
289 local make_manifest = false 289 local make_manifest = false
290 290
291 for _, url in ipairs(urls) do 291 for _, url in ipairs(urls) do
@@ -533,7 +533,9 @@ function test_env.setup_specs(extra_rocks)
533 end 533 end
534end 534end
535 535
536--- Test if required rock is installed if not, install it 536--- Test if required rock is installed and if not, install it.
537-- Return `true` if the rock is already installed or has been installed successfully,
538-- `false` if installation failed.
537function test_env.need_rock(rock) 539function test_env.need_rock(rock)
538 print("Check if " .. rock .. " is installed") 540 print("Check if " .. rock .. " is installed")
539 if test_env.run.luarocks_noprint_nocov(test_env.quiet("show " .. rock)) then 541 if test_env.run.luarocks_noprint_nocov(test_env.quiet("show " .. rock)) then