diff options
author | Peter Melnichenko <mpeterval@gmail.com> | 2016-07-08 16:15:26 +0300 |
---|---|---|
committer | Peter Melnichenko <mpeterval@gmail.com> | 2016-07-08 17:43:57 +0300 |
commit | f1dc482cdae4af3a7370fef9fea016d037270d51 (patch) | |
tree | c49e4780531e3f75270bb7ac5f9f4717b6c644da /test | |
parent | 1097d6cbc877b22b343b4f4531ce0a1d3b286307 (diff) | |
download | luarocks-f1dc482cdae4af3a7370fef9fea016d037270d51.tar.gz luarocks-f1dc482cdae4af3a7370fef9fea016d037270d51.tar.bz2 luarocks-f1dc482cdae4af3a7370fef9fea016d037270d51.zip |
Tests: move luarocks installation into its own function
Diffstat (limited to 'test')
-rw-r--r-- | test/test_environment.lua | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/test/test_environment.lua b/test/test_environment.lua index 4f684f0a..3b03f921 100644 --- a/test/test_environment.lua +++ b/test/test_environment.lua | |||
@@ -537,6 +537,17 @@ local function clean() | |||
537 | print("Cleaning done!") | 537 | print("Cleaning done!") |
538 | end | 538 | end |
539 | 539 | ||
540 | --- Install luarocks into testing prefix. | ||
541 | local function install_luarocks(install_env_vars) | ||
542 | -- Configure LuaRocks testing environment | ||
543 | local configure_cmd = "./configure --with-lua=" .. test_env.testing_paths.luadir .. | ||
544 | " --prefix=" .. test_env.testing_paths.testing_lrprefix .. | ||
545 | " && make clean" | ||
546 | |||
547 | assert(execute_bool(configure_cmd, false, install_env_vars)) | ||
548 | assert(execute_bool("make src/luarocks/site_config.lua && make dev", false, install_env_vars)) | ||
549 | end | ||
550 | |||
540 | --- | 551 | --- |
541 | -- Main function to create config files and testing environment | 552 | -- Main function to create config files and testing environment |
542 | function test_env.main() | 553 | function test_env.main() |
@@ -551,19 +562,13 @@ function test_env.main() | |||
551 | 562 | ||
552 | create_configs() | 563 | create_configs() |
553 | 564 | ||
554 | -- Create environment variables for configuration | 565 | local install_env_vars = { |
555 | local temp_env_variables = {LUAROCKS_CONFIG = testing_paths.testing_dir .. "/testing_config.lua",LUA_PATH="",LUA_CPATH=""} | 566 | LUAROCKS_CONFIG = test_env.testing_paths.testing_dir .. "/testing_config.lua", |
567 | LUA_PATH = "", | ||
568 | LUA_CPATH = "" | ||
569 | } | ||
556 | 570 | ||
557 | -- Configure LuaRocks testing environment | 571 | install_luarocks(install_env_vars) |
558 | local configure_cmd = "./configure --with-lua=" .. testing_paths.luadir .. " --prefix=" .. testing_paths.testing_lrprefix | ||
559 | configure_cmd = configure_cmd .. " && make clean" | ||
560 | |||
561 | if not execute_bool(configure_cmd, false, temp_env_variables) then | ||
562 | os.exit(1) | ||
563 | end | ||
564 | if not execute_bool("make src/luarocks/site_config.lua && make dev", false, temp_env_variables) then | ||
565 | os.exit(1) | ||
566 | end | ||
567 | 572 | ||
568 | -- Preparation of rocks for building environment | 573 | -- Preparation of rocks for building environment |
569 | local env_rocks = {} -- short names of rocks, required for building environment | 574 | local env_rocks = {} -- short names of rocks, required for building environment |
@@ -593,7 +598,7 @@ function test_env.main() | |||
593 | lfs.mkdir(testing_paths.testing_server) | 598 | lfs.mkdir(testing_paths.testing_server) |
594 | download_rocks(rocks, testing_paths.testing_server) | 599 | download_rocks(rocks, testing_paths.testing_server) |
595 | 600 | ||
596 | build_environment(env_rocks, testing_paths, temp_env_variables) | 601 | build_environment(env_rocks, testing_paths, install_env_vars) |
597 | 602 | ||
598 | print("----------------") | 603 | print("----------------") |
599 | print(" RUNNING TESTS") | 604 | print(" RUNNING TESTS") |