diff options
Diffstat (limited to 'spec/util/test_env.lua')
-rw-r--r-- | spec/util/test_env.lua | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/spec/util/test_env.lua b/spec/util/test_env.lua index f9f83b8c..dcda6311 100644 --- a/spec/util/test_env.lua +++ b/spec/util/test_env.lua | |||
@@ -715,6 +715,7 @@ local function create_paths(luaversion_full) | |||
715 | testing_paths.util_dir = base_dir .. "/spec/util" | 715 | testing_paths.util_dir = base_dir .. "/spec/util" |
716 | testing_paths.testrun_dir = base_dir .. "/testrun" | 716 | testing_paths.testrun_dir = base_dir .. "/testrun" |
717 | testing_paths.src_dir = base_dir .. "/src" | 717 | testing_paths.src_dir = base_dir .. "/src" |
718 | testing_paths.spec_dir = base_dir .. "/spec" | ||
718 | testing_paths.testing_lrprefix = testing_paths.testrun_dir .. "/testing_lrprefix-" .. luaversion_full | 719 | testing_paths.testing_lrprefix = testing_paths.testrun_dir .. "/testing_lrprefix-" .. luaversion_full |
719 | testing_paths.testing_tree = testing_paths.testrun_dir .. "/testing-" .. luaversion_full | 720 | testing_paths.testing_tree = testing_paths.testrun_dir .. "/testing-" .. luaversion_full |
720 | testing_paths.testing_tree_copy = testing_paths.testrun_dir .. "/testing_copy-" .. luaversion_full | 721 | testing_paths.testing_tree_copy = testing_paths.testrun_dir .. "/testing_copy-" .. luaversion_full |
@@ -753,6 +754,16 @@ function test_env.unload_luarocks() | |||
753 | end | 754 | end |
754 | end | 755 | end |
755 | 756 | ||
757 | local function get_luarocks_platform(variables) | ||
758 | local print_arch_script = "\"" .. | ||
759 | "cfg = require('luarocks.core.cfg');" .. | ||
760 | "cfg.init();" .. | ||
761 | "print(cfg.arch)" .. | ||
762 | "\"" | ||
763 | local cmd = test_env.testing_paths.lua .. " -e " .. print_arch_script | ||
764 | return execute_output(cmd, false, variables) | ||
765 | end | ||
766 | |||
756 | --- Function for initial setup of environment, variables, md5sums for spec files | 767 | --- Function for initial setup of environment, variables, md5sums for spec files |
757 | function test_env.setup_specs(extra_rocks) | 768 | function test_env.setup_specs(extra_rocks) |
758 | -- if global variable about successful creation of testing environment doesn't exist, build environment | 769 | -- if global variable about successful creation of testing environment doesn't exist, build environment |
@@ -770,11 +781,12 @@ function test_env.setup_specs(extra_rocks) | |||
770 | 781 | ||
771 | -- preload before meddling with package.path | 782 | -- preload before meddling with package.path |
772 | require("spec.util.git_repo") | 783 | require("spec.util.git_repo") |
784 | require("spec.util.quick") | ||
773 | 785 | ||
774 | package.path = test_env.env_variables.LUA_PATH | 786 | package.path = test_env.env_variables.LUA_PATH |
775 | package.cpath = test_env.env_variables.LUA_CPATH | 787 | package.cpath = test_env.env_variables.LUA_CPATH |
776 | 788 | ||
777 | test_env.platform = execute_output(test_env.testing_paths.lua .. " -e \"cfg = require('luarocks.core.cfg'); cfg.init(); print(cfg.arch)\"", false, test_env.env_variables) | 789 | test_env.platform = get_luarocks_platform(test_env.env_variables) |
778 | test_env.wrapper_extension = test_env.TEST_TARGET_OS == "windows" and ".bat" or "" | 790 | test_env.wrapper_extension = test_env.TEST_TARGET_OS == "windows" and ".bat" or "" |
779 | test_env.md5sums = create_md5sums(test_env.testing_paths) | 791 | test_env.md5sums = create_md5sums(test_env.testing_paths) |
780 | test_env.setup_done = true | 792 | test_env.setup_done = true |
@@ -1104,5 +1116,7 @@ test_env.env_variables = create_env(test_env.testing_paths) | |||
1104 | test_env.run = make_run_functions() | 1116 | test_env.run = make_run_functions() |
1105 | test_env.exists = exists | 1117 | test_env.exists = exists |
1106 | test_env.V = V | 1118 | test_env.V = V |
1119 | test_env.Q = Q | ||
1120 | test_env.platform = get_luarocks_platform(test_env.env_variables) | ||
1107 | 1121 | ||
1108 | return test_env | 1122 | return test_env |