aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Roman <george.roman.99@gmail.com>2018-07-24 11:09:42 +0300
committerHisham Muhammad <hisham@gobolinux.org>2018-07-24 15:41:22 -0300
commit8e6a83911027de167d689d060ce581f653d73213 (patch)
tree622218f964f10a27b7922bcfcd3bf14fd6c1735b
parent961670659be3e986bc74b9b8c2a296f4640302e5 (diff)
downloadluarocks-8e6a83911027de167d689d060ce581f653d73213.tar.gz
luarocks-8e6a83911027de167d689d060ce581f653d73213.tar.bz2
luarocks-8e6a83911027de167d689d060ce581f653d73213.zip
Tests: add test_env.run_in_tmp utility function
-rw-r--r--spec/build_spec.lua336
-rw-r--r--spec/init_spec.lua109
-rw-r--r--spec/install_spec.lua18
-rw-r--r--spec/util/test_env.lua19
4 files changed, 217 insertions, 265 deletions
diff --git a/spec/build_spec.lua b/spec/build_spec.lua
index 62fbb353..4bf0d96c 100644
--- a/spec/build_spec.lua
+++ b/spec/build_spec.lua
@@ -54,31 +54,25 @@ describe("LuaRocks build tests #integration", function()
54 end) 54 end)
55 55
56 it("LuaRocks build with no arguments behaves as luarocks make", function() 56 it("LuaRocks build with no arguments behaves as luarocks make", function()
57 local olddir = lfs.currentdir() 57 test_env.run_in_tmp(function(tmpdir)
58 local tmpdir = get_tmp_path() 58 write_file("c_module-1.0-1.rockspec", [[
59 lfs.mkdir(tmpdir) 59 package = "c_module"
60 lfs.chdir(tmpdir) 60 version = "1.0-1"
61 61 source = {
62 write_file("c_module-1.0-1.rockspec", [[ 62 url = "http://example.com/c_module"
63 package = "c_module"
64 version = "1.0-1"
65 source = {
66 url = "http://example.com/c_module"
67 }
68 build = {
69 type = "builtin",
70 modules = {
71 c_module = { "c_module.c" }
72 } 63 }
73 } 64 build = {
74 ]], finally) 65 type = "builtin",
75 write_file("c_module.c", c_module_source, finally) 66 modules = {
76 67 c_module = { "c_module.c" }
77 assert.is_true(run.luarocks_bool("build")) 68 }
78 assert.truthy(lfs.attributes(tmpdir .. "/c_module." .. test_env.lib_extension)) 69 }
79 70 ]], finally)
80 lfs.chdir(olddir) 71 write_file("c_module.c", c_module_source, finally)
81 lfs.rmdir(tmpdir) 72
73 assert.is_true(run.luarocks_bool("build"))
74 assert.truthy(lfs.attributes(tmpdir .. "/c_module." .. test_env.lib_extension))
75 end, finally)
82 end) 76 end)
83 end) 77 end)
84 78
@@ -94,31 +88,25 @@ describe("LuaRocks build tests #integration", function()
94 end) 88 end)
95 89
96 it("LuaRocks build verbose", function() 90 it("LuaRocks build verbose", function()
97 local olddir = lfs.currentdir() 91 test_env.run_in_tmp(function(tmpdir)
98 local tmpdir = get_tmp_path() 92 write_file("test-1.0-1.rockspec", [[
99 lfs.mkdir(tmpdir) 93 package = "test"
100 lfs.chdir(tmpdir) 94 version = "1.0-1"
101 95 source = {
102 write_file("test-1.0-1.rockspec", [[ 96 url = "file://]] .. tmpdir:gsub("\\", "/") .. [[/test.lua"
103 package = "test"
104 version = "1.0-1"
105 source = {
106 url = "file://]] .. tmpdir:gsub("\\", "/") .. [[/test.lua"
107 }
108 build = {
109 type = "builtin",
110 modules = {
111 test = "test.lua"
112 } 97 }
113 } 98 build = {
114 ]], finally) 99 type = "builtin",
115 write_file("test.lua", "return {}", finally) 100 modules = {
116 101 test = "test.lua"
117 assert.is_true(run.luarocks_bool("build --verbose test-1.0-1.rockspec")) 102 }
118 assert.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/test/1.0-1/test-1.0-1.rockspec")) 103 }
104 ]], finally)
105 write_file("test.lua", "return {}", finally)
119 106
120 lfs.chdir(olddir) 107 assert.is_true(run.luarocks_bool("build --verbose test-1.0-1.rockspec"))
121 lfs.rmdir(tmpdir) 108 assert.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/test/1.0-1/test-1.0-1.rockspec"))
109 end, finally)
122 end) 110 end)
123 111
124 it("LuaRocks build lpeg branch=master", function() 112 it("LuaRocks build lpeg branch=master", function()
@@ -163,70 +151,58 @@ describe("LuaRocks build tests #integration", function()
163 end) 151 end)
164 152
165 it("LuaRocks build fails if the current platform is not supported", function() 153 it("LuaRocks build fails if the current platform is not supported", function()
166 local olddir = lfs.currentdir() 154 test_env.run_in_tmp(function(tmpdir)
167 local tmpdir = get_tmp_path() 155 write_file("test-1.0-1.rockspec", [[
168 lfs.mkdir(tmpdir) 156 package = "test"
169 lfs.chdir(tmpdir) 157 version = "1.0-1"
170 158 source = {
171 write_file("test-1.0-1.rockspec", [[ 159 url = "file://]] .. tmpdir:gsub("\\", "/") .. [[/test.lua"
172 package = "test"
173 version = "1.0-1"
174 source = {
175 url = "file://]] .. tmpdir:gsub("\\", "/") .. [[/test.lua"
176 }
177 supported_platforms = {
178 "unix", "macosx"
179 }
180 build = {
181 type = "builtin",
182 modules = {
183 test = "test.lua"
184 } 160 }
185 } 161 supported_platforms = {
186 ]], finally) 162 "unix", "macosx"
187 write_file("test.lua", "return {}", finally) 163 }
188 164 build = {
189 if test_env.TEST_TARGET_OS == "windows" then 165 type = "builtin",
190 assert.is_false(run.luarocks_bool("build test-1.0-1.rockspec")) -- Error: This rockspec does not support windows platforms 166 modules = {
191 assert.is.falsy(lfs.attributes(testing_paths.testing_sys_rocks .. "/test/1.0-1/test-1.0-1.rockspec")) 167 test = "test.lua"
192 else 168 }
193 assert.is_true(run.luarocks_bool("build test-1.0-1.rockspec")) 169 }
194 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/test/1.0-1/test-1.0-1.rockspec")) 170 ]], finally)
195 end 171 write_file("test.lua", "return {}", finally)
196 172
197 lfs.chdir(olddir) 173 if test_env.TEST_TARGET_OS == "windows" then
198 lfs.rmdir(tmpdir) 174 assert.is_false(run.luarocks_bool("build test-1.0-1.rockspec")) -- Error: This rockspec does not support windows platforms
175 assert.is.falsy(lfs.attributes(testing_paths.testing_sys_rocks .. "/test/1.0-1/test-1.0-1.rockspec"))
176 else
177 assert.is_true(run.luarocks_bool("build test-1.0-1.rockspec"))
178 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/test/1.0-1/test-1.0-1.rockspec"))
179 end
180 end, finally)
199 end) 181 end)
200 182
201 it("LuaRocks build with skipping dependency checks", function() 183 it("LuaRocks build with skipping dependency checks", function()
202 local olddir = lfs.currentdir() 184 test_env.run_in_tmp(function(tmpdir)
203 local tmpdir = get_tmp_path() 185 write_file("test-1.0-1.rockspec", [[
204 lfs.mkdir(tmpdir) 186 package = "test"
205 lfs.chdir(tmpdir) 187 version = "1.0-1"
206 188 source = {
207 write_file("test-1.0-1.rockspec", [[ 189 url = "file://]] .. tmpdir:gsub("\\", "/") .. [[/test.lua"
208 package = "test"
209 version = "1.0-1"
210 source = {
211 url = "file://]] .. tmpdir:gsub("\\", "/") .. [[/test.lua"
212 }
213 dependencies = {
214 "a_rock 1.0"
215 }
216 build = {
217 type = "builtin",
218 modules = {
219 test = "test.lua"
220 } 190 }
221 } 191 dependencies = {
222 ]], finally) 192 "a_rock 1.0"
223 write_file("test.lua", "return {}", finally) 193 }
224 194 build = {
225 assert.is_true(run.luarocks_bool("build test-1.0-1.rockspec --deps-mode=none")) 195 type = "builtin",
226 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/test/1.0-1/test-1.0-1.rockspec")) 196 modules = {
197 test = "test.lua"
198 }
199 }
200 ]], finally)
201 write_file("test.lua", "return {}", finally)
227 202
228 lfs.chdir(olddir) 203 assert.is_true(run.luarocks_bool("build test-1.0-1.rockspec --deps-mode=none"))
229 lfs.rmdir(tmpdir) 204 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/test/1.0-1/test-1.0-1.rockspec"))
205 end)
230 end) 206 end)
231 207
232 it("LuaRocks build lmathx deps partial match", function() 208 it("LuaRocks build lmathx deps partial match", function()
@@ -291,70 +267,58 @@ describe("LuaRocks build tests #integration", function()
291 end) 267 end)
292 268
293 it("LuaRocks build only deps of a given rockspec", function() 269 it("LuaRocks build only deps of a given rockspec", function()
294 local olddir = lfs.currentdir() 270 test_env.run_in_tmp(function(tmpdir)
295 local tmpdir = get_tmp_path() 271 write_file("test-1.0-1.rockspec", [[
296 lfs.mkdir(tmpdir) 272 package = "test"
297 lfs.chdir(tmpdir) 273 version = "1.0-1"
298 274 source = {
299 write_file("test-1.0-1.rockspec", [[ 275 url = "file://]] .. tmpdir:gsub("\\", "/") .. [[/test.lua"
300 package = "test"
301 version = "1.0-1"
302 source = {
303 url = "file://]] .. tmpdir:gsub("\\", "/") .. [[/test.lua"
304 }
305 dependencies = {
306 "a_rock 1.0"
307 }
308 build = {
309 type = "builtin",
310 modules = {
311 test = "test.lua"
312 } 276 }
313 } 277 dependencies = {
314 ]], finally) 278 "a_rock 1.0"
315 write_file("test.lua", "return {}", finally) 279 }
316 280 build = {
317 assert.is.truthy(run.luarocks_bool("build --server=" .. testing_paths.fixtures_dir .. "/a_repo test-1.0-1.rockspec --only-deps")) 281 type = "builtin",
318 assert.is.falsy(lfs.attributes(testing_paths.testing_sys_rocks .. "/test/1.0-1/test-1.0-1.rockspec")) 282 modules = {
319 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/a_rock/1.0-1/a_rock-1.0-1.rockspec")) 283 test = "test.lua"
284 }
285 }
286 ]], finally)
287 write_file("test.lua", "return {}", finally)
320 288
321 lfs.chdir(olddir) 289 assert.is.truthy(run.luarocks_bool("build --server=" .. testing_paths.fixtures_dir .. "/a_repo test-1.0-1.rockspec --only-deps"))
322 lfs.rmdir(tmpdir) 290 assert.is.falsy(lfs.attributes(testing_paths.testing_sys_rocks .. "/test/1.0-1/test-1.0-1.rockspec"))
291 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/a_rock/1.0-1/a_rock-1.0-1.rockspec"))
292 end, finally)
323 end) 293 end)
324 294
325 it("LuaRocks build only deps of a given rock", function() 295 it("LuaRocks build only deps of a given rock", function()
326 local olddir = lfs.currentdir() 296 test_env.run_in_tmp(function(tmpdir)
327 local tmpdir = get_tmp_path() 297 write_file("test-1.0-1.rockspec", [[
328 lfs.mkdir(tmpdir) 298 package = "test"
329 lfs.chdir(tmpdir) 299 version = "1.0-1"
330 300 source = {
331 write_file("test-1.0-1.rockspec", [[ 301 url = "file://]] .. tmpdir:gsub("\\", "/") .. [[/test.lua"
332 package = "test"
333 version = "1.0-1"
334 source = {
335 url = "file://]] .. tmpdir:gsub("\\", "/") .. [[/test.lua"
336 }
337 dependencies = {
338 "a_rock 1.0"
339 }
340 build = {
341 type = "builtin",
342 modules = {
343 test = "test.lua"
344 } 302 }
345 } 303 dependencies = {
346 ]], finally) 304 "a_rock 1.0"
347 write_file("test.lua", "return {}", finally) 305 }
348 306 build = {
349 assert.is.truthy(run.luarocks_bool("pack test-1.0-1.rockspec")) 307 type = "builtin",
350 assert.is.truthy(lfs.attributes("test-1.0-1.src.rock")) 308 modules = {
309 test = "test.lua"
310 }
311 }
312 ]], finally)
313 write_file("test.lua", "return {}", finally)
351 314
352 assert.is.truthy(run.luarocks_bool("build --server=" .. testing_paths.fixtures_dir .. "/a_repo test-1.0-1.src.rock --only-deps")) 315 assert.is.truthy(run.luarocks_bool("pack test-1.0-1.rockspec"))
353 assert.is.falsy(lfs.attributes(testing_paths.testing_sys_rocks .. "/test/1.0-1/test-1.0-1.rockspec")) 316 assert.is.truthy(lfs.attributes("test-1.0-1.src.rock"))
354 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/a_rock/1.0-1/a_rock-1.0-1.rockspec"))
355 317
356 lfs.chdir(olddir) 318 assert.is.truthy(run.luarocks_bool("build --server=" .. testing_paths.fixtures_dir .. "/a_repo test-1.0-1.src.rock --only-deps"))
357 lfs.rmdir(tmpdir) 319 assert.is.falsy(lfs.attributes(testing_paths.testing_sys_rocks .. "/test/1.0-1/test-1.0-1.rockspec"))
320 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/a_rock/1.0-1/a_rock-1.0-1.rockspec"))
321 end, finally)
358 end) 322 end)
359 323
360 it("LuaRocks build with https", function() 324 it("LuaRocks build with https", function()
@@ -480,37 +444,31 @@ describe("LuaRocks build tests #integration", function()
480 end) 444 end)
481 445
482 it("fails when missing external dependency", function() 446 it("fails when missing external dependency", function()
483 local tmpdir = get_tmp_path() 447 test_env.run_in_tmp(function(tmpdir)
484 local olddir = lfs.currentdir() 448 write_file("missing_external-0.1-1.rockspec", [[
485 lfs.mkdir(tmpdir) 449 package = "missing_external"
486 lfs.chdir(tmpdir) 450 version = "0.1-1"
487 451 source = {
488 write_file("missing_external-0.1-1.rockspec", [[ 452 url = "https://example.com/build.lua"
489 package = "missing_external"
490 version = "0.1-1"
491 source = {
492 url = "https://example.com/build.lua"
493 }
494 external_dependencies = {
495 INEXISTENT = {
496 library = "inexistentlib*",
497 header = "inexistentheader*.h",
498 } 453 }
499 } 454 external_dependencies = {
500 dependencies = { 455 INEXISTENT = {
501 "lua >= 5.1" 456 library = "inexistentlib*",
502 } 457 header = "inexistentheader*.h",
503 build = { 458 }
504 type = "builtin",
505 modules = {
506 build = "build.lua"
507 } 459 }
508 } 460 dependencies = {
509 ]], finally) 461 "lua >= 5.1"
510 assert.is_false(run.luarocks_bool("build missing_external-0.1-1.rockspec INEXISTENT_INCDIR=\"/invalid/dir\"")) 462 }
511 463 build = {
512 lfs.chdir(olddir) 464 type = "builtin",
513 lfs.rmdir(tmpdir) 465 modules = {
466 build = "build.lua"
467 }
468 }
469 ]], finally)
470 assert.is_false(run.luarocks_bool("build missing_external-0.1-1.rockspec INEXISTENT_INCDIR=\"/invalid/dir\""))
471 end, finally)
514 end) 472 end)
515 473
516 it("builds with external dependency", function() 474 it("builds with external dependency", function()
diff --git a/spec/init_spec.lua b/spec/init_spec.lua
index 2d28bfe7..a4751741 100644
--- a/spec/init_spec.lua
+++ b/spec/init_spec.lua
@@ -8,76 +8,57 @@ local is_win = test_env.TEST_TARGET_OS == "windows"
8test_env.unload_luarocks() 8test_env.unload_luarocks()
9 9
10describe("Luarocks init test #integration", function() 10describe("Luarocks init test #integration", function()
11 local tmpdir
12
13 after_each(function()
14 if tmpdir then
15 lfs.rmdir(tmpdir)
16 tmpdir = nil
17 end
18 end)
19
20 it("LuaRocks init with no arguments", function() 11 it("LuaRocks init with no arguments", function()
21 tmpdir = get_tmp_path() 12 test_env.run_in_tmp(function(tmpdir)
22 lfs.mkdir(tmpdir) 13 local myproject = tmpdir .. "/myproject"
23 local myproject = tmpdir .. "/myproject" 14 lfs.mkdir(myproject)
24 lfs.mkdir(myproject) 15 lfs.chdir(myproject)
25 local olddir = lfs.currentdir() 16
26 lfs.chdir(myproject) 17 assert(run.luarocks("init"))
27 18 if is_win then
28 assert(run.luarocks("init")) 19 assert.truthy(lfs.attributes(myproject .. "/lua.bat"))
29 if is_win then 20 assert.truthy(lfs.attributes(myproject .. "/luarocks.bat"))
30 assert.truthy(lfs.attributes(myproject .. "/lua.bat")) 21 else
31 assert.truthy(lfs.attributes(myproject .. "/luarocks.bat")) 22 assert.truthy(lfs.attributes(myproject .. "/lua"))
32 else 23 assert.truthy(lfs.attributes(myproject .. "/luarocks"))
33 assert.truthy(lfs.attributes(myproject .. "/lua")) 24 end
34 assert.truthy(lfs.attributes(myproject .. "/luarocks")) 25 assert.truthy(lfs.attributes(myproject .. "/lua_modules"))
35 end 26 assert.truthy(lfs.attributes(myproject .. "/.luarocks"))
36 assert.truthy(lfs.attributes(myproject .. "/lua_modules")) 27 assert.truthy(lfs.attributes(myproject .. "/.luarocks/config-" .. test_env.lua_version .. ".lua"))
37 assert.truthy(lfs.attributes(myproject .. "/.luarocks")) 28 assert.truthy(lfs.attributes(myproject .. "/.gitignore"))
38 assert.truthy(lfs.attributes(myproject .. "/.luarocks/config-" .. test_env.lua_version .. ".lua")) 29 assert.truthy(lfs.attributes(myproject .. "/myproject-dev-1.rockspec"))
39 assert.truthy(lfs.attributes(myproject .. "/.gitignore")) 30 end, finally)
40 assert.truthy(lfs.attributes(myproject .. "/myproject-dev-1.rockspec"))
41
42 lfs.chdir(olddir)
43 end) 31 end)
44 32
45 it("LuaRocks init with given arguments", function() 33 it("LuaRocks init with given arguments", function()
46 tmpdir = get_tmp_path() 34 test_env.run_in_tmp(function(tmpdir)
47 lfs.mkdir(tmpdir) 35 local myproject = tmpdir .. "/myproject"
48 local myproject = tmpdir .. "/myproject" 36 lfs.mkdir(myproject)
49 lfs.mkdir(myproject) 37 lfs.chdir(myproject)
50 local olddir = lfs.currentdir() 38
51 lfs.chdir(myproject) 39 assert(run.luarocks("init customname 1.0"))
52 40 assert.truthy(lfs.attributes(myproject .. "/customname-1.0-1.rockspec"))
53 assert(run.luarocks("init customname 1.0")) 41 end, finally)
54 assert.truthy(lfs.attributes(myproject .. "/customname-1.0-1.rockspec"))
55
56 lfs.chdir(olddir)
57 end) 42 end)
58 43
59 it("LuaRocks init in a git repo", function() 44 it("LuaRocks init in a git repo", function()
60 tmpdir = get_tmp_path() 45 test_env.run_in_tmp(function(tmpdir)
61 lfs.mkdir(tmpdir) 46 local myproject = tmpdir .. "/myproject"
62 local olddir = lfs.currentdir() 47 copy_dir(testing_paths.fixtures_dir .. "/git_repo", myproject)
63 lfs.chdir(tmpdir) 48 lfs.chdir(myproject)
64 local myproject = tmpdir .. "/myproject" 49
65 copy_dir(testing_paths.fixtures_dir .. "/git_repo", myproject) 50 assert(run.luarocks("init"))
66 lfs.chdir(myproject) 51 local fd = assert(io.open(myproject .. "/myproject-dev-1.rockspec", "r"))
67 52 local content = assert(fd:read("*a"))
68 assert(run.luarocks("init")) 53 assert.truthy(content:find("summary = \"Test repo\""))
69 local fd = assert(io.open(myproject .. "/myproject-dev-1.rockspec", "r")) 54 assert.truthy(content:find("detailed = .+Test repo.+"))
70 local content = assert(fd:read("*a")) 55 assert.truthy(content:find("license = \"MIT\""))
71 assert.truthy(content:find("summary = \"Test repo\"")) 56
72 assert.truthy(content:find("detailed = .+Test repo.+")) 57 fd = assert(io.open(myproject .. "/.gitignore", "r"))
73 assert.truthy(content:find("license = \"MIT\"")) 58 content = assert(fd:read("*a"))
74 59 assert.truthy(content:find("/foo"))
75 fd = assert(io.open(myproject .. "/.gitignore", "r")) 60 assert.truthy(content:find("/lua"))
76 content = assert(fd:read("*a")) 61 assert.truthy(content:find("/lua_modules"))
77 assert.truthy(content:find("/foo")) 62 end, finally)
78 assert.truthy(content:find("/lua"))
79 assert.truthy(content:find("/lua_modules"))
80
81 lfs.chdir(olddir)
82 end) 63 end)
83end) 64end)
diff --git a/spec/install_spec.lua b/spec/install_spec.lua
index 8a5d8f09..0555155b 100644
--- a/spec/install_spec.lua
+++ b/spec/install_spec.lua
@@ -57,18 +57,12 @@ describe("luarocks install #integration", function()
57 end) 57 end)
58 58
59 it("fails not a zip file", function() 59 it("fails not a zip file", function()
60 local olddir = lfs.currentdir() 60 test_env.run_in_tmp(function(tmpdir)
61 local tmpdir = get_tmp_path() 61 write_file("not_a_zipfile-1.0-1.src.rock", [[
62 lfs.mkdir(tmpdir) 62 I am not a .zip file!
63 lfs.chdir(tmpdir) 63 ]], finally)
64 64 assert.is_false(run.luarocks_bool("install not_a_zipfile-1.0-1.src.rock"))
65 write_file("not_a_zipfile-1.0-1.src.rock", [[ 65 end, finally)
66 I am not a .zip file!
67 ]], finally)
68 assert.is_false(run.luarocks_bool("install not_a_zipfile-1.0-1.src.rock"))
69
70 lfs.chdir(olddir)
71 lfs.rmdir(tmpdir)
72 end) 66 end)
73 67
74 it("only-deps of lxsh show there is no lxsh", function() 68 it("only-deps of lxsh show there is no lxsh", function()
diff --git a/spec/util/test_env.lua b/spec/util/test_env.lua
index 0218aa53..181f4693 100644
--- a/spec/util/test_env.lua
+++ b/spec/util/test_env.lua
@@ -101,6 +101,25 @@ function test_env.get_tmp_path()
101 return path 101 return path
102end 102end
103 103
104--- Helper function that runs the given function inside
105-- a temporary directory, isolating it
106-- @param f function: the function to be run
107function test_env.run_in_tmp(f, finally)
108 local olddir = lfs.currentdir()
109 local tmpdir = test_env.get_tmp_path()
110 lfs.mkdir(tmpdir)
111 lfs.chdir(tmpdir)
112
113 if finally then
114 finally(function()
115 lfs.chdir(olddir)
116 lfs.rmdir(tmpdir)
117 end)
118 end
119
120 f(tmpdir)
121end
122
104--- Helper function for execute_bool and execute_output 123--- Helper function for execute_bool and execute_output
105-- @param command string: command to execute 124-- @param command string: command to execute
106-- @param print_command boolean: print command if 'true' 125-- @param print_command boolean: print command if 'true'