diff options
author | Peter Melnichenko <mpeterval@gmail.com> | 2016-07-08 15:33:45 +0300 |
---|---|---|
committer | Peter Melnichenko <mpeterval@gmail.com> | 2016-07-08 15:33:45 +0300 |
commit | d13af5115615a851125b4b20df370ec4d79ba939 (patch) | |
tree | d5c87f21d34aee82030092100a4d2a3bbe197761 /test | |
parent | e0f97460ba8d212c8336a7ff2ccec61cf0ec983c (diff) | |
download | luarocks-d13af5115615a851125b4b20df370ec4d79ba939.tar.gz luarocks-d13af5115615a851125b4b20df370ec4d79ba939.tar.bz2 luarocks-d13af5115615a851125b4b20df370ec4d79ba939.zip |
Tests: fix need_luasocket()
Return false if installation failed. Also, remove optional arguments.
Diffstat (limited to 'test')
-rw-r--r-- | test/test_environment.lua | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/test/test_environment.lua b/test/test_environment.lua index 372351de..a3802cc0 100644 --- a/test/test_environment.lua +++ b/test/test_environment.lua | |||
@@ -421,23 +421,18 @@ function test_env.setup_specs(extra_rocks) | |||
421 | end | 421 | end |
422 | 422 | ||
423 | --- Helper function for tests which needs luasocket installed | 423 | --- Helper function for tests which needs luasocket installed |
424 | function test_env.need_luasocket(luarocks_nocov, testing_cache, platform) | 424 | function test_env.need_luasocket() |
425 | luarocks_nocov = luarocks_nocov or test_env.run.luarocks_nocov | 425 | if test_env.run.luarocks_nocov("show luasocket") then |
426 | testing_cache = testing_cache or test_env.testing_paths.testing_cache | ||
427 | platform = platform or test_env.platform | ||
428 | |||
429 | if luarocks_nocov("show luasocket") then | ||
430 | return true | 426 | return true |
431 | else | 427 | else |
432 | testing_cache = testing_cache .. "/" | 428 | local testing_cache = test_env.testing_paths.testing_cache .. "/" |
433 | local luasocket_rock = "luasocket-3.0rc1-1." .. platform .. ".rock" | 429 | local luasocket_rock = "luasocket-3.0rc1-1." .. test_env.platform .. ".rock" |
434 | if not os.rename( testing_cache .. luasocket_rock, testing_cache .. luasocket_rock) then | 430 | if not os.rename( testing_cache .. luasocket_rock, testing_cache .. luasocket_rock) then |
435 | luarocks_nocov("build --pack-binary-rock luasocket 3.0rc1-1") | 431 | test_env.run.luarocks_nocov("build --pack-binary-rock luasocket 3.0rc1-1") |
436 | os.rename(luasocket_rock, testing_cache .. luasocket_rock) | 432 | os.rename(luasocket_rock, testing_cache .. luasocket_rock) |
437 | end | 433 | end |
438 | luarocks_nocov("install " .. testing_cache .. luasocket_rock) | 434 | return test_env.run.luarocks_nocov("install " .. testing_cache .. luasocket_rock) |
439 | end | 435 | end |
440 | return true | ||
441 | end | 436 | end |
442 | 437 | ||
443 | --- For each key-value pair in replacements table | 438 | --- For each key-value pair in replacements table |