aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorrobooo <robo.karasek@gmail.com>2016-07-07 21:58:19 +0200
committerHisham Muhammad <hisham@gobolinux.org>2016-07-07 16:58:19 -0300
commit5af7e0d7c2dcf65e41ae8523f3771e9528be32a7 (patch)
treebcd14624e0566a23da2e708675197d212cecf35d /test
parentb5b285a678fe78b80d452cc9eb7565b8bf087b81 (diff)
downloadluarocks-5af7e0d7c2dcf65e41ae8523f3771e9528be32a7.tar.gz
luarocks-5af7e0d7c2dcf65e41ae8523f3771e9528be32a7.tar.bz2
luarocks-5af7e0d7c2dcf65e41ae8523f3771e9528be32a7.zip
New test-suite for LuaRocks (#581)
First version of new test-suite, using Busted framework based on Google Summer of Code project: https://summerofcode.withgoogle.com/projects/#5695811874717696 * Rewritten from Bash to Lua * Tests now check if they did what they were supposed to, beyond only checking success or failure of the `luarocks` command * Support for black-box (launching `luarocks` as an external command) and white-box (testing functions in modules directly) testing
Diffstat (limited to 'test')
-rw-r--r--test/README.md59
-rw-r--r--test/test_environment.lua625
-rw-r--r--test/testing.lua483
-rwxr-xr-xtest/testing.sh651
4 files changed, 684 insertions, 1134 deletions
diff --git a/test/README.md b/test/README.md
new file mode 100644
index 00000000..c374438f
--- /dev/null
+++ b/test/README.md
@@ -0,0 +1,59 @@
1#LuaRocks testsuite
2##Overview
3Test suite for LuaRocks project with Busted unit testing framework(http://olivinelabs.com/busted/).
4
5* Contains white-box & black-box tests
6* Easy setup for your purpose on command line or from configuration file
7
8
9## Dependencies
10* Lua >= 5.1
11* Busted with dependencies
12
13
14##Usage
15Running of tests is based on basic Busted usage. *-Xhelper* flag is mandatory for inserting arguments into testing (primary black-box). Flag *--tags=* or *-t* is mandatory for specifying which tests will run. Mandatory *-Xhelper* flag always needs version of Lua or LuaJIT (e.g. *lua=5.2.4* or *luajit=2.0.3*). Start tests inside LuaRocks folder or specify with *-C* flag.
16
17**Arguments for Busted helper script**
18
19```
20lua=<version>, !mandatory! type your full version of Lua (e.g. lua=5.2.4)
21OR
22luajit=<version>, !mandatory! type your full version of LuaJIT (e.g. luajit=5.2.4)
23
24env=<type>, (default:"minimal") type what kind of environment to use ["minimal", "full"]
25clean, remove existing testing environment
26travis, add just if running on TravisCI
27os=<version>, type your OS ["linux", "os x", "windows"]
28```
29---------------------------------------------------------------------------------------------
30####_**Tags** of tests are required and are in this format:_
31
32**whitebox** - run all whitebox tests
33
34**blackbox** - run all blackbox tests
35
36**ssh** - run all tests which require ssh
37
38**w**\_*name-of-command* - whitebox testing of command
39
40**b**\_*name-of-command* - blackbox testing of command
41
42for example: `b_install` or `w_help`
43
44###Examples
45To run white-box tests in LuaRocks directory type :
46
47`busted -t "whitebox"`
48
49To run black-box tests just of *install* command (we defined our OS, so OS check is skipped.):
50
51`busted -Xhelper lua=5.2.4,os=linux -t "b_install"`
52
53To run black-box tests of *install* command, whitebox of *help* command (using *full* type of environment):
54
55`busted -Xhelper lua=5.2.4,env=full -t "b_install", "w_help"`
56
57To run black-box tests without tests, which use ssh:
58
59`busted -Xhelper lua=5.2.4 -t "blackbox" --exclude-tags=ssh` \ No newline at end of file
diff --git a/test/test_environment.lua b/test/test_environment.lua
new file mode 100644
index 00000000..6de501fb
--- /dev/null
+++ b/test/test_environment.lua
@@ -0,0 +1,625 @@
1local lfs = require("lfs")
2local test_env = {}
3local arg = arg or { ... }
4
5local function help()
6 print("LuaRocks test-suite\n\n"..
7 [[
8 INFORMATION
9 New test-suite for LuaRocks project, using unit testing framework Busted.
10 REQUIREMENTS
11 Tests require to have Lua installed and added to PATH. Be sure sshd is runnig on your system, or
12 use '--exclude-tags=ssh', to not execute tests which require sshd.
13 USAGE -Xhelper <arguments>
14 lua=<version> (mandatory) type your full version of Lua (e.g. --lua 5.2.4)
15 OR
16 luajit=<version> (mandatory) type your full version of LuaJIT (e.g. --luajit 2.0.3)
17
18 env=<type> (default:"minimal") type what kind of environment to use ["minimal", "full"]
19 clean remove existing testing environment
20 travis add just if running on TravisCI
21 os=<version> type your OS ["linux", "osx", "windows"]
22 ]]);
23 os.exit(1)
24end
25
26--- Helper function for execute_bool and execute_output
27-- @param command string: command to execute
28-- @param print_command boolean: print command if 'true'
29-- @param env_variables table: table of environment variables to export {FOO="bar", BAR="foo"}
30-- @return final_command string: concatenated command to execution
31local function execute_helper(command, print_command, env_variables)
32 local final_command = ""
33
34 if print_command then
35 print("\n[EXECUTING]: " .. command)
36 end
37
38 if env_variables then
39 final_command = "export "
40 for k,v in pairs(env_variables) do
41 final_command = final_command .. k .. "='" .. v .. "' "
42 end
43 -- remove last space and add ';' to separate exporting variables from command
44 final_command = final_command:sub(1, -2) .. "; "
45 end
46
47 final_command = final_command .. command
48
49 return final_command
50end
51
52--- Execute command and returns true/false
53-- In Lua5.1 os.execute returns numeric value, but in Lua5.2+ returns boolean
54-- @return true/false boolean: status of the command execution
55local function execute_bool(command, print_command, env_variables)
56 command = execute_helper(command, print_command, env_variables)
57
58 local ok = os.execute(command)
59 return ok == true or ok == 0
60end
61
62--- Execute command and returns output of command
63-- @return output string: output the command execution
64local function execute_output(command, print_command, env_variables)
65 command = execute_helper(command, print_command, env_variables)
66
67 local file = assert(io.popen(command))
68 local output = file:read('*all')
69 file:close()
70 return output:gsub("\n","") -- output adding new line, need to be removed
71end
72
73--- Set all arguments from input into global variables
74function test_env.set_args()
75 if arg[1] == nil then
76 help()
77 end
78
79 local args_position
80
81 for i=1, #arg do
82 if arg[i]:find("-Xhelper") and arg[i+1]:find("lua=") and not arg[i+1]:find("luajit=") then
83 args_position = i+1
84 test_env.LUA_V = arg[args_position]:gsub("(.*)lua=([^%,]+)(.*)","%2")
85 break
86 elseif arg[i]:find("-Xhelper") and not arg[i+1]:find("lua=") and arg[i+1]:find("luajit=") then
87 args_position = i+1
88 test_env.LUAJIT_V = arg[args_position]:gsub("(.*)luajit=([^%,]+)(.*)","%2")
89 break
90 elseif arg[i]:find("-Xhelper") and arg[i+1]:find("lua=") and arg[i+1]:find("luajit=") then
91 print("Please specify just Lua or LuaJIT version for testing in format 'lua=X.X.X' or 'luajit=X.X.X', for -Xhelper flag")
92 os.exit(1)
93 elseif arg[i]:find("-Xhelper") and not arg[i+1]:find("lua=") and not arg[i+1]:find("luajit=") then
94 print("Please add mandatory argument - version of Lua or LuaJIT in format 'lua=X.X.X' or 'luajit=X.X.X', for -Xhelper flag")
95 os.exit(1)
96 end
97 end
98
99 if not args_position then
100 help()
101 end
102
103 -- if at least Lua/LuaJIT version argument was found on input start to parse other arguments to env. variables
104 test_env.TYPE_TEST_ENV = "minimal"
105
106 if arg[args_position]:find("env=") then
107 test_env.TYPE_TEST_ENV = arg[args_position]:gsub("(.*)env=([^%,]+)(.*)","%2")
108 end
109 if arg[args_position]:find("clean") then
110 test_env.TEST_ENV_CLEAN = true
111 end
112 if arg[args_position]:find("travis") then
113 test_env.TRAVIS = true
114 end
115 if arg[args_position]:find("os=") then
116 test_env.TEST_TARGET_OS = arg[args_position]:gsub("(.*)os=([^%,]+)(.*)","%2")
117 end
118
119 if not test_env.TEST_TARGET_OS then
120 print("[OS CHECK]")
121 if execute_bool("sw_vers") then
122 test_env.TEST_TARGET_OS = "osx"
123 elseif execute_bool("uname -s") then
124 test_env.TEST_TARGET_OS = "linux"
125 else
126 test_env.TEST_TARGET_OS = "windows"
127 end
128 print("--------------")
129 end
130 return true
131end
132
133--- Remove directory recursively
134-- @param path string: directory path to delete
135function test_env.remove_dir(path)
136 if lfs.attributes(path) then
137 for file in lfs.dir(path) do
138 if file ~= "." and file ~= ".." then
139 local full_path = path..'/'..file
140 local attr = lfs.attributes(full_path)
141
142 if attr.mode == "directory" then
143 test_env.remove_dir(full_path)
144 os.remove(full_path)
145 else
146 os.remove(full_path)
147 end
148 end
149 end
150 end
151 os.remove(path)
152end
153
154--- Remove directory recursively
155-- @param path string: directory path to delete
156-- @param pattern string: pattern in directories
157function test_env.remove_dir_pattern(path, pattern)
158 if lfs.attributes(path) then
159 for file in lfs.dir(path) do
160 if file ~= "." and file ~= ".." then
161 local full_path = path..'/'..file
162 local attr = lfs.attributes(full_path)
163
164 if attr.mode == "directory" and file:find(pattern) then
165 test_env.remove_dir(full_path)
166 os.remove(full_path)
167 end
168 end
169 end
170 end
171end
172
173--- Remove files based on filename
174-- @param path string: directory where to delete files
175-- @param pattern string: pattern in filenames
176-- @return result_check boolean: true if one or more files deleted
177function test_env.remove_files(path, pattern)
178 local result_check = false
179 if lfs.attributes(path) then
180 for file in lfs.dir(path) do
181 if file ~= "." and file ~= ".." then
182 if file:find(pattern) then
183 if os.remove(path .. "/" .. file) then
184 result_check = true
185 end
186 end
187 end
188 end
189 end
190 return result_check
191end
192
193
194--- Function for downloading rocks and rockspecs
195-- @param rocks table: table with full name of rocks/rockspecs to download
196-- @param save_path string: path to directory, where to download rocks/rockspecs
197-- @return make_manifest boolean: true if new rocks downloaded
198local function download_rocks(rocks, save_path)
199 local luarocks_repo = "https://luarocks.org"
200 local make_manifest = false
201
202 for _,rock in ipairs(rocks) do
203 -- check if already downloaded
204 if not os.rename( save_path .. rock, save_path .. rock) then
205 execute_bool("wget -cP " .. save_path .. " " .. luarocks_repo .. rock)
206 make_manifest = true
207 end
208 end
209 return make_manifest
210end
211
212--- Create config files for testing
213-- @param config_path string: path where to save config file
214-- @param config_content string: content of this config file
215local function create_config(config_path, config_content)
216 local file, err = io.open(config_path, "w+")
217 if not file then return nil, err end
218 file:write(config_content)
219 file:close()
220end
221
222--- Create md5sum of directory structure recursively, based on filename and size
223-- @param path string: path to directory for generate md5sum
224-- @param testing_os string(optional): version of PC OS
225-- @return md5sum string: md5sum of directory
226local function hash_environment(path, testing_os)
227 local md5sum = ""
228 testing_os = testing_os or test_env.TEST_TARGET_OS
229
230 if testing_os == "linux" then
231 md5sum = execute_output("find " .. path .. " -printf \"%s %p\n\" | md5sum")
232 end
233 if testing_os == "osx" then
234 md5sum = execute_output("find " .. path .. " -type f -exec stat -f \"%z %N\" {} \\; | md5")
235 end
236 --TODO if testing_os == "windows" then
237 -- md5sum = execute_output("find . -printf \"%s %p\n\" | md5sum")
238 -- end
239 return md5sum
240end
241
242--- Create environment variables needed for tests
243-- @param testing_paths table: table with paths to testing directory
244-- @return env_variables table: table with created environment variables
245local function create_env(testing_paths)
246 local luaversion_short = _VERSION:gsub("Lua ", "")
247
248 if test_env.LUAJIT_V then
249 luaversion_short="5.1"
250 end
251
252 local env_variables = {}
253 env_variables.LUA_VERSION = luaversion_short
254 env_variables.LUAROCKS_CONFIG = testing_paths.testing_dir .. "/testing_config.lua"
255 env_variables.LUA_PATH = testing_paths.testing_tree .. "/share/lua/" .. luaversion_short .. "/?.lua;"
256 env_variables.LUA_PATH = env_variables.LUA_PATH .. testing_paths.testing_tree .. "/share/lua/".. luaversion_short .. "/?/init.lua;"
257 env_variables.LUA_PATH = env_variables.LUA_PATH .. testing_paths.testing_sys_tree .. "/share/lua/" .. luaversion_short .. "/?.lua;"
258 env_variables.LUA_PATH = env_variables.LUA_PATH .. testing_paths.testing_sys_tree .. "/share/lua/".. luaversion_short .. "/?/init.lua;"
259 env_variables.LUA_PATH = env_variables.LUA_PATH .. testing_paths.src_dir .. "/?.lua;"
260 env_variables.LUA_CPATH = testing_paths.testing_tree .. "/lib/lua/" .. luaversion_short .. "/?.so;"
261 .. testing_paths.testing_sys_tree .. "/lib/lua/" .. luaversion_short .. "/?.so;"
262 env_variables.PATH = os.getenv("PATH") .. ":" .. testing_paths.testing_tree .. "/bin:" .. testing_paths.testing_sys_tree .. "/bin"
263
264 return env_variables
265end
266
267--- Create md5sums of origin system and system-copy testing directory
268-- @param testing_paths table: table with paths to testing directory
269-- @return md5sums table: table of md5sums of system and system-copy testing directory
270local function create_md5sums(testing_paths)
271 local md5sums = {}
272 md5sums.testing_tree_copy_md5 = hash_environment(testing_paths.testing_tree_copy)
273 md5sums.testing_sys_tree_copy_md5 = hash_environment(testing_paths.testing_sys_tree_copy)
274
275 return md5sums
276end
277
278local function run_luarocks(testing_paths, env_variables)
279
280 local function make_command_function(exec_function, lua_cmd, do_print)
281 return function(cmd, new_vars)
282 local temp_vars = {}
283 for k, v in pairs(env_variables) do
284 temp_vars[k] = v
285 end
286 if new_vars then
287 for k, v in pairs(new_vars) do
288 temp_vars[k] = v
289 end
290 end
291 return exec_function(lua_cmd .. cmd, do_print, temp_vars)
292 end
293 end
294
295 local run = {}
296
297 local cov_str = testing_paths.lua .. " -e\"require('luacov.runner')('" .. testing_paths.testing_dir .. "/luacov.config')\" "
298
299 local luarocks_cmd = cov_str .. testing_paths.src_dir .. "/bin/luarocks "
300 run.luarocks = make_command_function(execute_output, luarocks_cmd, true)
301 run.luarocks_bool = make_command_function(execute_bool, luarocks_cmd, true)
302 run.luarocks_noprint = make_command_function(execute_bool, luarocks_cmd, false)
303
304 local luarocks_nocov_cmd = testing_paths.lua .. " " .. testing_paths.src_dir .. "/bin/luarocks "
305 run.luarocks_nocov = make_command_function(execute_bool, luarocks_nocov_cmd, true)
306 run.luarocks_noprint_nocov = make_command_function(execute_bool, luarocks_nocov_cmd, false)
307
308 local luarocks_admin_cmd = cov_str .. testing_paths.src_dir .. "/bin/luarocks-admin "
309 run.luarocks_admin = make_command_function(execute_output, luarocks_admin_cmd, true)
310 run.luarocks_admin_bool = make_command_function(execute_bool, luarocks_admin_cmd, true)
311
312 local luarocks_admin_nocov_cmd = testing_paths.lua .. " " .. testing_paths.src_dir .. "/bin/luarocks-admin "
313 run.luarocks_admin_nocov = make_command_function(execute_bool, luarocks_admin_nocov_cmd, false)
314
315 return run
316end
317
318--- Build environment for testing
319local function build_environment(env_rocks, testing_paths, env_variables)
320 print("\n--------------------")
321 print("BUILDING ENVIRONMENT")
322 print("--------------------")
323 test_env.remove_dir(testing_paths.testing_tree)
324 test_env.remove_dir(testing_paths.testing_sys_tree)
325 test_env.remove_dir(testing_paths.testing_tree_copy)
326 test_env.remove_dir(testing_paths.testing_sys_tree_copy)
327
328 lfs.mkdir(testing_paths.testing_tree)
329 lfs.mkdir(testing_paths.testing_sys_tree)
330
331 local run = run_luarocks(testing_paths, env_variables)
332 run.luarocks_admin_nocov("make_manifest " .. testing_paths.testing_server)
333 run.luarocks_admin_nocov("make_manifest " .. testing_paths.testing_cache)
334
335 for _,package in ipairs(env_rocks) do
336 if not run.luarocks_nocov("install --only-server=" .. testing_paths.testing_cache .. " --tree=" .. testing_paths.testing_sys_tree .. " " .. package, env_variables) then
337 run.luarocks_nocov("build --tree=" .. testing_paths.testing_sys_tree .. " " .. package, env_variables)
338 run.luarocks_nocov("pack --tree=" .. testing_paths.testing_sys_tree .. " " .. package .. "; mv " .. package .. "-*.rock " .. testing_paths.testing_cache, env_variables)
339 end
340 end
341
342 execute_bool("cp -a " .. testing_paths.testing_tree .. "/. " .. testing_paths.testing_tree_copy)
343 execute_bool("cp -a " .. testing_paths.testing_sys_tree .. "/. " .. testing_paths.testing_sys_tree_copy)
344end
345
346--- Reset testing environment
347local function reset_environment(testing_paths, md5sums)
348 local testing_tree_md5 = hash_environment(testing_paths.testing_tree)
349 local testing_sys_tree_md5 = hash_environment(testing_paths.testing_sys_tree)
350
351 if testing_tree_md5 ~= md5sums.testing_tree_copy_md5 then
352 test_env.remove_dir(testing_paths.testing_tree)
353 execute_bool("cp -a " .. testing_paths.testing_tree_copy .. "/. " .. testing_paths.testing_tree)
354 end
355 if testing_sys_tree_md5 ~= md5sums.testing_sys_tree_copy_md5 then
356 test_env.remove_dir(testing_paths.testing_sys_tree)
357 execute_bool("cp -a " .. testing_paths.testing_sys_tree_copy .. "/. " .. testing_paths.testing_sys_tree)
358 end
359
360 print("\n[ENVIRONMENT RESET]")
361end
362
363local function create_paths(luaversion_full)
364 local testing_paths = {}
365
366 testing_paths.luadir = ""
367
368 if test_env.TRAVIS then
369 testing_paths.luadir = lfs.currentdir() .. "/lua_install"
370 testing_paths.lua = testing_paths.luadir .. "/bin/lua"
371 end
372
373 if test_env.LUA_V and not test_env.TRAVIS then
374 if lfs.attributes("/usr/bin/lua") then
375 testing_paths.luadir = "/usr"
376 testing_paths.lua = testing_paths.luadir .. "/bin/lua"
377 elseif lfs.attributes("/usr/local/bin/lua") then
378 testing_paths.luadir = "/usr/local"
379 testing_paths.lua = testing_paths.luadir .. "/bin/lua"
380 end
381 elseif test_env.LUAJIT_V and not test_env.TRAVIS then
382 if lfs.attributes("/usr/bin/luajit") then
383 testing_paths.luadir = "/usr"
384 testing_paths.lua = testing_paths.luadir .. "/bin/luajit"
385 elseif lfs.attributes("/usr/local/bin/luajit") then
386 testing_paths.luadir = "/usr/local"
387 testing_paths.lua = testing_paths.luadir .. "/bin/luajit"
388 end
389 end
390
391 testing_paths.luarocks_tmp = "/tmp/luarocks_testing" --windows?
392
393 testing_paths.luarocks_dir = lfs.currentdir()
394 testing_paths.testing_dir = testing_paths.luarocks_dir .. "/test"
395 testing_paths.src_dir = testing_paths.luarocks_dir .. "/src"
396 testing_paths.testing_lrprefix = testing_paths.testing_dir .. "/testing_lrprefix-" .. luaversion_full
397 testing_paths.testing_tree = testing_paths.testing_dir .. "/testing-" .. luaversion_full
398 testing_paths.testing_tree_copy = testing_paths.testing_dir .. "/testing_copy-" .. luaversion_full
399 testing_paths.testing_sys_tree = testing_paths.testing_dir .. "/testing_sys-" .. luaversion_full
400 testing_paths.testing_sys_tree_copy = testing_paths.testing_dir .. "/testing_sys_copy-" .. luaversion_full
401 testing_paths.testing_cache = testing_paths.testing_dir .. "/testing_cache-" .. luaversion_full
402 testing_paths.testing_server = testing_paths.testing_dir .. "/testing_server-" .. luaversion_full
403
404 return testing_paths
405end
406
407--- Helper function to unload luarocks modules from global table package.loaded
408-- Needed to load our local (testing) version of LuaRocks
409function test_env.unload_luarocks()
410 for modname, _ in pairs(package.loaded) do
411 if modname:match("^luarocks%.") then
412 package.loaded[modname] = nil
413 end
414 end
415end
416
417--- Function for initially setup of environment, variables, md5sums for spec files
418function test_env.setup_specs(extra_rocks, luaversion_full)
419 -- if global variable about successful creation of testing environment doesn't exists, build environment
420 if not test_env.setup_done then
421 test_env.set_args()
422
423 if test_env.TRAVIS then
424 if not os.rename(os.getenv("HOME") .. "/.ssh/id_rsa.pub", os.getenv("HOME") .. "/.ssh/id_rsa.pub") then
425 execute_bool("ssh-keygen -t rsa -P \"\" -f ~/.ssh/id_rsa")
426 execute_bool("cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys")
427 execute_bool("chmod og-wx ~/.ssh/authorized_keys")
428 execute_bool("ssh-keyscan localhost >> ~/.ssh/known_hosts")
429 end
430 end
431
432 luaversion_full = luaversion_full or test_env.LUA_V or test_env.LUAJIT_V
433
434 test_env.main()
435
436 -- Set paths, env_vars and functions for specs
437 test_env.testing_paths = create_paths(luaversion_full)
438 test_env.env_variables = create_env(test_env.testing_paths)
439 package.path = test_env.env_variables.LUA_PATH
440
441 test_env.run = run_luarocks(test_env.testing_paths, test_env.env_variables)
442 test_env.platform = execute_output(test_env.testing_paths.lua .. " -e 'print(require(\"luarocks.cfg\").arch)'", false, test_env.env_variables)
443 test_env.md5sums = create_md5sums(test_env.testing_paths)
444 test_env.setup_done = true
445 end
446
447 if extra_rocks then
448 local make_manifest = download_rocks(extra_rocks, test_env.testing_paths.testing_server)
449 if make_manifest then
450 local run = run_luarocks(test_env.testing_paths, test_env.env_variables)
451 run.luarocks_admin_nocov("make_manifest " .. test_env.testing_paths.testing_server)
452 end
453 end
454
455 reset_environment(test_env.testing_paths, test_env.md5sums, test_env.env_variables)
456
457 return true
458end
459
460--- Helper function for tests which needs luasocket installed
461function test_env.need_luasocket(luarocks_nocov, testing_cache, platform)
462 luarocks_nocov = luarocks_nocov or test_env.run.luarocks_nocov
463 testing_cache = testing_cache or test_env.testing_paths.testing_cache
464 platform = platform or test_env.platform
465
466 if luarocks_nocov("show luasocket") then
467 return true
468 else
469 testing_cache = testing_cache .. "/"
470 local luasocket_rock = "luasocket-3.0rc1-1." .. platform .. ".rock"
471 if not os.rename( testing_cache .. luasocket_rock, testing_cache .. luasocket_rock) then
472 luarocks_nocov("build --pack-binary-rock luasocket 3.0rc1-1")
473 os.rename(luasocket_rock, testing_cache .. luasocket_rock)
474 end
475 luarocks_nocov("install " .. testing_cache .. luasocket_rock)
476 end
477 return true
478end
479
480---
481-- Main function to create config files and testing environment
482function test_env.main(luaversion_full, env_type, env_clean)
483 luaversion_full = luaversion_full or test_env.LUA_V or test_env.LUAJIT_V
484 local testing_paths = create_paths(luaversion_full)
485
486 env_clean = env_clean or test_env.TEST_ENV_CLEAN
487 if env_clean then
488 print("Cleaning testing directory...")
489 test_env.remove_dir(testing_paths.luarocks_tmp)
490 test_env.remove_dir_pattern(testing_paths.testing_dir, "testing_")
491 test_env.remove_dir_pattern(testing_paths.testing_dir, "testing-")
492 test_env.remove_files(testing_paths.testing_dir, "testing_")
493 test_env.remove_files(testing_paths.testing_dir, "luacov")
494 print("Cleaning done!")
495 end
496
497 lfs.mkdir(testing_paths.testing_cache)
498 lfs.mkdir(testing_paths.luarocks_tmp)
499
500--- CONFIG FILES
501-- testing_config.lua and testing_config_show_downloads.lua
502 local config_content = ([[rocks_trees = {
503 "%{testing_tree}",
504 { name = "system", root = "%{testing_sys_tree}" },
505}
506rocks_servers = {
507 "%{testing_server}"
508}
509local_cache = "%{testing_cache}"
510upload_server = "testing"
511upload_user = "%{user}"
512upload_servers = {
513 testing = {
514 rsync = "localhost/tmp/luarocks_testing",
515 },
516}
517external_deps_dirs = {
518 "/usr/local",
519 "/usr",
520 -- These are used for a test that fails, so it
521 -- can point to invalid paths:
522 {
523 prefix = "/opt",
524 bin = "bin",
525 include = "include",
526 lib = { "lib", "lib64" },
527 }
528}]]):gsub("%%%b{}", {
529 ["%{user}"] = os.getenv("USER"),
530 ["%{testing_sys_tree}"] = testing_paths.testing_sys_tree,
531 ["%{testing_tree}"] = testing_paths.testing_tree,
532 ["%{testing_server}"] = testing_paths.testing_server,
533 ["%{testing_cache}"] = testing_paths.testing_cache})
534
535 create_config(testing_paths.testing_dir .. "/testing_config.lua", config_content .. " \nweb_browser = \"true\"")
536 create_config(testing_paths.testing_dir .. "/testing_config_show_downloads.lua", config_content
537 .. "show_downloads = true \n rocks_servers={\"http://luarocks.org/repositories/rocks\"}")
538
539-- testing_config_sftp.lua
540 config_content=([[rocks_trees = {
541 "%{testing_tree}",
542 "%{testing_sys_tree}",
543}
544local_cache = "%{testing_cache}"
545upload_server = "testing"
546upload_user = "%{user}"
547upload_servers = {
548 testing = {
549 sftp = "localhost/tmp/luarocks_testing",
550 },
551}]]):gsub("%%%b{}", {
552 ["%{user}"] = os.getenv("USER"),
553 ["%{testing_sys_tree}"] = testing_paths.testing_sys_tree,
554 ["%{testing_tree}"] = testing_paths.testing_tree,
555 ["%{testing_cache}"] = testing_paths.testing_cache})
556
557 create_config(testing_paths.testing_dir .. "/testing_config_sftp.lua", config_content)
558
559-- luacov.config
560 config_content=([[return {
561 statsfile = "%{testing_dir}/luacov.stats.out",
562 reportfile = "%{testing_dir}/luacov.report.out",
563 modules = {
564 ["luarocks"] = "src/bin/luarocks",
565 ["luarocks-admin"] = "src/bin/luarocks-admin",
566 ["luarocks.*"] = "src",
567 ["luarocks.*.*"] = "src",
568 ["luarocks.*.*.*"] = "src"
569 }
570}]]):gsub("%%%b{}", {
571 ["%{testing_dir}"] = testing_paths.testing_dir})
572
573 create_config(testing_paths.testing_dir .. "/luacov.config", config_content)
574
575 -- Create environment variables for configuration
576 local temp_env_variables = {LUAROCKS_CONFIG = testing_paths.testing_dir .. "/testing_config.lua",LUA_PATH="",LUA_CPATH=""}
577
578 -- Configure LuaRocks testing environment
579 local configure_cmd = "./configure --with-lua=" .. testing_paths.luadir .. " --prefix=" .. testing_paths.testing_lrprefix
580 configure_cmd = configure_cmd .. " && make clean"
581
582 if not execute_bool(configure_cmd, false, temp_env_variables) then
583 os.exit(1)
584 end
585 if not execute_bool("make src/luarocks/site_config.lua && make dev", false, temp_env_variables) then
586 os.exit(1)
587 end
588
589 -- Preparation of rocks for building environment
590 env_type = env_type or test_env.TYPE_TEST_ENV
591
592 local env_rocks = {} -- short names of rocks, required for building environment
593 local rocks = {} -- full names of rocks required for download
594 rocks[#rocks+1] = "/luacov-0.11.0-1.rockspec"
595 rocks[#rocks+1] = "/luacov-0.11.0-1.src.rock"
596
597 if env_type == "full" then
598 rocks[#rocks+1] = "/luafilesystem-1.6.3-1.src.rock"
599 rocks[#rocks+1] = "/luasocket-3.0rc1-1.src.rock"
600 rocks[#rocks+1] = "/luasocket-3.0rc1-1.rockspec"
601 rocks[#rocks+1] = "/luaposix-33.2.1-1.src.rock"
602 rocks[#rocks+1] = "/md5-1.2-1.src.rock"
603 rocks[#rocks+1] = "/lzlib-0.4.1.53-1.src.rock"
604 env_rocks = {"luafilesystem", "luasocket", "luaposix", "md5", "lzlib"}
605 end
606 if env_type == "full" and luaversion_full ~= "5.1.5" then
607 rocks[#rocks+1] = "/luabitop-1.0.2-1.rockspec"
608 rocks[#rocks+1] = "/luabitop-1.0.2-1.src.rock"
609 table.insert(env_rocks, "luabitop")
610 end
611
612 table.insert(env_rocks, "luacov") -- luacov is needed for minimal or full environment
613
614 -- Download rocks needed for LuaRocks testing environment
615 lfs.mkdir(testing_paths.testing_server)
616 download_rocks(rocks, testing_paths.testing_server)
617
618 build_environment(env_rocks, testing_paths, temp_env_variables)
619
620 print("----------------")
621 print(" RUNNING TESTS")
622 print("----------------")
623end
624
625return test_env
diff --git a/test/testing.lua b/test/testing.lua
deleted file mode 100644
index 1a837484..00000000
--- a/test/testing.lua
+++ /dev/null
@@ -1,483 +0,0 @@
1
2local variables = {}
3
4-- Expand variables in the format $foo or ${foo} according
5-- to the variables table.
6local function expand_variables(str)
7 return str:gsub("%$({?)([A-Za-z0-9_]+)(}?)", function(o, v, c)
8 return #o <= #c and (variables[v] or "") .. (#o < #c and c or "")
9 end)
10end
11
12-- @param cmd command to run
13-- @param envtable optional table of temporary environment variables
14local function run(cmd, envtable)
15 cmd = expand_variables(cmd)
16 local env = {}
17 for var, val in pairs(envtable) do
18 table.insert(env, var.."='"..expand_variables(val).."' ")
19 end
20 local code = os.execute(table.concat(env)..cmd)
21 return (code == 0 or code == true)
22end
23
24local function cd_run(dir, cmd, envtable)
25 return run("cd "..dir.." && "..cmd, envtable)
26end
27
28local function run_get_contents(cmd)
29end
30
31local function mkdir(dirname)
32 cmd = expand_variables(dirname)
33 -- TODO
34end
35
36local function rm_rf(...)
37 -- TODO
38end
39
40local function mv(src, dst)
41 -- TODO
42end
43
44local function exists(filename)
45 filename = expand_variables(filename)
46 -- TODO
47end
48
49local function glob(patt)
50 -- TODO
51end
52
53local function touch(filename)
54 -- TODO
55end
56
57local function rm(...)
58 for _, filename in ipairs {...} do
59 filename = expand_variables(filename)
60 -- TODO
61 end
62 return true
63end
64
65local function file_set_contents(filename, contents)
66 filename = expand_variables(filename)
67
68 local fd, err = io.open(filename, "w")
69 if not fd then return nil, err end
70 fd:write(contents)
71 fd:close()
72 return true
73end
74
75local function need_luasocket()
76 -- TODO
77end
78
79local tests = {
80
81 test_version = function() return run "$luarocks --version" end,
82 fail_unknown_command = function() return run "$luarocks unknown_command" end,
83 fail_arg_boolean_parameter = function() return run "$luarocks --porcelain=invalid" end,
84 fail_arg_boolean_unknown = function() return run "$luarocks --invalid-flag" end,
85 fail_arg_string_no_parameter = function() return run "$luarocks --server" end,
86 fail_arg_string_followed_by_flag = function() return run "$luarocks --server --porcelain" end,
87 fail_arg_string_unknown = function() return run "$luarocks --invalid-flag=abc" end,
88 test_empty_list = function() return run "$luarocks list" end,
89 test_list_outdated = function () return run "$luarocks list --outdated" end,
90 fail_sysconfig_err = function()
91 mkdir "$testing_lrprefix/etc/luarocks"
92 file_set_contents("$testing_lrprefix/etc/luarocks/config.lua", "aoeui")
93 return run "$luarocks list"
94 and rm "$testing_lrprefix/etc/luarocks/config.lua"
95 end,
96 fail_sysconfig_default_err = function()
97 mkdir "$testing_lrprefix/etc/luarocks"
98 file_set_contents("$testing_lrprefix/etc/luarocks/config-$luashortversion.lua", "aoeui")
99 return run "$luarocks list"
100 and rm "$testing_lrprefix/etc/luarocks/config-$luashortversion.lua"
101 end,
102 fail_build_noarg = function() return run "$luarocks build" end,
103 fail_download_noarg = function() return run "$luarocks download" end,
104 fail_install_noarg = function() return run "$luarocks install" end,
105 fail_lint_noarg = function() return run "$luarocks lint" end,
106 fail_search_noarg = function() return run "$luarocks search" end,
107 fail_show_noarg = function() return run "$luarocks show" end,
108 fail_unpack_noarg = function() return run "$luarocks unpack" end,
109 fail_upload_noarg = function() return run "$luarocks upload" end,
110 fail_remove_noarg = function() return run "$luarocks remove" end,
111 fail_doc_noarg = function() return run "$luarocks doc" end,
112 fail_new_version_noarg = function() return run "$luarocks new_version" end,
113 fail_write_rockspec_noarg = function() return run "$luarocks write_rockspec" end,
114 fail_build_invalid = function() return run "$luarocks build invalid" end,
115 fail_download_invalid = function() return run "$luarocks download invalid" end,
116 fail_install_invalid = function() return run "$luarocks install invalid" end,
117 fail_lint_invalid = function() return run "$luarocks lint invalid" end,
118 fail_show_invalid = function() return run "$luarocks show invalid" end,
119 fail_new_version_invalid = function() return run "$luarocks new_version invalid" end,
120 test_list_invalidtree = function() return run "$luarocks --tree=/some/invalid/tree list" end,
121 fail_inexistent_dir = function()
122 -- Unix only?
123 return run "mkdir idontexist; cd idontexist; rmdir ../idontexist; $luarocks; err=$?; cd ..; return $err"
124 end,
125 fail_make_norockspec = function() return run "$luarocks make" end,
126 fail_build_permissions = function() return run "$luarocks build --tree=/usr lpeg" end,
127 fail_build_permissions_parent = function() return run "$luarocks build --tree=/usr/invalid lpeg" end,
128 test_build_verbose = function() return run "$luarocks build --verbose lpeg" end,
129 fail_build_blank_arg = function() return run "$luarocks build --tree="" lpeg" end,
130 test_build_withpatch = function() need_luasocket(); return run "$luarocks build luadoc" end,
131 test_build_diffversion = function() return run "$luarocks build luacov ${version_luacov}" end,
132 test_build_command = function() return run "$luarocks build stdlib" end,
133 test_build_install_bin = function() return run "$luarocks build luarepl" end,
134 test_build_nohttps = function()
135 need_luasocket()
136 return run "$luarocks download --rockspec validate-args ${verrev_validate_args}"
137 and run "$luarocks build ./validate-args-${version_validate_args}-1.rockspec"
138 and rm "./validate-args-${version_validate_args}-1.rockspec"
139 end,
140 test_build_https = function()
141 need_luasocket()
142 return run "$luarocks download --rockspec validate-args ${verrev_validate_args}"
143 and run "$luarocks install luasec"
144 and run "$luarocks build ./validate-args-${verrev_validate_args}.rockspec"
145 and rm "./validate-args-${verrev_validate_args}.rockspec"
146 end,
147 test_build_supported_platforms = function() return run "$luarocks build lpty" end,
148 test_build_only_deps_rockspec = function()
149 return run "$luarocks download --rockspec lxsh ${verrev_lxsh}"
150 and run "$luarocks build ./lxsh-${verrev_lxsh}.rockspec --only-deps"
151 and (not run "$luarocks show lxsh")
152 end,
153 test_build_only_deps_src_rock = function()
154 return run "$luarocks download --source lxsh ${verrev_lxsh}"
155 and run "$luarocks build ./lxsh-${verrev_lxsh}.src.rock --only-deps"
156 and (not run "$luarocks show lxsh")
157 end,
158 test_build_only_deps = function() return run "$luarocks build luasec --only-deps" and (not run "$luarocks show luasec") end,
159 test_install_only_deps = function() return run "$luarocks install lxsh ${verrev_lxsh} --only-deps" and (not run "$luarocks show lxsh") end,
160 fail_build_missing_external = function() return run '$luarocks build "$testing_dir/testfiles/missing_external-0.1-1.rockspec" INEXISTENT_INCDIR="/invalid/dir"' end,
161 fail_build_invalidpatch = function()
162 need_luasocket()
163 return run '$luarocks build "$testing_dir/testfiles/invalid_patch-0.1-1.rockspec"'
164 end,
165 test_build_deps_partial_match = function() return run "$luarocks build lmathx" end,
166 test_build_show_downloads = function()
167 return run("$luarocks build alien", { LUAROCKS_CONFIG="$testing_dir/testing_config_show_downloads.lua" })
168 end,
169 test_download_all = function()
170 return run "$luarocks download --all validate-args"
171 and rm(glob("validate-args-*"))
172 end,
173 test_download_rockspecversion = function()
174 return run "$luarocks download --rockspec validate-args ${verrev_validate_args}"
175 and rm(glob("validate-args-*"))
176 end,
177 test_help = function() return run "$luarocks help" end,
178 fail_help_invalid = function() return run "$luarocks help invalid" end,
179 test_install_binaryrock = function()
180 return run "$luarocks build --pack-binary-rock cprint"
181 and run "$luarocks install ./cprint-${verrev_cprint}.${platform}.rock"
182 and rm "./cprint-${verrev_cprint}.${platform}.rock"
183 end,
184 test_install_with_bin = function() return run "$luarocks install wsapi" end,
185 fail_install_notazipfile = function() return run '$luarocks install "$testing_dir/testfiles/not_a_zipfile-1.0-1.src.rock"' end,
186 fail_install_invalidpatch = function()
187 need_luasocket()
188 return run '$luarocks install "$testing_dir/testfiles/invalid_patch-0.1-1.rockspec"'
189 end,
190 fail_install_invalid_filename = function() return run '$luarocks install "invalid.rock"' end,
191 fail_install_invalid_arch = function() return run '$luarocks install "foo-1.0-1.impossible-x86.rock"' end,
192 test_install_reinstall = function()
193 return run '$luarocks install "$testing_cache/luasocket-$verrev_luasocket.$platform.rock"'
194 and run '$luarocks install --deps-mode=none "$testing_cache/luasocket-$verrev_luasocket.$platform.rock"'
195 end,
196 fail_local_root = function() return run("$luarocks install --local luasocket", { USER="root" }) end,
197 test_site_config = function()
198 mv("../src/luarocks/site_config.lua", "../src/luarocks/site_config.lua.tmp")
199 local ok = run "$luarocks"
200 mv("../src/luarocks/site_config.lua.tmp", "../src/luarocks/site_config.lua")
201 return ok
202 end,
203 test_lint_ok = function()
204 return run "$luarocks download --rockspec validate-args ${verrev_validate_args}"
205 and run "$luarocks lint ./validate-args-${verrev_validate_args}.rockspec"
206 and rm "./validate-args-${verrev_validate_args}.rockspec"
207 end,
208 fail_lint_type_mismatch_string = function() return run '$luarocks lint "$testing_dir/testfiles/type_mismatch_string-1.0-1.rockspec"' end,
209 fail_lint_type_mismatch_version = function() return run '$luarocks lint "$testing_dir/testfiles/type_mismatch_version-1.0-1.rockspec"' end,
210 fail_lint_type_mismatch_table = function() return run '$luarocks lint "$testing_dir/testfiles/type_mismatch_table-1.0-1.rockspec"' end,
211 fail_lint_no_build_table = function() return run '$luarocks lint "$testing_dir/testfiles/no_build_table-0.1-1.rockspec"' end,
212 test_list = function() return run "$luarocks list" end,
213 test_list_porcelain = function() return run "$luarocks list --porcelain" end,
214 test_make_with_rockspec = function()
215 return rm_rf "./luasocket-${verrev_luasocket}"
216 and run "$luarocks download --source luasocket"
217 and run "$luarocks unpack ./luasocket-${verrev_luasocket}.src.rock"
218 and cd_run("luasocket-${verrev_luasocket}/${srcdir_luasocket}", "$luarocks make luasocket-${verrev_luasocket}.rockspec")
219 and rm_rf "./luasocket-${verrev_luasocket}"
220 end,
221 test_make_default_rockspec = function()
222 return rm_rf "./lxsh-${verrev_lxsh}"
223 and run "$luarocks download --source lxsh ${verrev_lxsh}"
224 and run "$luarocks unpack ./lxsh-${verrev_lxsh}.src.rock"
225 and cd_run("lxsh-${verrev_lxsh}/lxsh-${version_lxsh}-1", "$luarocks make")
226 and rm_rf "./lxsh-${verrev_lxsh}"
227 end,
228 test_make_pack_binary_rock = function()
229 return rm_rf "./lxsh-${verrev_lxsh}"
230 and run "$luarocks download --source lxsh ${verrev_lxsh}"
231 and run "$luarocks unpack ./lxsh-${verrev_lxsh}.src.rock"
232 and cd_run("lxsh-${verrev_lxsh}/lxsh-${version_lxsh}-1", "$luarocks make --deps-mode=none --pack-binary-rock")
233 and exists "lxsh-${verrev_lxsh}/lxsh-${version_lxsh}-1/lxsh-${verrev_lxsh}.all.rock"
234 and rm_rf "./lxsh-${verrev_lxsh}"
235 end,
236 fail_make_which_rockspec = function()
237 rm_rf "./luasocket-${verrev_luasocket}"
238 run "$luarocks download --source luasocket"
239 run "$luarocks unpack ./luasocket-${verrev_luasocket}.src.rock"
240 local ok = cd_run("luasocket-${verrev_luasocket}/${srcdir_luasocket}", "$luarocks make")
241 rm_rf "./luasocket-${verrev_luasocket}"
242 return ok
243 end,
244 test_new_version = function()
245 return run "$luarocks download --rockspec luacov ${version_luacov}"
246 and run "$luarocks new_version ./luacov-${version_luacov}-1.rockspec 0.2"
247 and rm(glob("./luacov-0.*"))
248 end,
249 test_new_version_url = function()
250 return run "$luarocks download --rockspec abelhas 1.0"
251 and run "$luarocks new_version ./abelhas-1.0-1.rockspec 1.1 https://github.com/downloads/ittner/abelhas/abelhas-1.1.tar.gz"
252 and rm(glob("./abelhas-*"))
253 end,
254 test_pack = function()
255 return run "$luarocks list"
256 and run "$luarocks pack luacov"
257 and rm(glob("./luacov-*.rock"))
258 end,
259 test_pack_src = function()
260 return run "$luarocks install luasec"
261 and run "$luarocks download --rockspec luasocket"
262 and run "$luarocks pack ./luasocket-${verrev_luasocket}.rockspec"
263 and rm(glob("./luasocket-${version_luasocket}-*.rock"))
264 end,
265 test_path = function() return run "$luarocks path --bin" end,
266 test_path_lr_path = function() return run "$luarocks path --lr-path" end,
267 test_path_lr_cpath = function() return run "$luarocks path --lr-cpath" end,
268 test_path_lr_bin = function() return run "$luarocks path --lr-bin" end,
269 test_path_with_tree = function() return run "$luarocks path --tree=lua_modules" end,
270 fail_purge_missing_tree = function() return run '$luarocks purge --tree="$testing_tree"' end,
271 test_purge = function() return run '$luarocks purge --tree="$testing_sys_tree"' end,
272 test_remove = function()
273 return run "$luarocks build abelhas ${version_abelhas}"
274 and run "$luarocks remove abelhas ${version_abelhas}"
275 end,
276 test_remove_force = function()
277 need_luasocket()
278 return run "$luarocks build lualogging"
279 and run "$luarocks remove --force luasocket"
280 end,
281 fail_remove_deps = function()
282 need_luasocket()
283 return run "$luarocks build lualogging"
284 and run "$luarocks remove luasocket"
285 end,
286 fail_remove_missing = function() return run "$luarocks remove missing_rock" end,
287 fail_remove_invalid_name = function() return run "$luarocks remove invalid.rock" end,
288 test_search_found = function() return run "$luarocks search zlib" end,
289 test_search_missing = function() return run "$luarocks search missing_rock" end,
290 test_show = function() return run "$luarocks show luacov" end,
291 test_show_modules = function() return run "$luarocks show --modules luacov" end,
292 test_show_home = function() return run "$luarocks show --home luacov" end,
293 test_show_depends = function()
294 need_luasocket()
295 return run "$luarocks install luasec"
296 and run "$luarocks show luasec"
297 end,
298 test_show_oldversion = function()
299 return run "$luarocks install luacov ${version_luacov}"
300 and run "$luarocks show luacov ${version_luacov}"
301 end,
302 test_unpack_download = function()
303 return rm_rf "./cprint-${verrev_cprint}"
304 and run "$luarocks unpack cprint"
305 and rm_rf "./cprint-${verrev_cprint}"
306 end,
307 test_unpack_src = function()
308 return rm_rf "./cprint-${verrev_cprint}"
309 and run "$luarocks download --source cprint"
310 and run "$luarocks unpack ./cprint-${verrev_cprint}.src.rock"
311 and rm_rf "./cprint-${verrev_cprint}"
312 end,
313 test_unpack_rockspec = function()
314 return rm_rf "./cprint-${verrev_cprint}"
315 and run "$luarocks download --rockspec cprint"
316 and run "$luarocks unpack ./cprint-${verrev_cprint}.rockspec"
317 and rm_rf "./cprint-${verrev_cprint}"
318 end,
319 test_unpack_binary = function()
320 return rm_rf "./cprint-${verrev_cprint}"
321 and run "$luarocks build cprint"
322 and run "$luarocks pack cprint"
323 and run "$luarocks unpack ./cprint-${verrev_cprint}.${platform}.rock"
324 and rm_rf "./cprint-${verrev_cprint}"
325 end,
326 fail_unpack_invalidpatch = function()
327 need_luasocket()
328 return run '$luarocks unpack "$testing_dir/testfiles/invalid_patch-0.1-1.rockspec"'
329 end,
330 fail_unpack_invalidrockspec = function()
331 need_luasocket()
332 return run '$luarocks unpack "invalid.rockspec"'
333 end,
334 fail_upload_invalidrockspec = function() return run '$luarocks upload "invalid.rockspec"' end,
335 fail_upload_invalidkey = function() return run '$luarocks upload --api-key="invalid" "invalid.rockspec"' end,
336 test_admin_help = function() return run "$luarocks_admin help" end,
337 test_admin_make_manifest = function() return run "$luarocks_admin make_manifest" end,
338 test_admin_add_rsync = function() return run '$luarocks_admin --server=testing add "$testing_server/luasocket-${verrev_luasocket}.src.rock"' end,
339 test_admin_add_sftp = function()
340 return run("$luarocks_admin --server=testing add ./luasocket-${verrev_luasocket}.src.rock", { LUAROCKS_CONFIG="$testing_dir/testing_config_sftp.lua" })
341 end,
342 fail_admin_add_missing = function() return run "$luarocks_admin --server=testing add" end,
343 fail_admin_invalidserver = function() return run '$luarocks_admin --server=invalid add "$testing_server/luasocket-${verrev_luasocket}.src.rock"' end,
344 fail_admin_invalidrock = function() return run "$luarocks_admin --server=testing add invalid" end,
345 test_admin_refresh_cache = function() return run "$luarocks_admin --server=testing refresh_cache" end,
346 test_admin_remove = function() return run "$luarocks_admin --server=testing remove luasocket-${verrev_luasocket}.src.rock" end,
347 fail_admin_remove_missing = function() return run "$luarocks_admin --server=testing remove" end,
348 fail_deps_mode_invalid_arg = function() return run "$luarocks remove luacov --deps-mode" end,
349
350 test_deps_mode_one = function()
351 return run '$luarocks build --tree="system" lpeg'
352 and run '$luarocks list'
353 and run '$luarocks build --deps-mode=one --tree="$testing_tree" lxsh'
354 and run_get_contents '$luarocks_noecho list --tree="$testing_tree" --porcelain lpeg' ~= ""
355 end,
356 test_deps_mode_order = function()
357 return run '$luarocks build --tree="system" lpeg'
358 and run '$luarocks build --deps-mode=order --tree="$testing_tree" lxsh'
359 and run '$luarocks_noecho list --tree="$testing_tree" --porcelain lpeg'
360 and run_get_contents '$luarocks_noecho list --tree="$testing_tree" --porcelain lpeg' == ""
361 end,
362 test_deps_mode_order_sys = function()
363 return run '$luarocks build --tree="$testing_tree" lpeg'
364 and run '$luarocks build --deps-mode=order --tree="$testing_sys_tree" lxsh'
365 and run_get_contents '$luarocks_noecho list --tree="$testing_sys_tree" --porcelain lpeg' ~= ""
366 end,
367 test_deps_mode_all_sys = function()
368 return run '$luarocks build --tree="$testing_tree" lpeg'
369 and run '$luarocks build --deps-mode=all --tree="$testing_sys_tree" lxsh'
370 and run_get_contents '$luarocks_noecho list --tree="$testing_sys_tree" --porcelain lpeg' == ""
371 end,
372
373 test_deps_mode_none = function()
374 return run '$luarocks build --tree="$testing_tree" --deps-mode=none lxsh'
375 and run_get_contents '$luarocks_noecho list --tree="$testing_tree" --porcelain lpeg' == ""
376 end,
377 test_deps_mode_nodeps_alias = function()
378 return run '$luarocks build --tree="$testing_tree" --nodeps lxsh'
379 and run_get_contents '$luarocks_noecho list --tree="$testing_tree" --porcelain lpeg' == ""
380 end,
381 test_deps_mode_make_order = function()
382 local ok = run '$luarocks build --tree="$testing_sys_tree" lpeg'
383 and rm_rf "./lxsh-${verrev_lxsh}"
384 and run "$luarocks download --source lxsh ${verrev_lxsh}"
385 and run "$luarocks unpack ./lxsh-${verrev_lxsh}.src.rock"
386 and cd_run("lxsh-${verrev_lxsh}/lxsh-${version_lxsh}-1", '$luarocks make --tree="$testing_tree" --deps-mode=order')
387 if not ok then
388 return false
389 end
390 local found = run_get_contents '$luarocks_noecho list --tree="$testing_tree" --porcelain lpeg'
391 rm_rf "./lxsh-${verrev_lxsh}"
392 return found == ""
393 end,
394 test_deps_mode_make_order_sys = function()
395 local ok = run '$luarocks build --tree="$testing_tree" lpeg'
396 and rm_rf "./lxsh-${verrev_lxsh}"
397 and run "$luarocks download --source lxsh ${verrev_lxsh}"
398 and run "$luarocks unpack ./lxsh-${verrev_lxsh}.src.rock"
399 and cd_run("lxsh-${verrev_lxsh}/lxsh-${version_lxsh}-1", '$luarocks make --tree="$testing_sys_tree" --deps-mode=order')
400 if not ok then
401 return false
402 end
403 local found = run_get_contents '$luarocks_noecho list --tree="$testing_sys_tree" --porcelain lpeg'
404 rm_rf "./lxsh-${verrev_lxsh}"
405 return found ~= ""
406 end,
407 test_write_rockspec = function() return run "$luarocks write_rockspec git://github.com/keplerproject/luarocks" end,
408 test_write_rockspec_lib = function() return run '$luarocks write_rockspec git://github.com/mbalmer/luafcgi --lib=fcgi --license="3-clause BSD" --lua-version=5.1,5.2' end,
409 test_write_rockspec_format = function() return run '$luarocks write_rockspec git://github.com/keplerproject/luarocks --rockspec-format=1.1 --lua-version=5.1,5.2' end,
410 test_write_rockspec_fullargs = function() return run '$luarocks write_rockspec git://github.com/keplerproject/luarocks --lua-version=5.1,5.2 --license="MIT/X11" --homepage="http://www.luarocks.org" --summary="A package manager for Lua modules"' end,
411 fail_write_rockspec_args = function() return run "$luarocks write_rockspec invalid" end,
412 fail_write_rockspec_args_url = function() return run "$luarocks write_rockspec http://example.com/invalid.zip" end,
413 test_write_rockspec_http = function() return run "$luarocks write_rockspec http://luarocks.org/releases/luarocks-2.1.0.tar.gz --lua-version=5.1" end,
414 test_write_rockspec_basedir = function() return run "$luarocks write_rockspec https://github.com/downloads/Olivine-Labs/luassert/luassert-1.2.tar.gz --lua-version=5.1" end,
415
416 fail_config_noflags = function() return run "$luarocks config; " end,
417 test_config_lua_incdir = function() return run "$luarocks config --lua-incdir; " end,
418 test_config_lua_libdir = function() return run "$luarocks config --lua-libdir; " end,
419 test_config_lua_ver = function() return run "$luarocks config --lua-ver; " end,
420 fail_config_system_config = function()
421 return rm "$testing_lrprefix/etc/luarocks/config.lua"
422 and run "$luarocks config --system-config; "
423 end,
424 test_config_system_config = function()
425 local ok = mkdir "$testing_lrprefix/etc/luarocks"
426 and touch "$testing_lrprefix/etc/luarocks/config.lua"
427 and run "$luarocks config --system-config; "
428 rm "$testing_lrprefix/etc/luarocks/config.lua"
429 return ok
430 end,
431 fail_config_system_config_invalid = function()
432 local ok = mkdir "$testing_lrprefix/etc/luarocks"
433 and run "echo 'if if if' > '$testing_lrprefix/etc/luarocks/config.lua' ;"
434 and run "$luarocks config --system-config"
435 rm "$testing_lrprefix/etc/luarocks/config.lua"
436 return ok
437 end,
438 test_config_user_config = function() return run "$luarocks config --user-config; " end,
439 fail_config_user_config = function() return run "LUAROCKS_CONFIG='/missing_file.lua' $luarocks config --user-config; " end,
440 test_config_rock_trees = function() return run "$luarocks config --rock-trees;" end,
441 test_config_help = function() return run "$luarocks help config;" end,
442 test_doc = function()
443 return run "$luarocks install luarepl"
444 and run "$luarocks doc luarepl"
445 end,
446 test_doc_home = function()
447 return run "$luarocks install luacov"
448 and run "$luarocks doc luacov --home"
449 end,
450 fail_doc_invalid = function () return run "$luarocks doc invalid" end,
451
452 -- Tests for https://github.com/keplerproject/luarocks/issues/375
453 test_fetch_base_dir = function()
454 local fetch = require "luarocks.fetch"
455
456 return assert("v0.3" == fetch.url_to_base_dir("https://github.com/hishamhm/lua-compat-5.2/archive/v0.3.zip"))
457 and assert("lua-compat-5.2" == fetch.url_to_base_dir("https://github.com/hishamhm/lua-compat-5.2.zip"))
458 and assert("lua-compat-5.2" == fetch.url_to_base_dir("https://github.com/hishamhm/lua-compat-5.2.tar.gz"))
459 and assert("lua-compat-5.2" == fetch.url_to_base_dir("https://github.com/hishamhm/lua-compat-5.2.tar.bz2"))
460 and assert("parser.moon" == fetch.url_to_base_dir("git://github.com/Cirru/parser.moon"))
461 and assert("v0.3" == fetch.url_to_base_dir("https://github.com/hishamhm/lua-compat-5.2/archive/v0.3"))
462 end,
463
464 -- Tests for https://github.com/keplerproject/luarocks/issues/552
465 test_install_break_dependencies_warning = function()
466 need_luasocket()
467 return run "$luarocks install say ${new_version_say}"
468 and run "$luarocks install luassert"
469 and run "$luarocks install say ${old_version_say}"
470 end,
471 test_install_break_dependencies_force = function()
472 need_luasocket()
473 return run "$luarocks install say ${new_version_say}"
474 and run "$luarocks install luassert"
475 and run "$luarocks install --force say ${old_version_say}"
476 end,
477 test_install_break_dependencies_force = function()
478 need_luasocket()
479 return run "$luarocks install say ${new_version_say}"
480 and run "$luarocks install luassert"
481 and run "$luarocks install --force-fast say ${old_version_say}"
482 end
483}
diff --git a/test/testing.sh b/test/testing.sh
deleted file mode 100755
index cb10441c..00000000
--- a/test/testing.sh
+++ /dev/null
@@ -1,651 +0,0 @@
1#!/bin/bash -e
2
3# Setup #########################################
4
5[ -e ../configure ] || {
6 echo "Please run this from the test/ directory."
7 exit 1
8}
9
10if [ -z "$*" ]
11then
12 ps aux | grep -q '[s]shd' || {
13 echo "Run sudo /bin/sshd in order to perform all tests."
14 exit 1
15 }
16fi
17
18if [ "$1" == "--travis" ]
19then
20 travis=true
21 shift
22fi
23
24luaversion=5.1.5
25
26if [ "$1" == "--lua" ]
27then
28 shift
29 luaversion=$1
30 shift
31fi
32
33luashortversion=`echo $luaversion | cut -d. -f 1-2`
34
35testing_dir="$PWD"
36
37testing_lrprefix="$testing_dir/testing_lrprefix-$luaversion"
38testing_tree="$testing_dir/testing-$luaversion"
39testing_sys_tree="$testing_dir/testing_sys-$luaversion"
40testing_tree_copy="$testing_dir/testing_copy-$luaversion"
41testing_sys_tree_copy="$testing_dir/testing_sys_copy-$luaversion"
42testing_cache="$testing_dir/testing_cache-$luaversion"
43testing_server="$testing_dir/testing_server-$luaversion"
44
45if [ "$1" == "--clean" ]
46then
47 shift
48 rm -rf "$testing_cache"
49 rm -rf "$testing_server"
50fi
51
52[ "$1" ] || rm -f luacov.stats.out
53rm -f luacov.report.out
54rm -rf /tmp/luarocks_testing
55mkdir /tmp/luarocks_testing
56rm -rf "$testing_lrprefix"
57rm -rf "$testing_tree"
58rm -rf "$testing_sys_tree"
59rm -rf "$testing_tree_copy"
60rm -rf "$testing_sys_tree_copy"
61rm -rf "$testing_dir/testing_config.lua"
62rm -rf "$testing_dir/testing_config_show_downloads.lua"
63rm -rf "$testing_dir/testing_config_sftp.lua"
64rm -rf "$testing_dir/luacov.config"
65
66mkdir -p "$testing_cache"
67
68[ "$1" = "clean" ] && {
69 rm -f luacov.stats.out
70 exit 0
71}
72
73cat <<EOF > $testing_dir/testing_config.lua
74rocks_trees = {
75 "$testing_tree",
76 { name = "system", root = "$testing_sys_tree" },
77}
78rocks_servers = {
79 "$testing_server"
80}
81local_cache = "$testing_cache"
82upload_server = "testing"
83upload_user = "$USER"
84upload_servers = {
85 testing = {
86 rsync = "localhost/tmp/luarocks_testing",
87 },
88}
89external_deps_dirs = {
90 "/usr/local",
91 "/usr",
92 -- These are used for a test that fails, so it
93 -- can point to invalid paths:
94 {
95 prefix = "/opt",
96 bin = "bin",
97 include = "include",
98 lib = { "lib", "lib64" },
99 }
100}
101EOF
102(
103 cat $testing_dir/testing_config.lua
104 echo "show_downloads = true"
105) > $testing_dir/testing_config_show_downloads.lua
106cat <<EOF > $testing_dir/testing_config_sftp.lua
107rocks_trees = {
108 "$testing_tree",
109 "$testing_sys_tree",
110}
111local_cache = "$testing_cache"
112upload_server = "testing"
113upload_user = "$USER"
114upload_servers = {
115 testing = {
116 sftp = "localhost/tmp/luarocks_testing",
117 },
118}
119EOF
120cat <<EOF > $testing_dir/luacov.config
121return {
122 statsfile = "$testing_dir/luacov.stats.out",
123 reportfile = "$testing_dir/luacov.report.out",
124 modules = {
125 ["luarocks"] = "src/bin/luarocks",
126 ["luarocks-admin"] = "src/bin/luarocks-admin",
127 ["luarocks.*"] = "src",
128 ["luarocks.*.*"] = "src",
129 ["luarocks.*.*.*"] = "src"
130 }
131}
132EOF
133
134export LUAROCKS_CONFIG="$testing_dir/testing_config.lua"
135export LUA_PATH=
136export LUA_CPATH=
137
138if [ "$travis" ]
139then
140 luadir=/tmp/lua-$luaversion
141 pushd /tmp
142 if [ ! -e "$luadir/bin/lua" ]
143 then
144 mkdir -p lua
145 echo "Downloading lua $luaversion..."
146 wget "http://www.lua.org/ftp/lua-$luaversion.tar.gz" &> /dev/null
147 tar zxpf "lua-$luaversion.tar.gz"
148 cd "lua-$luaversion"
149 echo "Building lua $luaversion..."
150 make linux INSTALL_TOP="$luadir" &> /dev/null
151 make install INSTALL_TOP="$luadir" &> /dev/null
152 fi
153 popd
154 [ -e ~/.ssh/id_rsa.pub ] || ssh-keygen -t rsa -P "" -f ~/.ssh/id_rsa
155 cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
156 chmod og-wx ~/.ssh/authorized_keys
157 ssh-keyscan localhost >> ~/.ssh/known_hosts
158else
159 luadir="/Programs/Lua/Current"
160 if [ ! -e "$luadir" ]
161 then
162 luadir="/usr/local"
163 fi
164fi
165
166if [ `uname -m` = i686 ]
167then
168 platform="linux-x86"
169else
170 platform="linux-x86_64"
171fi
172
173lua="$luadir/bin/lua"
174
175version_luasocket=3.0rc1
176verrev_luasocket=${version_luasocket}-1
177srcdir_luasocket=luasocket-3.0-rc1
178
179version_cprint=0.1
180verrev_cprint=0.1-2
181
182new_version_say=1.2-1
183old_version_say=1.0-1
184
185version_luacov=0.11.0
186verrev_luacov=${version_luacov}-1
187version_lxsh=0.8.6
188version_validate_args=1.5.4
189verrev_validate_args=1.5.4-1
190verrev_lxsh=${version_lxsh}-2
191version_abelhas=1.0
192verrev_abelhas=${version_abelhas}-1
193
194luasec=luasec
195
196cd ..
197./configure --with-lua="$luadir" --prefix="$testing_lrprefix"
198make clean
199make src/luarocks/site_config.lua
200make dev
201cd src
202basedir=$PWD
203run_lua() {
204 if [ "$1" = "--noecho" ]; then shift; noecho=1; else noecho=0; fi
205 if [ "$1" = "--nocov" ]; then shift; nocov=1; else nocov=0; fi
206 if [ "$noecho" = 0 ]
207 then
208 echo $*
209 fi
210 cmd=$1
211 shift
212 if [ "$nocov" = 0 ]
213 then
214 "$lua" -e"require('luacov.runner')('$testing_dir/luacov.config')" "$basedir/bin/$cmd" "$@"
215 else
216 "$lua" "$basedir/bin/$cmd" "$@"
217 fi
218}
219luarocks="run_lua luarocks"
220luarocks_nocov="run_lua --nocov luarocks"
221luarocks_noecho="run_lua --noecho luarocks"
222luarocks_noecho_nocov="run_lua --noecho --nocov luarocks"
223luarocks_admin="run_lua luarocks-admin"
224luarocks_admin_nocov="run_lua --nocov luarocks-admin"
225
226###################################################
227
228mkdir -p "$testing_server"
229(
230 cd "$testing_server"
231 luarocks_repo="https://luarocks.org"
232 get() { [ -e `basename "$1"` ] || wget -c "$1"; }
233 get "$luarocks_repo/luacov-${verrev_luacov}.src.rock"
234 get "$luarocks_repo/luacov-${verrev_luacov}.rockspec"
235 get "$luarocks_repo/luadoc-3.0.1-1.src.rock"
236 get "$luarocks_repo/lualogging-1.3.0-1.src.rock"
237 get "$luarocks_repo/luasocket-${verrev_luasocket}.src.rock"
238 get "$luarocks_repo/luasocket-${verrev_luasocket}.rockspec"
239 get "$luarocks_repo/luafilesystem-1.6.3-1.src.rock"
240 get "$luarocks_repo/stdlib-41.0.0-1.src.rock"
241 get "$luarocks_repo/luarepl-0.4-1.src.rock"
242 get "$luarocks_repo/validate-args-1.5.4-1.rockspec"
243 get "$luarocks_repo/luasec-0.6-1.rockspec"
244 get "$luarocks_repo/luabitop-1.0.2-1.rockspec"
245 get "$luarocks_repo/luabitop-1.0.2-1.src.rock"
246 get "$luarocks_repo/lpty-1.0.1-1.src.rock"
247 get "$luarocks_repo/cprint-${verrev_cprint}.src.rock"
248 get "$luarocks_repo/cprint-${verrev_cprint}.rockspec"
249 get "$luarocks_repo/wsapi-1.6-1.src.rock"
250 get "$luarocks_repo/lxsh-${verrev_lxsh}.src.rock"
251 get "$luarocks_repo/lxsh-${verrev_lxsh}.rockspec"
252 get "$luarocks_repo/abelhas-${verrev_abelhas}.rockspec"
253 get "$luarocks_repo/lzlib-0.4.1.53-1.src.rock"
254 get "$luarocks_repo/lpeg-0.12-1.src.rock"
255 get "$luarocks_repo/luaposix-33.2.1-1.src.rock"
256 get "$luarocks_repo/md5-1.2-1.src.rock"
257 get "$luarocks_repo/lmathx-20120430.51-1.src.rock"
258 get "$luarocks_repo/lmathx-20120430.51-1.rockspec"
259 get "$luarocks_repo/lmathx-20120430.52-1.src.rock"
260 get "$luarocks_repo/lmathx-20120430.52-1.rockspec"
261 get "$luarocks_repo/lmathx-20150505-1.src.rock"
262 get "$luarocks_repo/lmathx-20150505-1.rockspec"
263 get "$luarocks_repo/lua-path-0.2.3-1.src.rock"
264 get "$luarocks_repo/lua-cjson-2.1.0-1.src.rock"
265 get "$luarocks_repo/luacov-coveralls-0.1.1-1.src.rock"
266 get "$luarocks_repo/say-1.2-1.src.rock"
267 get "$luarocks_repo/say-1.0-1.src.rock"
268 get "$luarocks_repo/luassert-1.7.0-1.src.rock"
269)
270$luarocks_admin_nocov make_manifest "$testing_server"
271
272###################################################
273
274checksum_path() {
275 ( cd "$1"; find . -printf "%s %p\n" | md5sum )
276}
277
278build_environment() {
279 rm -rf "$testing_tree"
280 rm -rf "$testing_sys_tree"
281 rm -rf "$testing_tree_copy"
282 rm -rf "$testing_sys_tree_copy"
283 mkdir -p "$testing_tree"
284 mkdir -p "$testing_sys_tree"
285 $luarocks_admin_nocov make_manifest "$testing_cache"
286 for package in "$@"
287 do
288 $luarocks_nocov install --only-server="$testing_cache" --tree="$testing_sys_tree" $package || {
289 $luarocks_nocov build --tree="$testing_sys_tree" $package
290 $luarocks_nocov pack --tree="$testing_sys_tree" $package; mv $package-*.rock "$testing_cache"
291 }
292 done
293 export LUA_PATH=
294 export LUA_CPATH=
295 eval `$luarocks_noecho_nocov path --bin`
296 cp -a "$testing_tree" "$testing_tree_copy"
297 cp -a "$testing_sys_tree" "$testing_sys_tree_copy"
298 testing_tree_copy_md5=`checksum_path "$testing_tree_copy"`
299 testing_sys_tree_copy_md5=`checksum_path "$testing_sys_tree_copy"`
300}
301
302reset_environment() {
303 testing_tree_md5=`checksum_path "$testing_tree"`
304 testing_sys_tree_md5=`checksum_path "$testing_sys_tree"`
305 if [ "$testing_tree_md5" != "$testing_tree_copy_md5" ]
306 then
307 rm -rf "$testing_tree"
308 cp -a "$testing_tree_copy" "$testing_tree"
309 fi
310 if [ "$testing_sys_tree_md5" != "$testing_sys_tree_copy_md5" ]
311 then
312 rm -rf "$testing_sys_tree"
313 cp -a "$testing_sys_tree_copy" "$testing_sys_tree"
314 fi
315}
316
317need() {
318 echo "Obtaining $1 $2..."
319 if $luarocks show $1 &> /dev/null
320 then
321 echo "Already available"
322 return
323 fi
324 platrock="$1-$2.$platform.rock"
325 if [ ! -e "$testing_cache/$platrock" ]
326 then
327 echo "Building $1 $2..."
328 $luarocks_nocov build --pack-binary-rock $1 $2
329 mv "$platrock" "$testing_cache"
330 fi
331 echo "Installing $1 $2..."
332 $luarocks_nocov install "$testing_cache/$platrock"
333 return
334}
335need_luasocket() { need luasocket $verrev_luasocket; }
336
337# Tests #########################################
338test_version() { $luarocks --version; }
339
340fail_unknown_command() { $luarocks unknown_command; }
341
342fail_arg_boolean_parameter() { $luarocks --porcelain=invalid; }
343fail_arg_boolean_unknown() { $luarocks --invalid-flag; }
344fail_arg_string_no_parameter() { $luarocks --server; }
345fail_arg_string_followed_by_flag() { $luarocks --server --porcelain; }
346fail_arg_string_unknown() { $luarocks --invalid-flag=abc; }
347
348fail_invalid_assignment() { $luarocks invalid=5; }
349
350test_empty_list() { $luarocks list; }
351test_list_outdated() { $luarocks list --outdated; }
352
353fail_sysconfig_err() { local err=0; local scdir="$testing_lrprefix/etc/luarocks/"; mkdir -p "$scdir"; local sysconfig="$scdir/config.lua"; echo "aoeui" > "$sysconfig"; echo $sysconfig; $luarocks list; err=$?; rm "$sysconfig"; return "$err"; }
354fail_sysconfig_default_err() { local err=0; local scdir="$testing_lrprefix/etc/luarocks/"; mkdir -p "$scdir"; local sysconfig="$scdir/config-$luashortversion.lua"; echo "aoeui" > "$sysconfig"; echo $sysconfig; $luarocks list; err=$?; rm "$sysconfig"; return "$err"; }
355
356fail_build_noarg() { $luarocks build; }
357fail_download_noarg() { $luarocks download; }
358fail_install_noarg() { $luarocks install; }
359fail_lint_noarg() { $luarocks lint; }
360fail_search_noarg() { $luarocks search; }
361fail_show_noarg() { $luarocks show; }
362fail_unpack_noarg() { $luarocks unpack; }
363fail_upload_noarg() { $luarocks upload; }
364fail_remove_noarg() { $luarocks remove; }
365fail_doc_noarg() { $luarocks doc; }
366
367fail_build_invalid() { $luarocks build invalid; }
368fail_download_invalid() { $luarocks download invalid; }
369fail_install_invalid() { $luarocks install invalid; }
370fail_lint_invalid() { $luarocks lint invalid; }
371fail_show_invalid() { $luarocks show invalid; }
372fail_new_version_invalid() { $luarocks new_version invalid; }
373
374test_list_invalidtree() { $luarocks --tree=/some/invalid/tree list; }
375
376fail_inexistent_dir() { mkdir idontexist; cd idontexist; rmdir ../idontexist; $luarocks; err=$?; cd ..; return $err; }
377
378fail_make_norockspec() { $luarocks make; }
379
380fail_build_permissions() { $luarocks build --tree=/usr lpeg; }
381fail_build_permissions_parent() { $luarocks build --tree=/usr/invalid lpeg; }
382
383test_build_verbose() { $luarocks build --verbose lpeg; }
384test_build_timeout() { $luarocks --timeout=10; }
385fail_build_timeout_invalid() { $luarocks --timeout=abc; }
386test_build_branch() { $luarocks build --branch=master lpeg; }
387fail_build_invalid_entry_deps_mode() { $luarocks build --deps-mode=123 lpeg; }
388test_build_only_server() { $luarocks --only-server=testing; }
389test_build_only_sources() { $luarocks build --only-sources="http://example.com" lpeg; }
390fail_build_blank_arg() { $luarocks build --tree="" lpeg; }
391test_build_withpatch() { need_luasocket; $luarocks build luadoc; }
392test_build_diffversion() { $luarocks build luacov ${version_luacov}; }
393test_build_command() { $luarocks build stdlib; }
394test_build_install_bin() { $luarocks build luarepl; }
395test_build_nohttps() { need_luasocket; $luarocks download --rockspec validate-args ${verrev_validate_args} && $luarocks build ./validate-args-${version_validate_args}-1.rockspec && rm ./validate-args-${version_validate_args}-1.rockspec; }
396test_build_https() { need_luasocket; $luarocks download --rockspec validate-args ${verrev_validate_args} && $luarocks install $luasec && $luarocks build ./validate-args-${verrev_validate_args}.rockspec && rm ./validate-args-${verrev_validate_args}.rockspec; }
397test_build_supported_platforms() { $luarocks build lpty; }
398test_build_only_deps_rockspec() { $luarocks download --rockspec lxsh ${verrev_lxsh} && $luarocks build ./lxsh-${verrev_lxsh}.rockspec --only-deps && { $luarocks show lxsh; [ $? -ne 0 ]; }; }
399test_build_only_deps_src_rock() { $luarocks download --source lxsh ${verrev_lxsh} && $luarocks build ./lxsh-${verrev_lxsh}.src.rock --only-deps && { $luarocks show lxsh; [ $? -ne 0 ]; }; }
400test_build_only_deps() { $luarocks build luasec --only-deps && { $luarocks show luasec; [ $? -ne 0 ]; }; }
401test_install_only_deps() { $luarocks install lxsh ${verrev_lxsh} --only-deps && { $luarocks show lxsh; [ $? -ne 0 ]; }; }
402test_build_no_deps() { $luarocks build luasec --nodeps; }
403test_install_no_deps() { $luarocks install luasec --nodeps; }
404fail_build_missing_external() { $luarocks build "$testing_dir/testfiles/missing_external-0.1-1.rockspec" INEXISTENT_INCDIR="/invalid/dir"; }
405fail_build_invalidpatch() { need_luasocket; $luarocks build "$testing_dir/testfiles/invalid_patch-0.1-1.rockspec"; }
406
407test_build_deps_partial_match() { $luarocks build lmathx; }
408test_build_show_downloads() { export LUAROCKS_CONFIG="$testing_dir/testing_config_show_downloads.lua" && $luarocks build alien; export LUAROCKS_CONFIG="$testing_dir/testing_config.lua"; }
409
410test_download_all() { $luarocks download --all validate-args && rm validate-args-*; }
411test_download_rockspecversion() { $luarocks download --rockspec validate-args ${verrev_validate_args} && rm validate-args-*; }
412
413test_help() { $luarocks help; }
414fail_help_invalid() { $luarocks help invalid; }
415
416test_install_only_deps() { $luarocks install --only-deps "$testing_cache/luasocket-$verrev_luasocket.$platform.rock"; }
417test_install_binaryrock() { $luarocks build --pack-binary-rock cprint && $luarocks install ./cprint-${verrev_cprint}.${platform}.rock && rm ./cprint-${verrev_cprint}.${platform}.rock; }
418test_install_with_bin() { $luarocks install wsapi; }
419fail_install_notazipfile() { $luarocks install "$testing_dir/testfiles/not_a_zipfile-1.0-1.src.rock"; }
420fail_install_invalidpatch() { need_luasocket; $luarocks install "$testing_dir/testfiles/invalid_patch-0.1-1.rockspec"; }
421fail_install_invalid_filename() { $luarocks install "invalid.rock"; }
422fail_install_invalid_arch() { $luarocks install "foo-1.0-1.impossible-x86.rock"; }
423test_install_reinstall() { $luarocks install "$testing_cache/luasocket-$verrev_luasocket.$platform.rock"; $luarocks install --deps-mode=none "$testing_cache/luasocket-$verrev_luasocket.$platform.rock"; }
424
425fail_local_root() { USER=root $luarocks install --local luasocket; }
426
427test_site_config() { mv ../src/luarocks/site_config.lua ../src/luarocks/site_config.lua.tmp; $luarocks; mv ../src/luarocks/site_config.lua.tmp ../src/luarocks/site_config.lua; }
428
429test_lint_ok() { $luarocks download --rockspec validate-args ${verrev_validate_args} && $luarocks lint ./validate-args-${verrev_validate_args}.rockspec && rm ./validate-args-${verrev_validate_args}.rockspec; }
430fail_lint_type_mismatch_string() { $luarocks lint "$testing_dir/testfiles/type_mismatch_string-1.0-1.rockspec"; }
431fail_lint_type_mismatch_version() { $luarocks lint "$testing_dir/testfiles/type_mismatch_version-1.0-1.rockspec"; }
432fail_lint_type_mismatch_table() { $luarocks lint "$testing_dir/testfiles/type_mismatch_table-1.0-1.rockspec"; }
433fail_lint_no_build_table() { $luarocks lint "$testing_dir/testfiles/no_build_table-0.1-1.rockspec"; }
434
435test_list() { $luarocks list; }
436test_list_porcelain() { $luarocks list --porcelain; }
437
438test_make_with_rockspec() { rm -rf ./luasocket-${verrev_luasocket} && $luarocks download --source luasocket && $luarocks unpack ./luasocket-${verrev_luasocket}.src.rock && cd luasocket-${verrev_luasocket}/${srcdir_luasocket} && $luarocks make luasocket-${verrev_luasocket}.rockspec && cd ../.. && rm -rf ./luasocket-${verrev_luasocket}; }
439test_make_default_rockspec() { rm -rf ./lxsh-${verrev_lxsh} && $luarocks download --source lxsh ${verrev_lxsh} && $luarocks unpack ./lxsh-${verrev_lxsh}.src.rock && cd lxsh-${verrev_lxsh}/lxsh-${version_lxsh}-1 && $luarocks new_version lxsh-${verrev_lxsh}.rockspec && $luarocks make && cd ../.. && rm -rf ./lxsh-${verrev_lxsh}; }
440test_make_unnamed_rockspec() { rm -rf ./lxsh-${verrev_lxsh} && $luarocks download --source lxsh ${verrev_lxsh} && $luarocks unpack ./lxsh-${verrev_lxsh}.src.rock && cd lxsh-${verrev_lxsh}/lxsh-${version_lxsh}-1 && cp lxsh-${verrev_lxsh}.rockspec rockspec && $luarocks make && cd ../.. && rm -rf ./lxsh-${verrev_lxsh}; }
441fail_make_ambiguous_rockspec() { rm -rf ./lxsh-${verrev_lxsh} && $luarocks download --source lxsh ${verrev_lxsh} && $luarocks unpack ./lxsh-${verrev_lxsh}.src.rock && cd lxsh-${verrev_lxsh}/lxsh-${version_lxsh}-1 && cp lxsh-${verrev_lxsh}.rockspec lxsh2-${verrev_lxsh}.rockspec && $luarocks make && cd ../.. && rm -rf ./lxsh-${verrev_lxsh}; }
442fail_make_ambiguous_unnamed_rockspec() { rm -rf ./lxsh-${verrev_lxsh} && $luarocks download --source lxsh ${verrev_lxsh} && $luarocks unpack ./lxsh-${verrev_lxsh}.src.rock && cd lxsh-${verrev_lxsh}/lxsh-${version_lxsh}-1 && mv lxsh-${verrev_lxsh}.rockspec 1_rockspec && cp 1_rockspec 2_rockspec && $luarocks make && cd ../.. && rm -rf ./lxsh-${verrev_lxsh}; }
443test_make_pack_binary_rock() { rm -rf ./lxsh-${verrev_lxsh} && $luarocks download --source lxsh ${verrev_lxsh} && $luarocks unpack ./lxsh-${verrev_lxsh}.src.rock && cd lxsh-${verrev_lxsh}/lxsh-${version_lxsh}-1 && $luarocks make --deps-mode=none --pack-binary-rock && [ -e ./lxsh-${verrev_lxsh}.all.rock ] && cd ../.. && rm -rf ./lxsh-${verrev_lxsh}; }
444
445test_new_version() { $luarocks download --rockspec luacov ${version_luacov} && $luarocks new_version ./luacov-${version_luacov}-1.rockspec 0.2 && rm ./luacov-0.*; }
446test_new_version_url() { $luarocks download --rockspec abelhas 1.0 && $luarocks new_version ./abelhas-1.0-1.rockspec 1.1 https://github.com/downloads/ittner/abelhas/abelhas-1.1.tar.gz && rm ./abelhas-*; }
447test_new_version_tag() { $luarocks download --rockspec luacov ${version_luacov} && $luarocks new_version ./luacov-${version_luacov}-1.rockspec --tag v0.3 && rm ./luacov-0.3-1.rockspec; }
448test_new_version_tag_without_arg() { rm -rf ./*rockspec && $luarocks download --rockspec luacov ${version_luacov} && $luarocks new_version --tag v0.3 && rm ./luacov-0.3-1.rockspec; }
449
450test_pack() { $luarocks list && $luarocks pack luacov && rm ./luacov-*.rock; }
451test_pack_src() { $luarocks install $luasec && $luarocks download --rockspec luasocket && $luarocks pack ./luasocket-${verrev_luasocket}.rockspec && rm ./luasocket-${version_luasocket}-*.rock; }
452
453test_path() { $luarocks path --bin; }
454test_path_lr_path() { $luarocks path --lr-path; }
455test_path_lr_cpath() { $luarocks path --lr-cpath; }
456test_path_lr_bin() { $luarocks path --lr-bin; }
457test_path_with_tree() { $luarocks path --tree=lua_modules; }
458
459fail_purge_missing_tree() { $luarocks purge --tree="$testing_tree"; }
460fail_purge_tree_notstring() { $luarocks purge --tree=1; }
461test_purge() { $luarocks purge --tree="$testing_sys_tree"; }
462test_purge_oldversions() { $luarocks purge --old-versions --tree="$testing_sys_tree"; }
463
464test_remove() { $luarocks build abelhas ${version_abelhas} && $luarocks remove abelhas ${version_abelhas}; }
465test_remove_force() { need_luasocket; $luarocks build lualogging && $luarocks remove --force luasocket; }
466test_remove_force_fast() { need_luasocket; $luarocks build lualogging && $luarocks remove --force-fast luasocket; }
467fail_remove_deps() { need_luasocket; $luarocks build lualogging && $luarocks remove luasocket; }
468fail_remove_missing() { $luarocks remove missing_rock; }
469fail_remove_invalid_name() { $luarocks remove invalid.rock; }
470
471test_search_found() { $luarocks search zlib; }
472test_search_missing() { $luarocks search missing_rock; }
473test_search_version() { $luarocks search zlib 1.1; }
474test_search_all() { $luarocks search --all; }
475fail_search_nostring() { $var=123; $luarocks search $var; }
476
477test_show() { $luarocks show luacov; }
478test_show_modules() { $luarocks show --modules luacov; }
479test_show_home() { $luarocks show --home luacov; }
480test_show_deps() { $luarocks show --deps luacov; }
481test_show_rockspec() { $luarocks show --rockspec luacov; }
482test_show_mversion() { $luarocks show --mversion luacov; }
483test_show_rocktree() { $luarocks show --rock-tree luacov; }
484test_show_rockdir() { $luarocks show --rock-dir luacov; }
485test_show_depends() { need_luasocket; $luarocks install $luasec && $luarocks show luasec; }
486test_show_oldversion() { $luarocks install luacov ${version_luacov} && $luarocks show luacov ${version_luacov}; }
487
488test_unpack_download() { rm -rf ./cprint-${verrev_cprint} && $luarocks unpack cprint && rm -rf ./cprint-${verrev_cprint}; }
489test_unpack_src() { rm -rf ./cprint-${verrev_cprint} && $luarocks download --source cprint && $luarocks unpack ./cprint-${verrev_cprint}.src.rock && rm -rf ./cprint-${verrev_cprint}; }
490test_unpack_rockspec() { rm -rf ./cprint-${verrev_cprint} && $luarocks download --rockspec cprint && $luarocks unpack ./cprint-${verrev_cprint}.rockspec && rm -rf ./cprint-${verrev_cprint}; }
491test_unpack_binary() { rm -rf ./cprint-${verrev_cprint} && $luarocks build cprint && $luarocks pack cprint && $luarocks unpack ./cprint-${verrev_cprint}.${platform}.rock && rm -rf ./cprint-${verrev_cprint}; }
492fail_unpack_invalidpatch() { need_luasocket; $luarocks unpack "$testing_dir/testfiles/invalid_patch-0.1-1.rockspec"; }
493fail_unpack_invalidrockspec() { need_luasocket; $luarocks unpack "invalid.rockspec"; }
494
495fail_upload_invalidrockspec() { $luarocks upload "invalid.rockspec"; }
496fail_upload_invalidkey() { $luarocks upload --api-key="invalid" "invalid.rockspec"; }
497fail_upload_skippack() { $luarocks upload --api-key="invalid" --skip-pack "luacov-${verrev_luacov}.rockspec"; }
498fail_upload_force() { $luarocks install lua-cjson && $luarocks upload --api-key="invalid" --force "luacov-${verrev_luacov}.rockspec" && $luarocks remove lua-cjson; }
499
500
501test_admin_help() { $luarocks_admin help; }
502
503test_admin_make_manifest() { $luarocks_admin make_manifest; }
504test_admin_add_rsync() { $luarocks_admin --server=testing add "$testing_server/luasocket-${verrev_luasocket}.src.rock"; }
505test_admin_add_sftp() { export LUAROCKS_CONFIG="$testing_dir/testing_config_sftp.lua" && $luarocks_admin --server=testing add ./luasocket-${verrev_luasocket}.src.rock; export LUAROCKS_CONFIG="$testing_dir/testing_config.lua"; }
506fail_admin_add_missing() { $luarocks_admin --server=testing add; }
507fail_admin_invalidserver() { $luarocks_admin --server=invalid add "$testing_server/luasocket-${verrev_luasocket}.src.rock"; }
508fail_admin_invalidrock() { $luarocks_admin --server=testing add invalid; }
509test_admin_refresh_cache() { $luarocks_admin --server=testing refresh_cache; }
510test_admin_remove() { $luarocks_admin --server=testing remove luasocket-${verrev_luasocket}.src.rock; }
511fail_admin_remove_missing() { $luarocks_admin --server=testing remove; }
512fail_admin_split_server_url() { $luarocks_admin --server="localhost@/tmp/luarocks_testing" add "$testing_server/luasocket-${verrev_luasocket}.src.rock"; }
513
514fail_deps_mode_invalid_arg() { $luarocks remove luacov --deps-mode; }
515test_deps_mode_one() { $luarocks build --tree="system" lpeg && $luarocks list && $luarocks build --deps-mode=one --tree="$testing_tree" lxsh && [ `$luarocks_noecho list --tree="$testing_tree" --porcelain lpeg | wc -l` = 1 ]; }
516test_deps_mode_order() { $luarocks build --tree="system" lpeg && $luarocks build --deps-mode=order --tree="$testing_tree" lxsh && $luarocks_noecho list --tree="$testing_tree" --porcelain lpeg && [ `$luarocks_noecho list --tree="$testing_tree" --porcelain lpeg | wc -l` = 0 ]; }
517test_deps_mode_order_sys() { $luarocks build --tree="$testing_tree" lpeg && $luarocks build --deps-mode=order --tree="$testing_sys_tree" lxsh && [ `$luarocks_noecho list --tree="$testing_sys_tree" --porcelain lpeg | wc -l` = 1 ]; }
518test_deps_mode_all_sys() { $luarocks build --tree="$testing_tree" lpeg && $luarocks build --deps-mode=all --tree="$testing_sys_tree" lxsh && [ `$luarocks_noecho list --tree="$testing_sys_tree" --porcelain lpeg | wc -l` = 0 ]; }
519test_deps_mode_none() { $luarocks build --tree="$testing_tree" --deps-mode=none lxsh; [ `$luarocks_noecho list --tree="$testing_tree" --porcelain lpeg | wc -l` = 0 ]; }
520test_deps_mode_nodeps_alias() { $luarocks build --tree="$testing_tree" --nodeps lxsh; [ `$luarocks_noecho list --tree="$testing_tree" --porcelain lpeg | wc -l` = 0 ]; }
521test_deps_mode_make_order() { $luarocks build --tree="$testing_sys_tree" lpeg && rm -rf ./lxsh-${verrev_lxsh} && $luarocks download --source lxsh ${verrev_lxsh} && $luarocks unpack ./lxsh-${verrev_lxsh}.src.rock && cd lxsh-${verrev_lxsh}/lxsh-${version_lxsh}-1 && $luarocks make --tree="$testing_tree" --deps-mode=order && cd ../.. && [ `$luarocks_noecho list --tree="$testing_tree" --porcelain lpeg | wc -l` = 0 ] && rm -rf ./lxsh-${verrev_lxsh}; }
522test_deps_mode_make_order_sys() { $luarocks build --tree="$testing_tree" lpeg && rm -rf ./lxsh-${verrev_lxsh} && $luarocks download --source lxsh ${verrev_lxsh} && $luarocks unpack ./lxsh-${verrev_lxsh}.src.rock && cd lxsh-${verrev_lxsh}/lxsh-${version_lxsh}-1 && $luarocks make --tree="$testing_sys_tree" --deps-mode=order && cd ../.. && [ `$luarocks_noecho list --tree="$testing_tree" --porcelain lpeg | wc -l` = 1 ] && rm -rf ./lxsh-${verrev_lxsh}; }
523
524test_write_rockspec() { $luarocks write_rockspec git://github.com/keplerproject/luarocks; }
525test_write_rockspec_name() { $luarocks write_rockspec luarocks git://github.com/keplerproject/luarocks; }
526test_write_rockspec_name_version() { $luarocks write_rockspec luarocks 7.8.9 git://github.com/keplerproject/luarocks; }
527test_write_rockspec_current_dir() { $luarocks write_rockspec; }
528test_write_rockspec_tag() { $luarocks write_rockspec git://github.com/keplerproject/luarocks --tag=v2.3.0; }
529test_write_rockspec_lib() { $luarocks write_rockspec git://github.com/mbalmer/luafcgi --lib=fcgi --license="3-clause BSD" --lua-version=5.1,5.2; }
530test_write_rockspec_format() { $luarocks write_rockspec git://github.com/keplerproject/luarocks --rockspec-format=1.1 --lua-version=5.1,5.2; }
531test_write_rockspec_fullargs() { $luarocks write_rockspec git://github.com/keplerproject/luarocks --lua-version=5.1,5.2 --license="MIT/X11" --homepage="http://www.luarocks.org" --summary="A package manager for Lua modules"; }
532fail_write_rockspec_args() { $luarocks write_rockspec invalid; }
533fail_write_rockspec_args_url() { $luarocks write_rockspec http://example.com/invalid.zip; }
534test_write_rockspec_http() { $luarocks write_rockspec http://luarocks.org/releases/luarocks-2.1.0.tar.gz --lua-version=5.1; }
535test_write_rockspec_basedir() { $luarocks write_rockspec https://github.com/downloads/Olivine-Labs/luassert/luassert-1.2.tar.gz --lua-version=5.1; }
536
537fail_config_noflags() { $luarocks config; }
538test_config_lua_incdir() { $luarocks config --lua-incdir; }
539test_config_lua_libdir() { $luarocks config --lua-libdir; }
540test_config_lua_ver() { $luarocks config --lua-ver; }
541fail_config_system_config() { rm -f "$testing_lrprefix/etc/luarocks/config.lua"; $luarocks config --system-config; }
542test_config_system_config() { mkdir -p "$testing_lrprefix/etc/luarocks"; touch "$testing_lrprefix/etc/luarocks/config.lua"; $luarocks config --system-config; err=$?; rm -f "$testing_lrprefix/etc/luarocks/config.lua"; return $err; }
543fail_config_system_config_invalid() { mkdir -p "$testing_lrprefix/etc/luarocks"; echo "if if if" > "$testing_lrprefix/etc/luarocks/config.lua"; $luarocks config --system-config; err=$?; rm -f "$testing_lrprefix/etc/luarocks/config.lua"; return $err; }
544test_config_user_config() { $luarocks config --user-config; }
545fail_config_user_config() { LUAROCKS_CONFIG="/missing_file.lua" $luarocks config --user-config; }
546test_config_rock_trees() { $luarocks config --rock-trees; }
547test_config_help() { $luarocks help config; }
548
549# Tests for https://github.com/keplerproject/luarocks/issues/375
550test_fetch_base_dir() { $lua <<EOF
551 local fetch = require "luarocks.fetch"
552
553 assert("v0.3" == fetch.url_to_base_dir("https://github.com/hishamhm/lua-compat-5.2/archive/v0.3.zip"))
554 assert("lua-compat-5.2" == fetch.url_to_base_dir("https://github.com/hishamhm/lua-compat-5.2.zip"))
555 assert("lua-compat-5.2" == fetch.url_to_base_dir("https://github.com/hishamhm/lua-compat-5.2.tar.gz"))
556 assert("lua-compat-5.2" == fetch.url_to_base_dir("https://github.com/hishamhm/lua-compat-5.2.tar.bz2"))
557 assert("parser.moon" == fetch.url_to_base_dir("git://github.com/Cirru/parser.moon"))
558 assert("v0.3" == fetch.url_to_base_dir("https://github.com/hishamhm/lua-compat-5.2/archive/v0.3"))
559EOF
560}
561
562test_doc() { $luarocks install luarepl; $luarocks doc luarepl; }
563test_doc_home() { $luarocks install luacov; $luarocks doc luacov --home; }
564fail_doc_invalid() { $luarocks doc invalid; }
565test_doc_list() { $luarocks install luacov; $luarocks doc luacov --list; }
566test_doc_local() { $luarocks install luacov; $luarocks doc luacov --local; }
567test_doc_porcelain() { $luarocks install luacov; $luarocks doc luacov --porcelain; }
568
569# Tests for https://github.com/keplerproject/luarocks/pull/552
570test_install_break_dependencies_warning() { need_luasocket; $luarocks install say ${new_version_say} && $luarocks install luassert && $luarocks install say ${old_version_say}; }
571test_install_break_dependencies_force() { need_luasocket; $luarocks install say ${new_version_say} && $luarocks install luassert && $luarocks install --force say ${old_version_say}; }
572test_install_break_dependencies_forcefast() { need_luasocket; $luarocks install say ${new_version_say} && $luarocks install luassert && $luarocks install --force-fast say ${old_version_say}; }
573
574# Driver #########################################
575run_tests() {
576 grep "^test_$1.*(" < $testing_dir/testing.sh | cut -d'(' -f1 | while read test
577 do
578 echo "-------------------------------------------"
579 echo "$test"
580 echo "-------------------------------------------"
581 reset_environment
582 if $test
583 then
584 echo "OK: Expected success."
585 else
586 if [ $? = 99 ]
587 then echo "FAIL: Unexpected crash!"; exit 99
588 fi
589 echo "FAIL: Unexpected failure."; exit 1
590 fi
591 done
592 grep "^fail_$1.*(" < $testing_dir/testing.sh | cut -d'(' -f1 | while read test
593 do
594 echo "-------------------------------------------"
595 echo "$test"
596 echo "-------------------------------------------"
597 reset_environment
598 if $test
599 then echo "FAIL: Unexpected success."; exit 1
600 else
601 if [ $? = 99 ]
602 then echo "FAIL: Unexpected crash!"; exit 99
603 fi
604 echo "OK: Expected failure."
605 fi
606 done
607}
608
609run_with_minimal_environment() {
610 echo "==========================================="
611 echo "Running with minimal environment"
612 echo "==========================================="
613 build_environment luacov
614 run_tests $1
615}
616
617run_with_full_environment() {
618 echo "==========================================="
619 echo "Running with full environment"
620 echo "==========================================="
621
622 local bitop=
623 [ "$luaversion" = "5.1.5" ] && bitop=luabitop
624
625 build_environment luacov luafilesystem luasocket $bitop luaposix md5 lzlib
626 run_tests $1
627}
628
629run_all_tests() {
630 run_with_minimal_environment $1
631 run_with_full_environment $1
632}
633
634run_all_tests $1
635#run_with_minimal_environment $1
636
637cd "$testing_dir/.."
638
639if [ "$travis" ]
640then
641 if [ "$TRAVIS" ]
642 then
643 build_environment luacov luafilesystem luacov-coveralls
644 $testing_sys_tree/bin/luacov-coveralls -c "$testing_dir/luacov.config" || echo "ok"
645 fi
646 $testing_sys_tree/bin/luacov -c "$testing_dir/luacov.config"
647 grep "Summary" -B1 -A1000 "$testing_dir/luacov.report.out"
648else
649 $testing_sys_tree/bin/luacov -c "$testing_dir/luacov.config"
650 cat "$testing_dir/luacov.report.out"
651fi