aboutsummaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
Diffstat (limited to 'spec')
-rw-r--r--spec/install_spec.lua46
1 files changed, 24 insertions, 22 deletions
diff --git a/spec/install_spec.lua b/spec/install_spec.lua
index c3aa0064..d410ca97 100644
--- a/spec/install_spec.lua
+++ b/spec/install_spec.lua
@@ -214,36 +214,38 @@ describe("luarocks install #integration", function()
214 end) 214 end)
215 215
216 it("installation rolls back on failure", function() 216 it("installation rolls back on failure", function()
217 assert.is_true(run.luarocks_bool("build --pack-binary-rock luasocket ${LUASOCKET}")) 217 if test_env.TYPE_TEST_ENV ~= "full" then
218 local luadir = testing_paths.testing_sys_tree .. "/share/lua/"..env_variables.LUA_VERSION 218 assert.is_true(run.luarocks_bool("build --pack-binary-rock luasocket ${LUASOCKET}"))
219 lfs.mkdir(luadir) 219 local luadir = testing_paths.testing_sys_tree .. "/share/lua/"..env_variables.LUA_VERSION
220 lfs.mkdir(luadir)
220 221
221 run.luarocks_bool("remove " .. "luasocket") 222 run.luarocks_bool("remove " .. "luasocket")
222 223
223 -- create a file where a folder should be 224 -- create a file where a folder should be
224 local fd = io.open(luadir .. "/socket", "w") 225 local fd = io.open(luadir .. "/socket", "w")
225 fd:write("\n") 226 fd:write("\n")
226 fd:close() 227 fd:close()
227 228
228 -- try to install and fail 229 -- try to install and fail
229 assert.is_false(run.luarocks_bool("install " .. "luasocket-${LUASOCKET}." .. test_env.platform .. ".rock")) 230 assert.is_false(run.luarocks_bool("install " .. "luasocket-${LUASOCKET}." .. test_env.platform .. ".rock"))
230 231
231 -- file is still there 232 -- file is still there
232 assert.is.truthy(lfs.attributes(luadir .. "/socket")) 233 assert.is.truthy(lfs.attributes(luadir .. "/socket"))
233 -- no left overs from failed installation 234 -- no left overs from failed installation
234 assert.is.falsy(lfs.attributes(luadir .. "/mime.lua")) 235 assert.is.falsy(lfs.attributes(luadir .. "/mime.lua"))
235 236
236 -- remove file 237 -- remove file
237 assert.is_true(os.remove(luadir .. "/socket")) 238 assert.is_true(os.remove(luadir .. "/socket"))
238 239
239 -- try again and succeed 240 -- try again and succeed
240 assert.is_true(run.luarocks_bool("install " .. "luasocket-${LUASOCKET}." .. test_env.platform .. ".rock")) 241 assert.is_true(run.luarocks_bool("install " .. "luasocket-${LUASOCKET}." .. test_env.platform .. ".rock"))
241 242
242 -- files installed successfully 243 -- files installed successfully
243 assert.is.truthy(lfs.attributes(luadir .. "/socket/ftp.lua")) 244 assert.is.truthy(lfs.attributes(luadir .. "/socket/ftp.lua"))
244 assert.is.truthy(lfs.attributes(luadir .. "/mime.lua")) 245 assert.is.truthy(lfs.attributes(luadir .. "/mime.lua"))
245 246
246 assert.is_true(os.remove("luasocket-${LUASOCKET}." .. test_env.platform .. ".rock")) 247 assert.is_true(os.remove("luasocket-${LUASOCKET}." .. test_env.platform .. ".rock"))
248 end
247 end) 249 end)
248 250
249 it("binary rock of cprint", function() 251 it("binary rock of cprint", function()