aboutsummaryrefslogtreecommitdiff
path: root/spec/util
diff options
context:
space:
mode:
Diffstat (limited to 'spec/util')
-rw-r--r--spec/util/test_env.lua42
1 files changed, 25 insertions, 17 deletions
diff --git a/spec/util/test_env.lua b/spec/util/test_env.lua
index e3aad1b1..d4591c91 100644
--- a/spec/util/test_env.lua
+++ b/spec/util/test_env.lua
@@ -263,10 +263,10 @@ function test_env.set_args()
263 if package.config:sub(1,1) == "\\" then 263 if package.config:sub(1,1) == "\\" then
264 test_env.TEST_TARGET_OS = "windows" 264 test_env.TEST_TARGET_OS = "windows"
265 if test_env.APPVEYOR then 265 if test_env.APPVEYOR then
266 test_env.OPENSSL_INCDIR = "C:\\OpenSSL-Win32\\include" 266 test_env.OPENSSL_INCDIR = "C:\\OpenSSL-v111-Win32\\include"
267 test_env.OPENSSL_LIBDIR = "C:\\OpenSSL-Win32\\lib" 267 test_env.OPENSSL_LIBDIR = "C:\\OpenSSL-v111-Win32\\lib"
268 if test_env.MINGW then 268 if test_env.MINGW then
269 test_env.OPENSSL_LIBDIR = "C:\\OpenSSL-Win32\\bin" 269 test_env.OPENSSL_LIBDIR = "C:\\OpenSSL-v111-Win32\\bin"
270 end 270 end
271 end 271 end
272 else 272 else
@@ -374,27 +374,35 @@ end
374-- @return make_manifest boolean: true if new rocks downloaded 374-- @return make_manifest boolean: true if new rocks downloaded
375local function download_rocks(urls, save_path) 375local function download_rocks(urls, save_path)
376 local luarocks_repo = "https://luarocks.org/" 376 local luarocks_repo = "https://luarocks.org/"
377 local any_downloads = false
378 377
379 local to_download = {} 378 local to_download = {}
379 local fixtures = {}
380 for _, url in ipairs(urls) do 380 for _, url in ipairs(urls) do
381 -- check if already downloaded 381 if url:match("^spec/fixtures") then
382 if not test_env.exists(save_path .. "/" .. url) then 382 table.insert(fixtures, (url:gsub("^spec/fixtures", test_env.testing_paths.fixtures_dir)))
383 table.insert(to_download, luarocks_repo .. url) 383 else
384 any_downloads = true 384 -- check if already downloaded
385 if not test_env.exists(save_path .. "/" .. url) then
386 table.insert(to_download, luarocks_repo .. url)
387 end
385 end 388 end
386 end 389 end
387 if not any_downloads then 390
388 return false 391 if #fixtures > 0 then
392 os.execute("cp " .. table.concat(fixtures, " ") .. " " .. save_path)
389 end 393 end
390 local cmd 394
391 if test_env.TEST_TARGET_OS == "windows" then 395 if #to_download > 0 then
392 cmd = test_env.testing_paths.win_tools .. "/wget --no-check-certificate -cP " .. save_path 396 local cmd
393 else 397 if test_env.TEST_TARGET_OS == "windows" then
394 cmd = "wget -cP " .. save_path 398 cmd = test_env.testing_paths.win_tools .. "/wget --no-check-certificate -cP " .. save_path
399 else
400 cmd = "wget -cP " .. save_path
401 end
402 assert(execute_bool(cmd.." "..table.concat(to_download, " ")))
395 end 403 end
396 assert(execute_bool(cmd.." "..table.concat(to_download, " "))) 404
397 return true 405 return (#fixtures > 0) or (#to_download > 0)
398end 406end
399 407
400--- Create a file containing a string. 408--- Create a file containing a string.