From 9d233d0e474efa25e2e5e02bea9f9e54a532fbe0 Mon Sep 17 00:00:00 2001 From: Peter Melnichenko Date: Fri, 8 Jul 2016 16:36:19 +0300 Subject: Tests: adjust build_environment --- test/test_environment.lua | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'test') diff --git a/test/test_environment.lua b/test/test_environment.lua index a3ce7ceb..cfbab89b 100644 --- a/test/test_environment.lua +++ b/test/test_environment.lua @@ -292,9 +292,12 @@ local function make_run_functions() } end ---- Build environment for testing -local function build_environment(env_rocks, testing_paths, env_variables) +--- Rebuild environment. +-- Remove old installed rocks and install new ones, +-- updating manifests and tree copies. +local function build_environment(rocks, env_variables) title("BUILDING ENVIRONMENT") + local testing_paths = test_env.testing_paths test_env.remove_dir(testing_paths.testing_tree) test_env.remove_dir(testing_paths.testing_sys_tree) test_env.remove_dir(testing_paths.testing_tree_copy) @@ -306,10 +309,11 @@ local function build_environment(env_rocks, testing_paths, env_variables) test_env.run.luarocks_admin_nocov("make_manifest " .. testing_paths.testing_server) test_env.run.luarocks_admin_nocov("make_manifest " .. testing_paths.testing_cache) - for _,package in ipairs(env_rocks) do - if not test_env.run.luarocks_nocov("install --only-server=" .. testing_paths.testing_cache .. " --tree=" .. testing_paths.testing_sys_tree .. " " .. package, env_variables) then - test_env.run.luarocks_nocov("build --tree=" .. testing_paths.testing_sys_tree .. " " .. package, env_variables) - test_env.run.luarocks_nocov("pack --tree=" .. testing_paths.testing_sys_tree .. " " .. package .. "; mv " .. package .. "-*.rock " .. testing_paths.testing_cache, env_variables) + for _, rock in ipairs(rocks) do + if not test_env.run.luarocks_nocov("install --only-server=" .. testing_paths.testing_cache .. " --tree=" .. testing_paths.testing_sys_tree .. " " .. rock, env_variables) then + test_env.run.luarocks_nocov("build --tree=" .. testing_paths.testing_sys_tree .. " " .. rock, env_variables) + test_env.run.luarocks_nocov("pack --tree=" .. testing_paths.testing_sys_tree .. " " .. rock, env_variables) + execute_bool("mv " .. rock .. "-*.rock " .. testing_paths.testing_cache) end end @@ -602,7 +606,7 @@ function test_env.main() lfs.mkdir(testing_paths.testing_server) download_rocks(rocks, testing_paths.testing_server) - build_environment(env_rocks, testing_paths, install_env_vars) + build_environment(env_rocks, install_env_vars) end test_env.set_lua_version() -- cgit v1.2.3-55-g6feb