diff options
author | Hisham Muhammad <hisham@gobolinux.org> | 2018-09-03 17:48:03 +0200 |
---|---|---|
committer | Hisham Muhammad <hisham@gobolinux.org> | 2018-09-04 18:11:12 +0200 |
commit | b8abb27f98e3c674bd3bca4944a53d10a1a2025d (patch) | |
tree | d66cc0f63a0b82591e799a50fed2c99ecfd00863 /spec/make_spec.lua | |
parent | c2fde487834c6d7505d7e803256e8764237d4476 (diff) | |
download | luarocks-b8abb27f98e3c674bd3bca4944a53d10a1a2025d.tar.gz luarocks-b8abb27f98e3c674bd3bca4944a53d10a1a2025d.tar.bz2 luarocks-b8abb27f98e3c674bd3bca4944a53d10a1a2025d.zip |
Tests: add test cases for rocks with conflicting module names
This tests the behavior of upgrades and downgrades on rocks that deploy both
foo.lua and foo.so
Diffstat (limited to 'spec/make_spec.lua')
-rw-r--r-- | spec/make_spec.lua | 105 |
1 files changed, 105 insertions, 0 deletions
diff --git a/spec/make_spec.lua b/spec/make_spec.lua index 6df0ab23..0fc5cd93 100644 --- a/spec/make_spec.lua +++ b/spec/make_spec.lua | |||
@@ -109,6 +109,109 @@ describe("LuaRocks make tests #integration", function() | |||
109 | end) | 109 | end) |
110 | end) | 110 | end) |
111 | 111 | ||
112 | describe("#ddt LuaRocks make upgrading rockspecs with double deploy types", function() | ||
113 | local deploy_lib_dir = testing_paths.testing_sys_tree .. "/lib/lua/"..env_variables.LUA_VERSION | ||
114 | local deploy_lua_dir = testing_paths.testing_sys_tree .. "/share/lua/"..env_variables.LUA_VERSION | ||
115 | local so = test_env.lib_extension | ||
116 | |||
117 | before_each(function() | ||
118 | test_env.copy_dir(testing_paths.fixtures_dir .. "/double_deploy_type", "ddt") | ||
119 | end) | ||
120 | |||
121 | after_each(function() | ||
122 | test_env.remove_dir("ddt") | ||
123 | os.remove("ddt."..test_env.lib_extension) | ||
124 | end) | ||
125 | |||
126 | it("when upgrading", function() | ||
127 | assert.is_true(run.luarocks_bool("make ddt/double_deploy_type-0.1.0-1.rockspec")) | ||
128 | assert.is.truthy(lfs.attributes(deploy_lib_dir.."/ddt."..so)) | ||
129 | assert.is.truthy(lfs.attributes(deploy_lua_dir.."/ddt.lua")) | ||
130 | assert.same("ddt1", loadfile(deploy_lua_dir.."/ddt.lua")()) | ||
131 | assert.is.truthy(lfs.attributes(deploy_lua_dir.."/ddt_file")) | ||
132 | assert.is.falsy(lfs.attributes(deploy_lib_dir.."/ddt."..so.."~")) | ||
133 | assert.is.falsy(lfs.attributes(deploy_lua_dir.."/ddt.lua~")) | ||
134 | assert.is.falsy(lfs.attributes(deploy_lua_dir.."/ddt_file~")) | ||
135 | |||
136 | assert.is_true(run.luarocks_bool("make ddt/double_deploy_type-0.2.0-1.rockspec")) | ||
137 | assert.is.truthy(lfs.attributes(deploy_lib_dir.."/ddt."..so)) | ||
138 | assert.is.truthy(lfs.attributes(deploy_lua_dir.."/ddt.lua")) | ||
139 | assert.same("ddt2", loadfile(deploy_lua_dir.."/ddt.lua")()) | ||
140 | assert.is.truthy(lfs.attributes(deploy_lua_dir.."/ddt_file")) | ||
141 | assert.is.falsy(lfs.attributes(deploy_lib_dir.."/ddt."..so.."~")) | ||
142 | assert.is.falsy(lfs.attributes(deploy_lua_dir.."/ddt.lua~")) | ||
143 | assert.is.falsy(lfs.attributes(deploy_lua_dir.."/ddt_file~")) | ||
144 | end) | ||
145 | |||
146 | it("modules with same name from lua/ and lib/ when upgrading with --keep", function() | ||
147 | assert.is_true(run.luarocks_bool("make ddt/double_deploy_type-0.1.0-1.rockspec")) | ||
148 | assert.is.truthy(lfs.attributes(deploy_lib_dir.."/ddt."..so)) | ||
149 | assert.is.truthy(lfs.attributes(deploy_lua_dir.."/ddt.lua")) | ||
150 | assert.same("ddt1", loadfile(deploy_lua_dir.."/ddt.lua")()) | ||
151 | assert.is.truthy(lfs.attributes(deploy_lua_dir.."/ddt_file")) | ||
152 | assert.is.falsy(lfs.attributes(deploy_lib_dir.."/ddt."..so.."~")) | ||
153 | assert.is.falsy(lfs.attributes(deploy_lua_dir.."/ddt.lua~")) | ||
154 | assert.is.falsy(lfs.attributes(deploy_lua_dir.."/ddt_file~")) | ||
155 | |||
156 | assert.is_true(run.luarocks_bool("make ddt/double_deploy_type-0.2.0-1.rockspec --keep")) | ||
157 | assert.is.truthy(lfs.attributes(deploy_lib_dir.."/ddt."..so)) | ||
158 | assert.is.truthy(lfs.attributes(deploy_lua_dir.."/ddt.lua")) | ||
159 | assert.same("ddt2", loadfile(deploy_lua_dir.."/ddt.lua")()) | ||
160 | assert.is.truthy(lfs.attributes(deploy_lua_dir.."/ddt_file")) | ||
161 | assert.is.falsy(lfs.attributes(deploy_lib_dir.."/ddt."..so.."~")) | ||
162 | assert.is.falsy(lfs.attributes(deploy_lua_dir.."/ddt.lua~")) | ||
163 | assert.is.falsy(lfs.attributes(deploy_lua_dir.."/ddt_file~")) | ||
164 | assert.is.truthy(lfs.attributes(deploy_lib_dir.."/double_deploy_type_0_1_0_1-ddt."..so)) | ||
165 | assert.is.truthy(lfs.attributes(deploy_lua_dir.."/double_deploy_type_0_1_0_1-ddt.lua")) | ||
166 | assert.same("ddt1", loadfile(deploy_lua_dir.."/double_deploy_type_0_1_0_1-ddt.lua")()) | ||
167 | assert.is.truthy(lfs.attributes(deploy_lua_dir.."/double_deploy_type_0_1_0_1-ddt_file")) | ||
168 | end) | ||
169 | |||
170 | it("modules with same name from lua/ and lib/ when downgrading", function() | ||
171 | assert.is_true(run.luarocks_bool("make ddt/double_deploy_type-0.2.0-1.rockspec")) | ||
172 | assert.is.truthy(lfs.attributes(deploy_lib_dir.."/ddt."..so)) | ||
173 | assert.is.truthy(lfs.attributes(deploy_lua_dir.."/ddt.lua")) | ||
174 | assert.same("ddt2", loadfile(deploy_lua_dir.."/ddt.lua")()) | ||
175 | assert.is.truthy(lfs.attributes(deploy_lua_dir.."/ddt_file")) | ||
176 | assert.is.falsy(lfs.attributes(deploy_lib_dir.."/ddt."..so.."~")) | ||
177 | assert.is.falsy(lfs.attributes(deploy_lua_dir.."/ddt.lua~")) | ||
178 | assert.is.falsy(lfs.attributes(deploy_lua_dir.."/ddt_file~")) | ||
179 | |||
180 | assert.is_true(run.luarocks_bool("make ddt/double_deploy_type-0.1.0-1.rockspec")) | ||
181 | assert.is.truthy(lfs.attributes(deploy_lib_dir.."/ddt."..so)) | ||
182 | assert.is.truthy(lfs.attributes(deploy_lua_dir.."/ddt.lua")) | ||
183 | assert.same("ddt1", loadfile(deploy_lua_dir.."/ddt.lua")()) | ||
184 | assert.is.truthy(lfs.attributes(deploy_lua_dir.."/ddt_file")) | ||
185 | assert.is.falsy(lfs.attributes(deploy_lib_dir.."/ddt."..so.."~")) | ||
186 | assert.is.falsy(lfs.attributes(deploy_lua_dir.."/ddt.lua~")) | ||
187 | assert.is.falsy(lfs.attributes(deploy_lua_dir.."/ddt_file~")) | ||
188 | end) | ||
189 | |||
190 | it("modules with same name from lua/ and lib/ when downgrading with --keep", function() | ||
191 | assert.is_true(run.luarocks_bool("make ddt/double_deploy_type-0.2.0-1.rockspec")) | ||
192 | assert.is.truthy(lfs.attributes(deploy_lib_dir.."/ddt."..so)) | ||
193 | assert.is.truthy(lfs.attributes(deploy_lua_dir.."/ddt.lua")) | ||
194 | assert.same("ddt2", loadfile(deploy_lua_dir.."/ddt.lua")()) | ||
195 | assert.is.truthy(lfs.attributes(deploy_lua_dir.."/ddt_file")) | ||
196 | assert.is.falsy(lfs.attributes(deploy_lib_dir.."/ddt."..so.."~")) | ||
197 | assert.is.falsy(lfs.attributes(deploy_lua_dir.."/ddt.lua~")) | ||
198 | assert.is.falsy(lfs.attributes(deploy_lua_dir.."/ddt_file~")) | ||
199 | |||
200 | assert.is_true(run.luarocks_bool("make ddt/double_deploy_type-0.1.0-1.rockspec --keep")) | ||
201 | assert.is.truthy(lfs.attributes(deploy_lib_dir.."/ddt."..so)) | ||
202 | assert.is.truthy(lfs.attributes(deploy_lua_dir.."/ddt.lua")) | ||
203 | assert.same("ddt2", loadfile(deploy_lua_dir.."/ddt.lua")()) | ||
204 | assert.is.truthy(lfs.attributes(deploy_lua_dir.."/ddt_file")) | ||
205 | assert.is.falsy(lfs.attributes(deploy_lib_dir.."/ddt."..so.."~")) | ||
206 | assert.is.falsy(lfs.attributes(deploy_lua_dir.."/ddt.lua~")) | ||
207 | assert.is.falsy(lfs.attributes(deploy_lua_dir.."/ddt_file~")) | ||
208 | assert.is.truthy(lfs.attributes(deploy_lib_dir.."/double_deploy_type_0_1_0_1-ddt."..so)) | ||
209 | assert.is.truthy(lfs.attributes(deploy_lua_dir.."/double_deploy_type_0_1_0_1-ddt.lua")) | ||
210 | assert.same("ddt1", loadfile(deploy_lua_dir.."/double_deploy_type_0_1_0_1-ddt.lua")()) | ||
211 | assert.is.truthy(lfs.attributes(deploy_lua_dir.."/double_deploy_type_0_1_0_1-ddt_file")) | ||
212 | end) | ||
213 | end) | ||
214 | |||
112 | describe("LuaRocks make upgrading rockspecs with mixed deploy types", function() | 215 | describe("LuaRocks make upgrading rockspecs with mixed deploy types", function() |
113 | before_each(function() | 216 | before_each(function() |
114 | test_env.copy_dir(testing_paths.fixtures_dir .. "/mixed_deploy_type", "mdt") | 217 | test_env.copy_dir(testing_paths.fixtures_dir .. "/mixed_deploy_type", "mdt") |
@@ -159,6 +262,8 @@ describe("LuaRocks make tests #integration", function() | |||
159 | assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/lua/"..env_variables.LUA_VERSION.."/mixed_deploy_type_0_1_0_1-mdt_file")) | 262 | assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/lua/"..env_variables.LUA_VERSION.."/mixed_deploy_type_0_1_0_1-mdt_file")) |
160 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/share/lua/"..env_variables.LUA_VERSION.."/mdt.lua")) | 263 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/share/lua/"..env_variables.LUA_VERSION.."/mdt.lua")) |
161 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/share/lua/"..env_variables.LUA_VERSION.."/mdt_file")) | 264 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/share/lua/"..env_variables.LUA_VERSION.."/mdt_file")) |
265 | assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/share/lua/"..env_variables.LUA_VERSION.."/mixed_deploy_type_0_1_0_1-mdt.lua")) | ||
266 | assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/share/lua/"..env_variables.LUA_VERSION.."/mixed_deploy_type_0_1_0_1-mdt_file")) | ||
162 | end) | 267 | end) |
163 | 268 | ||
164 | it("modules with same name from lua/ and lib/ when downgrading with --keep", function() | 269 | it("modules with same name from lua/ and lib/ when downgrading with --keep", function() |