diff options
| author | Hisham Muhammad <hisham@gobolinux.org> | 2021-03-16 13:36:26 -0300 |
|---|---|---|
| committer | Hisham Muhammad <hisham@gobolinux.org> | 2021-03-16 16:32:45 -0300 |
| commit | 8f3ce333e7a1abfc6bf0488817d9eff4a2fd443f (patch) | |
| tree | f05d1a49995341a56e602ce2a3256b89372e9d04 /spec/util/test_env.lua | |
| parent | 2b56388e76952be52d849415b1ebae74b6dc4607 (diff) | |
| download | luarocks-8f3ce333e7a1abfc6bf0488817d9eff4a2fd443f.tar.gz luarocks-8f3ce333e7a1abfc6bf0488817d9eff4a2fd443f.tar.bz2 luarocks-8f3ce333e7a1abfc6bf0488817d9eff4a2fd443f.zip | |
editorconfig: trim trailing whitespace
Diffstat (limited to 'spec/util/test_env.lua')
| -rw-r--r-- | spec/util/test_env.lua | 28 |
1 files changed, 14 insertions, 14 deletions
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 | |||
| 128 | function test_env.execute_helper(command, print_command, env_variables) | 128 | function 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 |
| 179 | local function execute_bool(command, print_command, env_variables) | 179 | local 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 |
| 439 | local function create_env(testing_paths) | 439 | local 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) |
| 553 | end | 553 | end |
| @@ -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) |
| 682 | end | 682 | end |
| 683 | 683 | ||
| @@ -903,7 +903,7 @@ local function prepare_mock_server_binary_rocks() | |||
| 903 | end | 903 | end |
| 904 | 904 | ||
| 905 | --- | 905 | --- |
| 906 | -- Main function to create config files and testing environment | 906 | -- Main function to create config files and testing environment |
| 907 | function test_env.main() | 907 | function 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() |
