diff options
-rw-r--r-- | spec/build_spec.lua | 4 | ||||
-rw-r--r-- | spec/new_version_spec.lua | 4 | ||||
-rw-r--r-- | spec/pack_spec.lua | 32 | ||||
-rw-r--r-- | spec/upload_spec.lua | 4 | ||||
-rw-r--r-- | spec/util/test_env.lua | 75 | ||||
-rw-r--r-- | spec/write_rockspec_spec.lua | 3 |
6 files changed, 65 insertions, 57 deletions
diff --git a/spec/build_spec.lua b/spec/build_spec.lua index cbe061c3..2e7333b3 100644 --- a/spec/build_spec.lua +++ b/spec/build_spec.lua | |||
@@ -5,7 +5,7 @@ local testing_paths = test_env.testing_paths | |||
5 | 5 | ||
6 | test_env.unload_luarocks() | 6 | test_env.unload_luarocks() |
7 | 7 | ||
8 | local extra_rocks = test_env.mock_server_extra_rocks({ | 8 | local extra_rocks = { |
9 | "/lmathx-20120430.51-1.src.rock", | 9 | "/lmathx-20120430.51-1.src.rock", |
10 | "/lmathx-20120430.51-1.rockspec", | 10 | "/lmathx-20120430.51-1.rockspec", |
11 | "/lmathx-20120430.52-1.src.rock", | 11 | "/lmathx-20120430.52-1.src.rock", |
@@ -26,7 +26,7 @@ local extra_rocks = test_env.mock_server_extra_rocks({ | |||
26 | "/lxsh-0.8.6-2.rockspec", | 26 | "/lxsh-0.8.6-2.rockspec", |
27 | "/stdlib-41.0.0-1.src.rock", | 27 | "/stdlib-41.0.0-1.src.rock", |
28 | "/validate-args-1.5.4-1.rockspec" | 28 | "/validate-args-1.5.4-1.rockspec" |
29 | }) | 29 | } |
30 | 30 | ||
31 | describe("LuaRocks build tests #blackbox #b_build", function() | 31 | describe("LuaRocks build tests #blackbox #b_build", function() |
32 | 32 | ||
diff --git a/spec/new_version_spec.lua b/spec/new_version_spec.lua index 3d9d5cab..f3bb007e 100644 --- a/spec/new_version_spec.lua +++ b/spec/new_version_spec.lua | |||
@@ -5,10 +5,10 @@ local testing_paths = test_env.testing_paths | |||
5 | 5 | ||
6 | test_env.unload_luarocks() | 6 | test_env.unload_luarocks() |
7 | 7 | ||
8 | local extra_rocks = test_env.mock_server_extra_rocks({ | 8 | local extra_rocks = { |
9 | "/abelhas-1.1-1.rockspec", | 9 | "/abelhas-1.1-1.rockspec", |
10 | "/lpeg-0.12-1.rockspec" | 10 | "/lpeg-0.12-1.rockspec" |
11 | }) | 11 | } |
12 | 12 | ||
13 | describe("LuaRocks new_version tests #blackbox #b_new_version", function() | 13 | describe("LuaRocks new_version tests #blackbox #b_new_version", function() |
14 | 14 | ||
diff --git a/spec/pack_spec.lua b/spec/pack_spec.lua index 54d139e0..8fbade44 100644 --- a/spec/pack_spec.lua +++ b/spec/pack_spec.lua | |||
@@ -5,14 +5,14 @@ local testing_paths = test_env.testing_paths | |||
5 | 5 | ||
6 | test_env.unload_luarocks() | 6 | test_env.unload_luarocks() |
7 | 7 | ||
8 | local extra_rocks = test_env.mock_server_extra_rocks({ | 8 | local extra_rocks = { |
9 | "/luasec-0.6-1.rockspec", | 9 | "/luasec-0.6-1.rockspec", |
10 | "/luassert-1.7.0-1.src.rock", | 10 | "/luassert-1.7.0-1.src.rock", |
11 | "/luasocket-3.0rc1-2.src.rock", | 11 | "/luasocket-3.0rc1-2.src.rock", |
12 | "/luasocket-3.0rc1-2.rockspec", | 12 | "/luasocket-3.0rc1-2.rockspec", |
13 | "/say-1.2-1.src.rock", | 13 | "/say-1.2-1.src.rock", |
14 | "/say-1.0-1.src.rock" | 14 | "/say-1.0-1.src.rock" |
15 | }) | 15 | } |
16 | 16 | ||
17 | describe("LuaRocks pack #blackbox #b_pack", function() | 17 | describe("LuaRocks pack #blackbox #b_pack", function() |
18 | 18 | ||
@@ -50,14 +50,7 @@ describe("LuaRocks pack #blackbox #b_pack", function() | |||
50 | assert(test_env.remove_files(lfs.currentdir(), "say%-")) | 50 | assert(test_env.remove_files(lfs.currentdir(), "say%-")) |
51 | end) | 51 | end) |
52 | 52 | ||
53 | it("src", function() | 53 | describe("#mock", function() |
54 | assert(run.luarocks_bool("install luasec " .. test_env.OPENSSL_DIRS)) | ||
55 | assert(run.luarocks_bool("download --rockspec luasocket 3.0rc1-2")) | ||
56 | assert(run.luarocks_bool("pack luasocket-3.0rc1-2.rockspec")) | ||
57 | assert(test_env.remove_files(lfs.currentdir(), "luasocket%-")) | ||
58 | end) | ||
59 | |||
60 | describe("#mock namespaced dependencies", function() | ||
61 | 54 | ||
62 | setup(function() | 55 | setup(function() |
63 | test_env.mock_server_init() | 56 | test_env.mock_server_init() |
@@ -67,12 +60,23 @@ describe("LuaRocks pack #blackbox #b_pack", function() | |||
67 | test_env.mock_server_done() | 60 | test_env.mock_server_done() |
68 | end) | 61 | end) |
69 | 62 | ||
70 | it("can pack rockspec with namespaced dependencies", function() | 63 | it("can pack a rockspec into a .src.rock", function() |
71 | finally(function() | 64 | finally(function() |
72 | os.remove("has_namespaced_dep-1.0-1.src.rock") | 65 | os.remove("a_rock-1.0-1.src.rock") |
66 | end) | ||
67 | assert(run.luarocks_bool("download --rockspec --server=" .. testing_paths.fixtures_dir .. "/a_repo a_rock 1.0-1")) | ||
68 | assert(run.luarocks_bool("pack a_rock-1.0-1.rockspec")) | ||
69 | assert.is_truthy(lfs.attributes("a_rock-1.0-1.src.rock")) | ||
70 | end) | ||
71 | |||
72 | describe("namespaced dependencies", function() | ||
73 | it("can pack rockspec with namespaced dependencies", function() | ||
74 | finally(function() | ||
75 | os.remove("has_namespaced_dep-1.0-1.src.rock") | ||
76 | end) | ||
77 | assert(run.luarocks_bool("pack " .. testing_paths.fixtures_dir .. "/a_repo/has_namespaced_dep-1.0-1.rockspec")) | ||
78 | assert.is_truthy(lfs.attributes("has_namespaced_dep-1.0-1.src.rock")) | ||
73 | end) | 79 | end) |
74 | assert(run.luarocks_bool("pack " .. testing_paths.fixtures_dir .. "/a_repo/has_namespaced_dep-1.0-1.rockspec")) | ||
75 | assert.is_truthy(lfs.attributes("has_namespaced_dep-1.0-1.src.rock")) | ||
76 | end) | 80 | end) |
77 | end) | 81 | end) |
78 | 82 | ||
diff --git a/spec/upload_spec.lua b/spec/upload_spec.lua index 3adfa2dd..a54f21c5 100644 --- a/spec/upload_spec.lua +++ b/spec/upload_spec.lua | |||
@@ -4,12 +4,10 @@ local testing_paths = test_env.testing_paths | |||
4 | 4 | ||
5 | test_env.unload_luarocks() | 5 | test_env.unload_luarocks() |
6 | 6 | ||
7 | local extra_rocks = test_env.mock_server_extra_rocks() | ||
8 | |||
9 | describe("LuaRocks upload tests #blackbox #b_upload", function() | 7 | describe("LuaRocks upload tests #blackbox #b_upload", function() |
10 | 8 | ||
11 | before_each(function() | 9 | before_each(function() |
12 | test_env.setup_specs(extra_rocks) | 10 | test_env.setup_specs() |
13 | end) | 11 | end) |
14 | 12 | ||
15 | it("LuaRocks upload with no flags/arguments", function() | 13 | it("LuaRocks upload with no flags/arguments", function() |
diff --git a/spec/util/test_env.lua b/spec/util/test_env.lua index 48914311..b3b9bb77 100644 --- a/spec/util/test_env.lua +++ b/spec/util/test_env.lua | |||
@@ -317,12 +317,12 @@ end | |||
317 | -- @param save_path string: path to directory, where to download rocks/rockspecs | 317 | -- @param save_path string: path to directory, where to download rocks/rockspecs |
318 | -- @return make_manifest boolean: true if new rocks downloaded | 318 | -- @return make_manifest boolean: true if new rocks downloaded |
319 | local function download_rocks(urls, save_path) | 319 | local function download_rocks(urls, save_path) |
320 | local luarocks_repo = "https://luarocks.org" | 320 | local luarocks_repo = "https://luarocks.org/" |
321 | local make_manifest = false | 321 | local make_manifest = false |
322 | 322 | ||
323 | for _, url in ipairs(urls) do | 323 | for _, url in ipairs(urls) do |
324 | -- check if already downloaded | 324 | -- check if already downloaded |
325 | if not test_env.exists(save_path .. url) then | 325 | if not test_env.exists(save_path .. "/" .. url) then |
326 | if test_env.TEST_TARGET_OS == "windows" then | 326 | if test_env.TEST_TARGET_OS == "windows" then |
327 | assert(execute_bool(test_env.testing_paths.win_tools .. "/wget -cP " .. save_path .. " " .. luarocks_repo .. url .. " --no-check-certificate")) | 327 | assert(execute_bool(test_env.testing_paths.win_tools .. "/wget -cP " .. save_path .. " " .. luarocks_repo .. url .. " --no-check-certificate")) |
328 | else | 328 | else |
@@ -442,6 +442,14 @@ local function make_run_functions() | |||
442 | } | 442 | } |
443 | end | 443 | end |
444 | 444 | ||
445 | local function move_file(src, dst) | ||
446 | if test_env.TEST_TARGET_OS == "windows" then | ||
447 | execute_bool(test_env.testing_paths.win_tools .. "/mv " .. src .. " " .. dst) | ||
448 | else | ||
449 | execute_bool("mv " .. src .. " " .. dst) | ||
450 | end | ||
451 | end | ||
452 | |||
445 | --- Rebuild environment. | 453 | --- Rebuild environment. |
446 | -- Remove old installed rocks and install new ones, | 454 | -- Remove old installed rocks and install new ones, |
447 | -- updating manifests and tree copies. | 455 | -- updating manifests and tree copies. |
@@ -461,13 +469,9 @@ local function build_environment(rocks, env_variables) | |||
461 | 469 | ||
462 | for _, rock in ipairs(rocks) do | 470 | for _, rock in ipairs(rocks) do |
463 | if not test_env.run.luarocks_nocov("install --only-server=" .. testing_paths.testing_cache .. " --tree=" .. testing_paths.testing_sys_tree .. " " .. Q(rock), env_variables) then | 471 | if not test_env.run.luarocks_nocov("install --only-server=" .. testing_paths.testing_cache .. " --tree=" .. testing_paths.testing_sys_tree .. " " .. Q(rock), env_variables) then |
464 | test_env.run.luarocks_nocov("build --tree=" .. Q(testing_paths.testing_sys_tree) .. " " .. Q(rock) .. "", env_variables) | 472 | test_env.run.luarocks_nocov("build --tree=" .. Q(testing_paths.testing_sys_tree) .. " " .. Q(rock), env_variables) |
465 | test_env.run.luarocks_nocov("pack --tree=" .. Q(testing_paths.testing_sys_tree) .. " " .. Q(rock), env_variables) | 473 | test_env.run.luarocks_nocov("pack --tree=" .. Q(testing_paths.testing_sys_tree) .. " " .. Q(rock), env_variables) |
466 | if test_env.TEST_TARGET_OS == "windows" then | 474 | move_file(rock .. "-*.rock", testing_paths.testing_cache) |
467 | execute_bool(testing_paths.win_tools .. "/mv " .. rock .. "-*.rock " .. testing_paths.testing_cache) | ||
468 | else | ||
469 | execute_bool("mv " .. rock .. "-*.rock " .. testing_paths.testing_cache) | ||
470 | end | ||
471 | end | 475 | end |
472 | end | 476 | end |
473 | 477 | ||
@@ -740,31 +744,6 @@ local function install_luarocks(install_env_vars) | |||
740 | print("LuaRocks installed correctly!") | 744 | print("LuaRocks installed correctly!") |
741 | end | 745 | end |
742 | 746 | ||
743 | function test_env.mock_server_extra_rocks(more) | ||
744 | local rocks = { | ||
745 | -- rocks needed for mock-server | ||
746 | "/copas-2.0.1-1.src.rock", | ||
747 | "/coxpcall-1.16.0-1.src.rock", | ||
748 | "/dkjson-2.5-2.src.rock", | ||
749 | "/luafilesystem-1.6.3-1.src.rock", | ||
750 | "/luasec-0.6-1.rockspec", | ||
751 | "/luasocket-3.0rc1-2.src.rock", | ||
752 | "/luasocket-3.0rc1-2.rockspec", | ||
753 | "/restserver-0.1-1.src.rock", | ||
754 | "/restserver-xavante-0.2-1.src.rock", | ||
755 | "/rings-1.3.0-1.src.rock", | ||
756 | "/wsapi-1.6.1-1.src.rock", | ||
757 | "/wsapi-xavante-1.6.1-1.src.rock", | ||
758 | "/xavante-2.4.0-1.src.rock" | ||
759 | } | ||
760 | if more then | ||
761 | for _, rock in ipairs(more) do | ||
762 | table.insert(rocks, rock) | ||
763 | end | ||
764 | end | ||
765 | return rocks | ||
766 | end | ||
767 | |||
768 | function test_env.mock_server_init() | 747 | function test_env.mock_server_init() |
769 | local testing_paths = test_env.testing_paths | 748 | local testing_paths = test_env.testing_paths |
770 | assert(test_env.need_rock("restserver-xavante")) | 749 | assert(test_env.need_rock("restserver-xavante")) |
@@ -789,6 +768,33 @@ function test_env.mock_server_done() | |||
789 | end | 768 | end |
790 | end | 769 | end |
791 | 770 | ||
771 | local function prepare_mock_server_binary_rocks() | ||
772 | local testing_paths = test_env.testing_paths | ||
773 | |||
774 | local rocks = { | ||
775 | -- rocks needed for mock-server | ||
776 | "luasocket-3.0rc1-2.src.rock", | ||
777 | "coxpcall-1.16.0-1.src.rock", | ||
778 | "copas-2.0.1-1.src.rock", | ||
779 | "luafilesystem-1.7.0-2.src.rock", | ||
780 | "xavante-2.4.0-1.src.rock", | ||
781 | "wsapi-1.6.1-1.src.rock", | ||
782 | "rings-1.3.0-1.src.rock", | ||
783 | "wsapi-xavante-1.6.1-1.src.rock", | ||
784 | "dkjson-2.5-2.src.rock", | ||
785 | "restserver-0.1-1.src.rock", | ||
786 | "restserver-xavante-0.2-1.src.rock", | ||
787 | } | ||
788 | download_rocks(rocks, testing_paths.testing_server) | ||
789 | for _, rock in ipairs(rocks) do | ||
790 | test_env.run.luarocks_nocov("build " .. Q(testing_paths.testing_server .. "/" .. rock) .. " --tree=" .. testing_paths.testing_cache) | ||
791 | local rockname = rock:gsub("%-[^-]+%-%d+%.[%a.]+$", "") | ||
792 | test_env.run.luarocks_nocov("pack " .. rockname .. " --tree=" .. testing_paths.testing_cache) | ||
793 | move_file(rockname .. "-*.rock", testing_paths.testing_server) | ||
794 | end | ||
795 | test_env.run.luarocks_admin_nocov("make_manifest " .. Q(testing_paths.testing_server)) | ||
796 | end | ||
797 | |||
792 | --- | 798 | --- |
793 | -- Main function to create config files and testing environment | 799 | -- Main function to create config files and testing environment |
794 | function test_env.main() | 800 | function test_env.main() |
@@ -837,7 +843,10 @@ function test_env.main() | |||
837 | -- Download rocks needed for LuaRocks testing environment | 843 | -- Download rocks needed for LuaRocks testing environment |
838 | lfs.mkdir(testing_paths.testing_server) | 844 | lfs.mkdir(testing_paths.testing_server) |
839 | download_rocks(urls, testing_paths.testing_server) | 845 | download_rocks(urls, testing_paths.testing_server) |
846 | |||
840 | build_environment(rocks, install_env_vars) | 847 | build_environment(rocks, install_env_vars) |
848 | |||
849 | prepare_mock_server_binary_rocks() | ||
841 | end | 850 | end |
842 | 851 | ||
843 | test_env.set_lua_version() | 852 | test_env.set_lua_version() |
diff --git a/spec/write_rockspec_spec.lua b/spec/write_rockspec_spec.lua index 0a0988d0..95dc87ff 100644 --- a/spec/write_rockspec_spec.lua +++ b/spec/write_rockspec_spec.lua | |||
@@ -3,8 +3,6 @@ local git_repo = require("spec.util.git_repo") | |||
3 | local lfs = require("lfs") | 3 | local lfs = require("lfs") |
4 | local run = test_env.run | 4 | local run = test_env.run |
5 | 5 | ||
6 | local extra_rocks = test_env.mock_server_extra_rocks() | ||
7 | |||
8 | describe("LuaRocks write_rockspec tests #blackbox #b_write_rockspec", function() | 6 | describe("LuaRocks write_rockspec tests #blackbox #b_write_rockspec", function() |
9 | 7 | ||
10 | before_each(function() | 8 | before_each(function() |
@@ -79,7 +77,6 @@ describe("LuaRocks write_rockspec tests #blackbox #b_write_rockspec", function() | |||
79 | describe("from tarball #mock", function() | 77 | describe("from tarball #mock", function() |
80 | 78 | ||
81 | setup(function() | 79 | setup(function() |
82 | test_env.setup_specs(extra_rocks) | ||
83 | test_env.mock_server_init() | 80 | test_env.mock_server_init() |
84 | end) | 81 | end) |
85 | teardown(function() | 82 | teardown(function() |