aboutsummaryrefslogtreecommitdiff
path: root/spec/util
diff options
context:
space:
mode:
authorHisham Muhammad <hisham@gobolinux.org>2018-05-07 11:22:07 -0300
committerHisham Muhammad <hisham@gobolinux.org>2018-05-07 19:27:37 -0300
commit1dcdaa77c0a52ad02f49bc7fdde2fd7dee956ddf (patch)
tree30a6e8dbabc0e36b3a9ff25dfde2fa60327ae402 /spec/util
parent5bff41c6b4adac49c0456f125c9f208b0a429d86 (diff)
downloadluarocks-1dcdaa77c0a52ad02f49bc7fdde2fd7dee956ddf.tar.gz
luarocks-1dcdaa77c0a52ad02f49bc7fdde2fd7dee956ddf.tar.bz2
luarocks-1dcdaa77c0a52ad02f49bc7fdde2fd7dee956ddf.zip
Tests: test the "busted" backend of `luarocks test` with a local fixture
Diffstat (limited to 'spec/util')
-rw-r--r--spec/util/mock-server.lua2
-rw-r--r--spec/util/test_env.lua6
2 files changed, 3 insertions, 5 deletions
diff --git a/spec/util/mock-server.lua b/spec/util/mock-server.lua
index 9b510d3b..ae41b964 100644
--- a/spec/util/mock-server.lua
+++ b/spec/util/mock-server.lua
@@ -70,7 +70,7 @@ server:add_resource("/file/{name:[^/]+}", {
70 path = "/", 70 path = "/",
71 produces = "text/plain", 71 produces = "text/plain",
72 handler = function(query, name) 72 handler = function(query, name)
73 local basedir = arg[1] or "." 73 local basedir = arg[1] or "./spec/fixtures"
74 local fd = io.open(basedir .. "/" .. name, "r") 74 local fd = io.open(basedir .. "/" .. name, "r")
75 if not fd then 75 if not fd then
76 return restserver.response():status(404) 76 return restserver.response():status(404)
diff --git a/spec/util/test_env.lua b/spec/util/test_env.lua
index 7b5b66b9..f55fb53a 100644
--- a/spec/util/test_env.lua
+++ b/spec/util/test_env.lua
@@ -506,6 +506,7 @@ local function create_paths(luaversion_full)
506 end 506 end
507 507
508 testing_paths.fixtures_dir = base_dir .. "/spec/fixtures" 508 testing_paths.fixtures_dir = base_dir .. "/spec/fixtures"
509 testing_paths.fixtures_repo_dir = base_dir .. "/spec/fixtures/a_repo"
509 testing_paths.util_dir = base_dir .. "/spec/util" 510 testing_paths.util_dir = base_dir .. "/spec/util"
510 testing_paths.testrun_dir = base_dir .. "/testrun" 511 testing_paths.testrun_dir = base_dir .. "/testrun"
511 testing_paths.src_dir = base_dir .. "/src" 512 testing_paths.src_dir = base_dir .. "/src"
@@ -763,12 +764,9 @@ end
763function test_env.mock_server_init() 764function test_env.mock_server_init()
764 local testing_paths = test_env.testing_paths 765 local testing_paths = test_env.testing_paths
765 assert(test_env.need_rock("restserver-xavante")) 766 assert(test_env.need_rock("restserver-xavante"))
766 local pwd = lfs.currentdir() 767 local final_command = test_env.execute_helper(testing_paths.lua .. " " .. testing_paths.util_dir .. "/mock-server.lua " .. testing_paths.fixtures_dir .. " &", true, test_env.env_variables)
767 lfs.chdir(testing_paths.fixtures_dir)
768 local final_command = test_env.execute_helper(testing_paths.lua .. " " .. testing_paths.util_dir .. "/mock-server.lua &", true, test_env.env_variables)
769 os.execute(final_command) 768 os.execute(final_command)
770 os.execute("sleep 1") 769 os.execute("sleep 1")
771 lfs.chdir(pwd)
772end 770end
773 771
774function test_env.mock_server_done() 772function test_env.mock_server_done()