From f4fda82fdef92e31cf9be6478793ee648eaea557 Mon Sep 17 00:00:00 2001 From: Hisham Muhammad Date: Wed, 21 Feb 2024 22:30:40 -0300 Subject: tests: introduce quick tests --- spec/util/test_env.lua | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'spec/util/test_env.lua') 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) testing_paths.util_dir = base_dir .. "/spec/util" testing_paths.testrun_dir = base_dir .. "/testrun" testing_paths.src_dir = base_dir .. "/src" + testing_paths.spec_dir = base_dir .. "/spec" testing_paths.testing_lrprefix = testing_paths.testrun_dir .. "/testing_lrprefix-" .. luaversion_full testing_paths.testing_tree = testing_paths.testrun_dir .. "/testing-" .. luaversion_full testing_paths.testing_tree_copy = testing_paths.testrun_dir .. "/testing_copy-" .. luaversion_full @@ -753,6 +754,16 @@ function test_env.unload_luarocks() end end +local function get_luarocks_platform(variables) + local print_arch_script = "\"" .. + "cfg = require('luarocks.core.cfg');" .. + "cfg.init();" .. + "print(cfg.arch)" .. + "\"" + local cmd = test_env.testing_paths.lua .. " -e " .. print_arch_script + return execute_output(cmd, false, variables) +end + --- Function for initial setup of environment, variables, md5sums for spec files function test_env.setup_specs(extra_rocks) -- 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) -- preload before meddling with package.path require("spec.util.git_repo") + require("spec.util.quick") package.path = test_env.env_variables.LUA_PATH package.cpath = test_env.env_variables.LUA_CPATH - 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) + test_env.platform = get_luarocks_platform(test_env.env_variables) test_env.wrapper_extension = test_env.TEST_TARGET_OS == "windows" and ".bat" or "" test_env.md5sums = create_md5sums(test_env.testing_paths) test_env.setup_done = true @@ -1104,5 +1116,7 @@ test_env.env_variables = create_env(test_env.testing_paths) test_env.run = make_run_functions() test_env.exists = exists test_env.V = V +test_env.Q = Q +test_env.platform = get_luarocks_platform(test_env.env_variables) return test_env -- cgit v1.2.3-55-g6feb