diff options
| author | Hisham Muhammad <hisham@gobolinux.org> | 2018-06-06 13:37:43 -0300 |
|---|---|---|
| committer | Hisham Muhammad <hisham@gobolinux.org> | 2018-06-14 14:06:51 -0300 |
| commit | 2d739d1ab3c0027fb677ee6007bc9269800eb18d (patch) | |
| tree | ff2b95b94469403b37808613ab67ce624837ef42 | |
| parent | b159a8e28d3419e19b1851c7536220eb0eb3b356 (diff) | |
| download | luarocks-2d739d1ab3c0027fb677ee6007bc9269800eb18d.tar.gz luarocks-2d739d1ab3c0027fb677ee6007bc9269800eb18d.tar.bz2 luarocks-2d739d1ab3c0027fb677ee6007bc9269800eb18d.zip | |
Tests: do not rebuild mock server rocks if already built
| -rw-r--r-- | spec/util/test_env.lua | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/spec/util/test_env.lua b/spec/util/test_env.lua index 0c140be7..ffe5291d 100644 --- a/spec/util/test_env.lua +++ b/spec/util/test_env.lua | |||
| @@ -782,6 +782,16 @@ function test_env.mock_server_done() | |||
| 782 | end | 782 | end |
| 783 | end | 783 | end |
| 784 | 784 | ||
| 785 | local function find_binary_rock(src_rock, dir) | ||
| 786 | local patt = src_rock:gsub("([.-])", "%%%1"):gsub("src", ".*[^s][^r][^c]") | ||
| 787 | for name in lfs.dir(dir) do | ||
| 788 | if name:match(patt) then | ||
| 789 | return true | ||
| 790 | end | ||
| 791 | end | ||
| 792 | return false | ||
| 793 | end | ||
| 794 | |||
| 785 | local function prepare_mock_server_binary_rocks() | 795 | local function prepare_mock_server_binary_rocks() |
| 786 | local testing_paths = test_env.testing_paths | 796 | local testing_paths = test_env.testing_paths |
| 787 | 797 | ||
| @@ -799,14 +809,19 @@ local function prepare_mock_server_binary_rocks() | |||
| 799 | "restserver-0.1-1.src.rock", | 809 | "restserver-0.1-1.src.rock", |
| 800 | "restserver-xavante-0.2-1.src.rock", | 810 | "restserver-xavante-0.2-1.src.rock", |
| 801 | } | 811 | } |
| 802 | download_rocks(rocks, testing_paths.testing_server) | 812 | local make_manifest = download_rocks(rocks, testing_paths.testing_server) |
| 803 | for _, rock in ipairs(rocks) do | 813 | for _, rock in ipairs(rocks) do |
| 804 | test_env.run.luarocks_nocov("build " .. Q(testing_paths.testing_server .. "/" .. rock) .. " --tree=" .. testing_paths.testing_cache) | ||
| 805 | local rockname = rock:gsub("%-[^-]+%-%d+%.[%a.]+$", "") | 814 | local rockname = rock:gsub("%-[^-]+%-%d+%.[%a.]+$", "") |
| 806 | test_env.run.luarocks_nocov("pack " .. rockname .. " --tree=" .. testing_paths.testing_cache) | 815 | if not find_binary_rock(rock, testing_paths.testing_server) then |
| 807 | move_file(rockname .. "-*.rock", testing_paths.testing_server) | 816 | test_env.run.luarocks_nocov("build " .. Q(testing_paths.testing_server .. "/" .. rock) .. " --tree=" .. testing_paths.testing_cache) |
| 817 | test_env.run.luarocks_nocov("pack " .. rockname .. " --tree=" .. testing_paths.testing_cache) | ||
| 818 | move_file(rockname .. "-*.rock", testing_paths.testing_server) | ||
| 819 | make_manifest = true | ||
| 820 | end | ||
| 821 | end | ||
| 822 | if make_manifest then | ||
| 823 | test_env.run.luarocks_admin_nocov("make_manifest " .. Q(testing_paths.testing_server)) | ||
| 808 | end | 824 | end |
| 809 | test_env.run.luarocks_admin_nocov("make_manifest " .. Q(testing_paths.testing_server)) | ||
| 810 | end | 825 | end |
| 811 | 826 | ||
| 812 | --- | 827 | --- |
