diff options
| author | Peter Melnichenko <mpeterval@gmail.com> | 2016-07-08 16:42:00 +0300 |
|---|---|---|
| committer | Peter Melnichenko <mpeterval@gmail.com> | 2016-07-08 17:44:03 +0300 |
| commit | 325c7578cdd5421035930a3a7ee2bb385c10d8fc (patch) | |
| tree | 098070152109415aa06326cfbad6cd3982c5b058 /test/test_environment.lua | |
| parent | 9d233d0e474efa25e2e5e02bea9f9e54a532fbe0 (diff) | |
| download | luarocks-325c7578cdd5421035930a3a7ee2bb385c10d8fc.tar.gz luarocks-325c7578cdd5421035930a3a7ee2bb385c10d8fc.tar.bz2 luarocks-325c7578cdd5421035930a3a7ee2bb385c10d8fc.zip | |
Tests: adjust rock/rockspec downloading
Diffstat (limited to 'test/test_environment.lua')
| -rw-r--r-- | test/test_environment.lua | 51 |
1 files changed, 25 insertions, 26 deletions
diff --git a/test/test_environment.lua b/test/test_environment.lua index cfbab89b..065a12c2 100644 --- a/test/test_environment.lua +++ b/test/test_environment.lua | |||
| @@ -180,17 +180,17 @@ end | |||
| 180 | 180 | ||
| 181 | 181 | ||
| 182 | --- Function for downloading rocks and rockspecs | 182 | --- Function for downloading rocks and rockspecs |
| 183 | -- @param rocks table: table with full name of rocks/rockspecs to download | 183 | -- @param urls table: array of full names of rocks/rockspecs to download |
| 184 | -- @param save_path string: path to directory, where to download rocks/rockspecs | 184 | -- @param save_path string: path to directory, where to download rocks/rockspecs |
| 185 | -- @return make_manifest boolean: true if new rocks downloaded | 185 | -- @return make_manifest boolean: true if new rocks downloaded |
| 186 | local function download_rocks(rocks, save_path) | 186 | local function download_rocks(urls, save_path) |
| 187 | local luarocks_repo = "https://luarocks.org" | 187 | local luarocks_repo = "https://luarocks.org" |
| 188 | local make_manifest = false | 188 | local make_manifest = false |
| 189 | 189 | ||
| 190 | for _,rock in ipairs(rocks) do | 190 | for _, url in ipairs(urls) do |
| 191 | -- check if already downloaded | 191 | -- check if already downloaded |
| 192 | if not os.rename( save_path .. rock, save_path .. rock) then | 192 | if not os.rename(save_path .. url, save_path .. url) then |
| 193 | execute_bool("wget -cP " .. save_path .. " " .. luarocks_repo .. rock) | 193 | execute_bool("wget -cP " .. save_path .. " " .. luarocks_repo .. url) |
| 194 | make_manifest = true | 194 | make_manifest = true |
| 195 | end | 195 | end |
| 196 | end | 196 | end |
| @@ -579,34 +579,33 @@ function test_env.main() | |||
| 579 | install_luarocks(install_env_vars) | 579 | install_luarocks(install_env_vars) |
| 580 | 580 | ||
| 581 | -- Preparation of rocks for building environment | 581 | -- Preparation of rocks for building environment |
| 582 | local env_rocks = {} -- short names of rocks, required for building environment | 582 | local rocks = {} -- names of rocks, required for building environment |
| 583 | local rocks = {} -- full names of rocks required for download | 583 | local urls = {} -- names of rock and rockspec files to be downloaded |
| 584 | rocks[#rocks+1] = "/luacov-0.11.0-1.rockspec" | 584 | table.insert(urls, "/luacov-0.11.0-1.rockspec") |
| 585 | rocks[#rocks+1] = "/luacov-0.11.0-1.src.rock" | 585 | table.insert(urls, "/luacov-0.11.0-1.src.rock") |
| 586 | 586 | ||
| 587 | if test_env.TYPE_TEST_ENV == "full" then | 587 | if test_env.TYPE_TEST_ENV == "full" then |
| 588 | rocks[#rocks+1] = "/luafilesystem-1.6.3-1.src.rock" | 588 | table.insert(urls, "/luafilesystem-1.6.3-1.src.rock") |
| 589 | rocks[#rocks+1] = "/luasocket-3.0rc1-1.src.rock" | 589 | table.insert(urls, "/luasocket-3.0rc1-1.src.rock") |
| 590 | rocks[#rocks+1] = "/luasocket-3.0rc1-1.rockspec" | 590 | table.insert(urls, "/luasocket-3.0rc1-1.rockspec") |
| 591 | rocks[#rocks+1] = "/luaposix-33.2.1-1.src.rock" | 591 | table.insert(urls, "/luaposix-33.2.1-1.src.rock") |
| 592 | rocks[#rocks+1] = "/md5-1.2-1.src.rock" | 592 | table.insert(urls, "/md5-1.2-1.src.rock") |
| 593 | rocks[#rocks+1] = "/lzlib-0.4.1.53-1.src.rock" | 593 | table.insert(urls, "/lzlib-0.4.1.53-1.src.rock") |
| 594 | env_rocks = {"luafilesystem", "luasocket", "luaposix", "md5", "lzlib"} | 594 | rocks = {"luafilesystem", "luasocket", "luaposix", "md5", "lzlib"} |
| 595 | 595 | ||
| 596 | if test_env.LUA_V ~= "5.1" then | 596 | if test_env.LUA_V ~= "5.1" then |
| 597 | rocks[#rocks+1] = "/luabitop-1.0.2-1.rockspec" | 597 | table.insert(urls, "/luabitop-1.0.2-1.rockspec") |
| 598 | rocks[#rocks+1] = "/luabitop-1.0.2-1.src.rock" | 598 | table.insert(urls, "/luabitop-1.0.2-1.src.rock") |
| 599 | table.insert(env_rocks, "luabitop") | 599 | table.insert(rocks, "luabitop") |
| 600 | end | 600 | end |
| 601 | end | 601 | end |
| 602 | 602 | ||
| 603 | table.insert(env_rocks, "luacov") -- luacov is needed for minimal or full environment | 603 | table.insert(rocks, "luacov") -- luacov is needed for minimal or full environment |
| 604 | 604 | ||
| 605 | -- Download rocks needed for LuaRocks testing environment | 605 | -- Download rocks needed for LuaRocks testing environment |
| 606 | lfs.mkdir(testing_paths.testing_server) | 606 | lfs.mkdir(testing_paths.testing_server) |
| 607 | download_rocks(rocks, testing_paths.testing_server) | 607 | download_rocks(urls, testing_paths.testing_server) |
| 608 | 608 | build_environment(rocks, install_env_vars) | |
| 609 | build_environment(env_rocks, install_env_vars) | ||
| 610 | end | 609 | end |
| 611 | 610 | ||
| 612 | test_env.set_lua_version() | 611 | test_env.set_lua_version() |
