aboutsummaryrefslogtreecommitdiff
path: root/spec/util
diff options
context:
space:
mode:
authorHisham Muhammad <hisham@gobolinux.org>2018-06-25 11:23:47 -0300
committerHisham Muhammad <hisham@gobolinux.org>2018-07-01 15:51:36 -0300
commit70ea3d3bf74787297507be3d3bd2537993a1153b (patch)
treea21f3a272c8bed2d3cabe7114e265c6b02c5940c /spec/util
parent604a5780eaf3a9e55d1ed23bc121782cc7c097bd (diff)
downloadluarocks-70ea3d3bf74787297507be3d3bd2537993a1153b.tar.gz
luarocks-70ea3d3bf74787297507be3d3bd2537993a1153b.tar.bz2
luarocks-70ea3d3bf74787297507be3d3bd2537993a1153b.zip
Tests: do not run installer on Windows
Diffstat (limited to 'spec/util')
-rw-r--r--spec/util/test_env.lua73
1 files changed, 38 insertions, 35 deletions
diff --git a/spec/util/test_env.lua b/spec/util/test_env.lua
index 28e871de..22a2ad41 100644
--- a/spec/util/test_env.lua
+++ b/spec/util/test_env.lua
@@ -438,11 +438,7 @@ local function make_run_function(cmd_name, exec_function, with_coverage, do_prin
438 cmd_prefix = cmd_prefix .. "-e \"require('luacov.runner')('" .. test_env.testing_paths.testrun_dir .. "/luacov.config')\" " 438 cmd_prefix = cmd_prefix .. "-e \"require('luacov.runner')('" .. test_env.testing_paths.testrun_dir .. "/luacov.config')\" "
439 end 439 end
440 440
441 if test_env.TEST_TARGET_OS == "windows" then 441 cmd_prefix = cmd_prefix .. test_env.testing_paths.src_dir .. "/bin/" .. cmd_name .. " "
442 cmd_prefix = cmd_prefix .. Q(test_env.testing_paths.testing_lrprefix .. "/" .. cmd_name .. ".lua") .. " "
443 else
444 cmd_prefix = cmd_prefix .. test_env.testing_paths.src_dir .. "/bin/" .. cmd_name .. " "
445 end
446 442
447 return function(cmd, new_vars) 443 return function(cmd, new_vars)
448 local temp_vars = {} 444 local temp_vars = {}
@@ -559,7 +555,7 @@ local function create_paths(luaversion_full)
559 testing_paths.testing_sys_rocks = testing_paths.testing_sys_tree .. "/lib/luarocks/rocks-" .. test_env.lua_version 555 testing_paths.testing_sys_rocks = testing_paths.testing_sys_tree .. "/lib/luarocks/rocks-" .. test_env.lua_version
560 556
561 if test_env.TEST_TARGET_OS == "windows" then 557 if test_env.TEST_TARGET_OS == "windows" then
562 testing_paths.win_tools = testing_paths.testing_lrprefix .. "/tools" 558 testing_paths.win_tools = base_dir .. "/win32/tools"
563 end 559 end
564 560
565 return testing_paths 561 return testing_paths
@@ -742,32 +738,39 @@ local function clean()
742 print("Cleaning done!") 738 print("Cleaning done!")
743end 739end
744 740
745--- Install luarocks into testing prefix. 741--- Setup current checkout of luarocks to work with testing prefix.
746local function install_luarocks(install_env_vars) 742local function setup_luarocks()
747 local testing_paths = test_env.testing_paths 743 local testing_paths = test_env.testing_paths
748 title("Installing LuaRocks") 744 title("Setting up LuaRocks")
745
746 local incfile = test_env.file_if_exists(testing_paths.luadir .. "/include/lua/" .. test_env.lua_version .. "/lua.h")
747 or test_env.file_if_exists(testing_paths.luadir .. "/include/lua" .. test_env.lua_version .. "/lua.h")
748 or test_env.file_if_exists(testing_paths.luadir .. "/include/lua.h")
749 local incdir = assert(incfile):gsub("/lua.h$", "")
750
751 local lines = {
752 "return {",
753 ("SYSCONFDIR = %q,"):format(testing_paths.testing_lrprefix .. "/etc/luarocks"),
754 ("LUA_DIR = %q,"):format(testing_paths.luadir),
755 ("LUA_INCDIR = %q,"):format(incdir),
756 ("LUA_LIBDIR = %q,"):format(testing_paths.luadir .. "/lib"),
757 ("LUA_BINDIR = %q,"):format(testing_paths.luadir .. "/bin"),
758 }
759
749 if test_env.TEST_TARGET_OS == "windows" then 760 if test_env.TEST_TARGET_OS == "windows" then
750 local compiler_flag = test_env.MINGW and "/MW" or "" 761 if test_env.MINGW then
751 assert(execute_bool("install.bat /LUA " .. testing_paths.luadir .. " " .. compiler_flag .. " /P " .. testing_paths.testing_lrprefix .. " /NOREG /NOADMIN /F /Q /CONFIG " .. testing_paths.testing_lrprefix .. "/etc/luarocks", false, install_env_vars)) 762 table.insert(lines, [[SYSTEM = "MINGW"]])
752 assert(execute_bool(testing_paths.win_tools .. "/cp " .. testing_paths.testing_lrprefix .. "/lua/luarocks/core/site_config* " .. testing_paths.src_dir .. "/luarocks/core")) 763 else
753 else 764 table.insert(lines, [[SYSTEM = "WindowsNT"]])
754 local incfile = test_env.file_if_exists(testing_paths.luadir .. "/include/lua/" .. test_env.lua_version .. "/lua.h") 765 end
755 or test_env.file_if_exists(testing_paths.luadir .. "/include/lua" .. test_env.lua_version .. "/lua.h") 766 table.insert(lines, ("WIN_TOOLS = %q,"):format(testing_paths.win_tools))
756 or test_env.file_if_exists(testing_paths.luadir .. "/include/lua.h")
757 local incdir = assert(incfile):gsub("/lua.h$", "")
758
759 local lines = {
760 "return {",
761 ("SYSCONFDIR = %q,"):format(testing_paths.testing_lrprefix .. "/etc/luarocks"),
762 ("LUA_DIR = %q,"):format(testing_paths.luadir),
763 ("LUA_INCDIR = %q,"):format(incdir),
764 ("LUA_LIBDIR = %q,"):format(testing_paths.luadir .. "/lib"),
765 ("LUA_BINDIR = %q,"):format(testing_paths.luadir .. "/bin"),
766 "}",
767 }
768 test_env.write_file("src/luarocks/core/hardcoded.lua", table.concat(lines, "\n") .. "\n")
769 end 767 end
770 print("LuaRocks installed correctly!") 768
769 table.insert(lines, "}")
770
771 test_env.write_file("src/luarocks/core/hardcoded.lua", table.concat(lines, "\n") .. "\n")
772
773 print("LuaRocks set up correctly!")
771end 774end
772 775
773function test_env.mock_server_init() 776function test_env.mock_server_init()
@@ -852,11 +855,7 @@ function test_env.main()
852 855
853 create_configs() 856 create_configs()
854 857
855 local install_env_vars = { 858 setup_luarocks()
856 LUAROCKS_CONFIG = test_env.testing_paths.testrun_dir .. "/testing_config.lua"
857 }
858
859 install_luarocks(install_env_vars)
860 859
861 -- Preparation of rocks for building environment 860 -- Preparation of rocks for building environment
862 local rocks = {} -- names of rocks, required for building environment 861 local rocks = {} -- names of rocks, required for building environment
@@ -885,8 +884,12 @@ function test_env.main()
885 -- Download rocks needed for LuaRocks testing environment 884 -- Download rocks needed for LuaRocks testing environment
886 lfs.mkdir(testing_paths.testing_server) 885 lfs.mkdir(testing_paths.testing_server)
887 download_rocks(urls, testing_paths.testing_server) 886 download_rocks(urls, testing_paths.testing_server)
887
888 local env_vars = {
889 LUAROCKS_CONFIG = test_env.testing_paths.testrun_dir .. "/testing_config.lua"
890 }
888 891
889 build_environment(rocks, install_env_vars) 892 build_environment(rocks, env_vars)
890 893
891 prepare_mock_server_binary_rocks() 894 prepare_mock_server_binary_rocks()
892end 895end