aboutsummaryrefslogtreecommitdiff
path: root/spec/util
diff options
context:
space:
mode:
Diffstat (limited to 'spec/util')
-rw-r--r--spec/util/mock-server.lua2
-rw-r--r--spec/util/test_env.lua28
2 files changed, 15 insertions, 15 deletions
diff --git a/spec/util/mock-server.lua b/spec/util/mock-server.lua
index 8e498d57..1b09cd6b 100644
--- a/spec/util/mock-server.lua
+++ b/spec/util/mock-server.lua
@@ -95,4 +95,4 @@ server:add_resource("/shutdown", {
95}) 95})
96 96
97-- This loads the restserver.xavante plugin 97-- This loads the restserver.xavante plugin
98server:enable("restserver.xavante"):start() \ No newline at end of file 98server:enable("restserver.xavante"):start()
diff --git a/spec/util/test_env.lua b/spec/util/test_env.lua
index 8aebd74e..1585adac 100644
--- a/spec/util/test_env.lua
+++ b/spec/util/test_env.lua
@@ -55,7 +55,7 @@ local function Q(arg)
55 if arg:match("^"..drive_letter) then 55 if arg:match("^"..drive_letter) then
56 arg = arg:gsub("/", "\\") 56 arg = arg:gsub("/", "\\")
57 end 57 end
58 58
59 if arg == "\\" then 59 if arg == "\\" then
60 return '\\' -- CHDIR needs special handling for root dir 60 return '\\' -- CHDIR needs special handling for root dir
61 end 61 end
@@ -128,10 +128,10 @@ end
128function test_env.execute_helper(command, print_command, env_variables) 128function test_env.execute_helper(command, print_command, env_variables)
129 local final_command = "" 129 local final_command = ""
130 130
131 if print_command then 131 if print_command then
132 print("[EXECUTING]: " .. command) 132 print("[EXECUTING]: " .. command)
133 end 133 end
134 134
135 local unset_variables = { 135 local unset_variables = {
136 "LUA_PATH", 136 "LUA_PATH",
137 "LUA_CPATH", 137 "LUA_CPATH",
@@ -178,7 +178,7 @@ end
178-- @return true/false boolean: status of the command execution 178-- @return true/false boolean: status of the command execution
179local function execute_bool(command, print_command, env_variables) 179local function execute_bool(command, print_command, env_variables)
180 command = test_env.execute_helper(command, print_command, env_variables) 180 command = test_env.execute_helper(command, print_command, env_variables)
181 181
182 local redirect_filename 182 local redirect_filename
183 local redirect = "" 183 local redirect = ""
184 if print_command ~= nil then 184 if print_command ~= nil then
@@ -438,11 +438,11 @@ end
438-- @return env_variables table: table with created environment variables 438-- @return env_variables table: table with created environment variables
439local function create_env(testing_paths) 439local function create_env(testing_paths)
440 local luaversion_short = _VERSION:gsub("Lua ", "") 440 local luaversion_short = _VERSION:gsub("Lua ", "")
441 441
442 if test_env.LUAJIT_V then 442 if test_env.LUAJIT_V then
443 luaversion_short="5.1" 443 luaversion_short="5.1"
444 end 444 end
445 445
446 local env_variables = {} 446 local env_variables = {}
447 env_variables.GNUPGHOME = testing_paths.gpg_dir 447 env_variables.GNUPGHOME = testing_paths.gpg_dir
448 env_variables.LUA_VERSION = luaversion_short 448 env_variables.LUA_VERSION = luaversion_short
@@ -481,7 +481,7 @@ local function make_run_function(cmd_name, exec_function, with_coverage, do_prin
481 if with_coverage then 481 if with_coverage then
482 cmd_prefix = cmd_prefix .. "-e \"require('luacov.runner')('" .. test_env.testing_paths.testrun_dir .. "/luacov.config')\" " 482 cmd_prefix = cmd_prefix .. "-e \"require('luacov.runner')('" .. test_env.testing_paths.testrun_dir .. "/luacov.config')\" "
483 end 483 end
484 484
485 if cmd_name then 485 if cmd_name then
486 cmd_prefix = cmd_prefix .. test_env.testing_paths.src_dir .. "/bin/" .. cmd_name .. " " 486 cmd_prefix = cmd_prefix .. test_env.testing_paths.src_dir .. "/bin/" .. cmd_name .. " "
487 end 487 end
@@ -547,7 +547,7 @@ local function build_environment(rocks, env_variables)
547 move_file(rock .. "-*.rock", testing_paths.testing_cache) 547 move_file(rock .. "-*.rock", testing_paths.testing_cache)
548 end 548 end
549 end 549 end
550 550
551 test_env.copy_dir(testing_paths.testing_tree, testing_paths.testing_tree_copy) 551 test_env.copy_dir(testing_paths.testing_tree, testing_paths.testing_tree_copy)
552 test_env.copy_dir(testing_paths.testing_sys_tree, testing_paths.testing_sys_tree_copy) 552 test_env.copy_dir(testing_paths.testing_sys_tree, testing_paths.testing_sys_tree_copy)
553end 553end
@@ -653,7 +653,7 @@ function test_env.setup_specs(extra_rocks)
653 end 653 end
654 654
655 test_env.main() 655 test_env.main()
656 656
657 -- preload before meddling with package.path 657 -- preload before meddling with package.path
658 require("spec.util.git_repo") 658 require("spec.util.git_repo")
659 659
@@ -666,8 +666,8 @@ function test_env.setup_specs(extra_rocks)
666 test_env.setup_done = true 666 test_env.setup_done = true
667 title("RUNNING TESTS") 667 title("RUNNING TESTS")
668 end 668 end
669 669
670 if extra_rocks then 670 if extra_rocks then
671 local make_manifest = download_rocks(extra_rocks, test_env.testing_paths.testing_server) 671 local make_manifest = download_rocks(extra_rocks, test_env.testing_paths.testing_server)
672 if make_manifest then 672 if make_manifest then
673 test_env.run.luarocks_admin_nocov("make_manifest " .. test_env.testing_paths.testing_server) 673 test_env.run.luarocks_admin_nocov("make_manifest " .. test_env.testing_paths.testing_server)
@@ -677,7 +677,7 @@ function test_env.setup_specs(extra_rocks)
677 if test_env.RESET_ENV then 677 if test_env.RESET_ENV then
678 reset_environment(test_env.testing_paths, test_env.md5sums, test_env.env_variables) 678 reset_environment(test_env.testing_paths, test_env.md5sums, test_env.env_variables)
679 end 679 end
680 680
681 lfs.chdir(test_env.testing_paths.testrun_dir) 681 lfs.chdir(test_env.testing_paths.testrun_dir)
682end 682end
683 683
@@ -903,7 +903,7 @@ local function prepare_mock_server_binary_rocks()
903end 903end
904 904
905--- 905---
906-- Main function to create config files and testing environment 906-- Main function to create config files and testing environment
907function test_env.main() 907function test_env.main()
908 local testing_paths = test_env.testing_paths 908 local testing_paths = test_env.testing_paths
909 909
@@ -954,7 +954,7 @@ function test_env.main()
954 local env_vars = { 954 local env_vars = {
955 LUAROCKS_CONFIG = test_env.testing_paths.testrun_dir .. "/testing_config.lua" 955 LUAROCKS_CONFIG = test_env.testing_paths.testrun_dir .. "/testing_config.lua"
956 } 956 }
957 957
958 build_environment(rocks, env_vars) 958 build_environment(rocks, env_vars)
959 959
960 prepare_mock_server_binary_rocks() 960 prepare_mock_server_binary_rocks()