aboutsummaryrefslogtreecommitdiff
path: root/spec/install_spec.lua
diff options
context:
space:
mode:
authorHisham <hisham@gobolinux.org>2016-07-11 01:15:41 -0300
committerHisham <hisham@gobolinux.org>2016-07-11 01:15:41 -0300
commit994a041b4f1348564f390f3f4d8ec040c8edb4b8 (patch)
tree128d264d86576e0b62225056769b7097a745b822 /spec/install_spec.lua
parent41eccd4ca6fe51f8174dd43744e7a4bab4daf2cb (diff)
parent77b41dd05a870feeb519e930472133f63cf94317 (diff)
downloadluarocks-994a041b4f1348564f390f3f4d8ec040c8edb4b8.tar.gz
luarocks-994a041b4f1348564f390f3f4d8ec040c8edb4b8.tar.bz2
luarocks-994a041b4f1348564f390f3f4d8ec040c8edb4b8.zip
Merge branch 'master' of https://github.com/keplerproject/luarocks
Diffstat (limited to 'spec/install_spec.lua')
-rw-r--r--spec/install_spec.lua128
1 files changed, 128 insertions, 0 deletions
diff --git a/spec/install_spec.lua b/spec/install_spec.lua
new file mode 100644
index 00000000..0e406e22
--- /dev/null
+++ b/spec/install_spec.lua
@@ -0,0 +1,128 @@
1local test_env = require("test/test_environment")
2local lfs = require("lfs")
3local run = test_env.run
4local testing_paths = test_env.testing_paths
5local env_variables = test_env.env_variables
6
7test_env.unload_luarocks()
8
9local extra_rocks = {
10 "/cprint-0.1-2.src.rock",
11 "/cprint-0.1-2.rockspec",
12 "/lpeg-0.12-1.src.rock",
13 "/luasec-0.6-1.rockspec",
14 "/luassert-1.7.0-1.src.rock",
15 "/luasocket-3.0rc1-1.src.rock",
16 "/luasocket-3.0rc1-1.rockspec",
17 "/lxsh-0.8.6-2.src.rock",
18 "/lxsh-0.8.6-2.rockspec",
19 "/say-1.2-1.src.rock",
20 "/say-1.0-1.src.rock",
21 "/wsapi-1.6-1.src.rock"
22}
23
24describe("LuaRocks install tests #blackbox #b_install", function()
25
26 before_each(function()
27 test_env.setup_specs(extra_rocks)
28 end)
29
30 describe("LuaRocks install - basic tests", function()
31 it("LuaRocks install with no flags/arguments", function()
32 assert.is_false(run.luarocks_bool("install"))
33 end)
34
35 it("LuaRocks install with invalid argument", function()
36 assert.is_false(run.luarocks_bool("install invalid"))
37 end)
38
39 it("LuaRocks install invalid patch", function()
40 assert.is_false(run.luarocks_bool("install " .. testing_paths.testing_dir .. "/testfiles/invalid_patch-0.1-1.rockspec"))
41 end)
42
43 it("LuaRocks install invalid rock", function()
44 assert.is_false(run.luarocks_bool("install \"invalid.rock\" "))
45 end)
46
47 it("LuaRocks install with local flag as root", function()
48 assert.is_false(run.luarocks_bool("install --local luasocket", { USER = "root" } ))
49 end)
50
51 it("LuaRocks install not a zip file", function()
52 assert.is_false(run.luarocks_bool("install " .. testing_paths.testing_dir .. "/testfiles/not_a_zipfile-1.0-1.src.rock"))
53 end)
54
55 it("LuaRocks install only-deps of lxsh show there is no lxsh", function()
56 assert.is_true(run.luarocks_bool("install lxsh 0.8.6-2 --only-deps"))
57 assert.is_false(run.luarocks_bool("show lxsh"))
58 end)
59
60 it("LuaRocks install incompatible architecture", function()
61 assert.is_false(run.luarocks_bool("install \"foo-1.0-1.impossible-x86.rock\" "))
62 end)
63
64 it("LuaRocks install wsapi with bin", function()
65 run.luarocks_bool("install wsapi")
66 end)
67
68 it("LuaRocks install luasec and show luasocket (dependency)", function()
69 assert.is_true(run.luarocks_bool("install luasec"))
70 assert.is_true(run.luarocks_bool("show luasocket"))
71 end)
72 end)
73
74 describe("LuaRocks install - more complex tests", function()
75 it('LuaRocks install luasec with skipping dependency checks', function()
76 run.luarocks(" install luasec --nodeps")
77 assert.is_true(run.luarocks_bool("show luasec"))
78 if env_variables.TYPE_TEST_ENV == "minimal" then
79 assert.is_false(run.luarocks_bool("show luasocket"))
80 assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luasocket"))
81 end
82 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luasec"))
83 end)
84
85 it("LuaRocks install only-deps of luasocket packed rock", function()
86 assert.is_true(test_env.need_luasocket())
87 local output = run.luarocks("install --only-deps " .. testing_paths.testing_cache .. "/luasocket-3.0rc1-1." .. test_env.platform .. ".rock")
88 assert.are.same(output, "Successfully installed dependencies for luasocket 3.0rc1-1")
89 end)
90
91 it("LuaRocks install binary rock of cprint", function()
92 assert.is_true(test_env.need_luasocket())
93 assert.is_true(run.luarocks_bool("build --pack-binary-rock cprint"))
94 assert.is_true(run.luarocks_bool("install cprint-0.1-2." .. test_env.platform .. ".rock"))
95 assert.is_true(os.remove("cprint-0.1-2." .. test_env.platform .. ".rock"))
96 end)
97
98 it("LuaRocks install reinstall", function()
99 assert.is_true(test_env.need_luasocket())
100 assert.is_true(run.luarocks_bool("install " .. testing_paths.testing_cache .. "/luasocket-3.0rc1-1." .. test_env.platform .. ".rock"))
101 assert.is_true(run.luarocks_bool("install --deps-mode=none " .. testing_paths.testing_cache .. "/luasocket-3.0rc1-1." .. test_env.platform .. ".rock"))
102 end)
103 end)
104
105 describe("New install functionality based on pull request 552", function()
106 it("LuaRocks install break dependencies warning", function()
107 assert.is_true(run.luarocks_bool("install say 1.2"))
108 assert.is_true(run.luarocks_bool("install luassert"))
109 assert.is_true(run.luarocks_bool("install say 1.0"))
110 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/say/1.2-1"))
111 end)
112 it("LuaRocks install break dependencies force", function()
113 assert.is_true(run.luarocks_bool("install say 1.2"))
114 assert.is_true(run.luarocks_bool("install luassert"))
115 local output = run.luarocks("install --force say 1.0")
116 assert.is.truthy(output:find("Checking stability of dependencies"))
117 assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/say/1.2-1"))
118 end)
119 it("LuaRocks install break dependencies force fast", function()
120 assert.is_true(run.luarocks_bool("install say 1.2"))
121 assert.is_true(run.luarocks_bool("install luassert"))
122 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/say/1.2-1"))
123 local output = run.luarocks("install --force-fast say 1.0")
124 assert.is.falsy(output:find("Checking stability of dependencies"))
125 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/say/1.0-1"))
126 end)
127 end)
128end)