aboutsummaryrefslogtreecommitdiff
path: root/spec/util
diff options
context:
space:
mode:
authorHisham Muhammad <hisham@gobolinux.org>2018-06-24 23:07:06 -0300
committerHisham Muhammad <hisham@gobolinux.org>2018-07-01 15:51:36 -0300
commit20111c9b6f55142c310f0557f1b3ee4317949f1f (patch)
tree9d18da2a1335b14d9a93377a53fdfc65bba75477 /spec/util
parent8a49bb4fceaa2532bcaaa94f0282a4a2dc7f1b40 (diff)
downloadluarocks-20111c9b6f55142c310f0557f1b3ee4317949f1f.tar.gz
luarocks-20111c9b6f55142c310f0557f1b3ee4317949f1f.tar.bz2
luarocks-20111c9b6f55142c310f0557f1b3ee4317949f1f.zip
Tests: speed up downloading rocks reusing HTTP connection
Diffstat (limited to 'spec/util')
-rw-r--r--spec/util/test_env.lua23
1 files changed, 15 insertions, 8 deletions
diff --git a/spec/util/test_env.lua b/spec/util/test_env.lua
index ed97973a..28e871de 100644
--- a/spec/util/test_env.lua
+++ b/spec/util/test_env.lua
@@ -339,20 +339,27 @@ end
339-- @return make_manifest boolean: true if new rocks downloaded 339-- @return make_manifest boolean: true if new rocks downloaded
340local function download_rocks(urls, save_path) 340local function download_rocks(urls, save_path)
341 local luarocks_repo = "https://luarocks.org/" 341 local luarocks_repo = "https://luarocks.org/"
342 local make_manifest = false 342 local any_downloads = false
343 343
344 local to_download = {}
344 for _, url in ipairs(urls) do 345 for _, url in ipairs(urls) do
345 -- check if already downloaded 346 -- check if already downloaded
346 if not test_env.exists(save_path .. "/" .. url) then 347 if not test_env.exists(save_path .. "/" .. url) then
347 if test_env.TEST_TARGET_OS == "windows" then 348 table.insert(to_download, luarocks_repo .. url)
348 assert(execute_bool(test_env.testing_paths.win_tools .. "/wget -cP " .. save_path .. " " .. luarocks_repo .. url .. " --no-check-certificate")) 349 any_downloads = true
349 else
350 assert(execute_bool("wget -cP " .. save_path .. " " .. luarocks_repo .. url))
351 end
352 make_manifest = true
353 end 350 end
354 end 351 end
355 return make_manifest 352 if not any_downloads then
353 return false
354 end
355 local cmd
356 if test_env.TEST_TARGET_OS == "windows" then
357 cmd = test_env.testing_paths.win_tools .. "/wget --no-check-certificate -cP " .. save_path
358 else
359 cmd = "wget -cP " .. save_path
360 end
361 assert(execute_bool(cmd.." "..table.concat(to_download, " ")))
362 return true
356end 363end
357 364
358--- Create a file containing a string. 365--- Create a file containing a string.