aboutsummaryrefslogtreecommitdiff
path: root/spec/util/test_env.lua
diff options
context:
space:
mode:
Diffstat (limited to 'spec/util/test_env.lua')
-rw-r--r--spec/util/test_env.lua26
1 files changed, 21 insertions, 5 deletions
diff --git a/spec/util/test_env.lua b/spec/util/test_env.lua
index f55fb53a..48914311 100644
--- a/spec/util/test_env.lua
+++ b/spec/util/test_env.lua
@@ -380,8 +380,12 @@ local function create_env(testing_paths)
380 env_variables.LUA_PATH = env_variables.LUA_PATH .. testing_paths.testing_sys_tree .. "/share/lua/" .. luaversion_short .. "/?.lua;" 380 env_variables.LUA_PATH = env_variables.LUA_PATH .. testing_paths.testing_sys_tree .. "/share/lua/" .. luaversion_short .. "/?.lua;"
381 env_variables.LUA_PATH = env_variables.LUA_PATH .. testing_paths.testing_sys_tree .. "/share/lua/".. luaversion_short .. "/?/init.lua;" 381 env_variables.LUA_PATH = env_variables.LUA_PATH .. testing_paths.testing_sys_tree .. "/share/lua/".. luaversion_short .. "/?/init.lua;"
382 env_variables.LUA_PATH = env_variables.LUA_PATH .. testing_paths.src_dir .. "/?.lua;" 382 env_variables.LUA_PATH = env_variables.LUA_PATH .. testing_paths.src_dir .. "/?.lua;"
383 env_variables.LUA_CPATH = testing_paths.testing_tree .. "/lib/lua/" .. luaversion_short .. "/?.so;" 383 local lib_extension = "so"
384 .. testing_paths.testing_sys_tree .. "/lib/lua/" .. luaversion_short .. "/?.so;" 384 if test_env.TEST_TARGET_OS == "windows" then
385 lib_extension = "dll"
386 end
387 env_variables.LUA_CPATH = testing_paths.testing_tree .. "/lib/lua/" .. luaversion_short .. "/?." .. lib_extension .. ";"
388 .. testing_paths.testing_sys_tree .. "/lib/lua/" .. luaversion_short .. "/?." .. lib_extension .. ";"
385 env_variables.PATH = os.getenv("PATH") .. ";" .. testing_paths.testing_tree .. "/bin;" .. testing_paths.testing_sys_tree .. "/bin;" 389 env_variables.PATH = os.getenv("PATH") .. ";" .. testing_paths.testing_tree .. "/bin;" .. testing_paths.testing_sys_tree .. "/bin;"
386 390
387 return env_variables 391 return env_variables
@@ -764,13 +768,25 @@ end
764function test_env.mock_server_init() 768function test_env.mock_server_init()
765 local testing_paths = test_env.testing_paths 769 local testing_paths = test_env.testing_paths
766 assert(test_env.need_rock("restserver-xavante")) 770 assert(test_env.need_rock("restserver-xavante"))
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) 771 local final_command
772 local sleep_command
773 if test_env.TEST_TARGET_OS == "windows" then
774 final_command = test_env.execute_helper("start /b \"\" " .. Q(testing_paths.lua) .. " " .. Q(testing_paths.util_dir .. "/mock-server.lua") .. " " .. Q(testing_paths.fixtures_dir), true, test_env.env_variables)
775 sleep_command = "timeout 1 > NUL"
776 else
777 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)
778 sleep_command = "sleep 1"
779 end
768 os.execute(final_command) 780 os.execute(final_command)
769 os.execute("sleep 1") 781 os.execute(sleep_command)
770end 782end
771 783
772function test_env.mock_server_done() 784function test_env.mock_server_done()
773 os.execute("curl localhost:8080/shutdown") 785 if test_env.TEST_TARGET_OS == "windows" then
786 os.execute(Q(test_env.testing_paths.win_tools .. "/wget") .. " --quiet --timeout=5 --tries=1 localhost:8080/shutdown")
787 else
788 os.execute("curl localhost:8080/shutdown")
789 end
774end 790end
775 791
776--- 792---