aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorPeter Melnichenko <mpeterval@gmail.com>2016-07-08 16:27:47 +0300
committerPeter Melnichenko <mpeterval@gmail.com>2016-07-08 17:44:03 +0300
commit3fd5bea3820777f7b1e6373529471b74d68fe523 (patch)
tree6d9d37d79e571bb59e73a314f78b25758695cd42 /test
parentf1dc482cdae4af3a7370fef9fea016d037270d51 (diff)
downloadluarocks-3fd5bea3820777f7b1e6373529471b74d68fe523.tar.gz
luarocks-3fd5bea3820777f7b1e6373529471b74d68fe523.tar.bz2
luarocks-3fd5bea3820777f7b1e6373529471b74d68fe523.zip
Tests: utility function for marking sections
Diffstat (limited to 'test')
-rw-r--r--test/test_environment.lua22
1 files changed, 11 insertions, 11 deletions
diff --git a/test/test_environment.lua b/test/test_environment.lua
index 3b03f921..a3ce7ceb 100644
--- a/test/test_environment.lua
+++ b/test/test_environment.lua
@@ -25,6 +25,13 @@ local function help()
25 os.exit(1) 25 os.exit(1)
26end 26end
27 27
28local function title(str)
29 print()
30 print(("-"):rep(#str))
31 print(str)
32 print(("-"):rep(#str))
33end
34
28--- Helper function for execute_bool and execute_output 35--- Helper function for execute_bool and execute_output
29-- @param command string: command to execute 36-- @param command string: command to execute
30-- @param print_command boolean: print command if 'true' 37-- @param print_command boolean: print command if 'true'
@@ -102,7 +109,8 @@ function test_env.set_args()
102 end 109 end
103 110
104 if not test_env.TEST_TARGET_OS then 111 if not test_env.TEST_TARGET_OS then
105 print("[OS CHECK]") 112 title("OS CHECK")
113
106 if execute_bool("sw_vers") then 114 if execute_bool("sw_vers") then
107 test_env.TEST_TARGET_OS = "osx" 115 test_env.TEST_TARGET_OS = "osx"
108 elseif execute_bool("uname -s") then 116 elseif execute_bool("uname -s") then
@@ -110,7 +118,6 @@ function test_env.set_args()
110 else 118 else
111 test_env.TEST_TARGET_OS = "windows" 119 test_env.TEST_TARGET_OS = "windows"
112 end 120 end
113 print("--------------")
114 end 121 end
115 return true 122 return true
116end 123end
@@ -287,9 +294,7 @@ end
287 294
288--- Build environment for testing 295--- Build environment for testing
289local function build_environment(env_rocks, testing_paths, env_variables) 296local function build_environment(env_rocks, testing_paths, env_variables)
290 print("\n--------------------") 297 title("BUILDING ENVIRONMENT")
291 print("BUILDING ENVIRONMENT")
292 print("--------------------")
293 test_env.remove_dir(testing_paths.testing_tree) 298 test_env.remove_dir(testing_paths.testing_tree)
294 test_env.remove_dir(testing_paths.testing_sys_tree) 299 test_env.remove_dir(testing_paths.testing_sys_tree)
295 test_env.remove_dir(testing_paths.testing_tree_copy) 300 test_env.remove_dir(testing_paths.testing_tree_copy)
@@ -402,6 +407,7 @@ function test_env.setup_specs(extra_rocks)
402 test_env.platform = execute_output(test_env.testing_paths.lua .. " -e 'print(require(\"luarocks.cfg\").arch)'", false, test_env.env_variables) 407 test_env.platform = execute_output(test_env.testing_paths.lua .. " -e 'print(require(\"luarocks.cfg\").arch)'", false, test_env.env_variables)
403 test_env.md5sums = create_md5sums(test_env.testing_paths) 408 test_env.md5sums = create_md5sums(test_env.testing_paths)
404 test_env.setup_done = true 409 test_env.setup_done = true
410 title("RUNNING TESTS")
405 end 411 end
406 412
407 if extra_rocks then 413 if extra_rocks then
@@ -412,8 +418,6 @@ function test_env.setup_specs(extra_rocks)
412 end 418 end
413 419
414 reset_environment(test_env.testing_paths, test_env.md5sums, test_env.env_variables) 420 reset_environment(test_env.testing_paths, test_env.md5sums, test_env.env_variables)
415
416 return true
417end 421end
418 422
419--- Helper function for tests which needs luasocket installed 423--- Helper function for tests which needs luasocket installed
@@ -599,10 +603,6 @@ function test_env.main()
599 download_rocks(rocks, testing_paths.testing_server) 603 download_rocks(rocks, testing_paths.testing_server)
600 604
601 build_environment(env_rocks, testing_paths, install_env_vars) 605 build_environment(env_rocks, testing_paths, install_env_vars)
602
603 print("----------------")
604 print(" RUNNING TESTS")
605 print("----------------")
606end 606end
607 607
608test_env.set_lua_version() 608test_env.set_lua_version()