diff options
author | Hisham Muhammad <hisham@gobolinux.org> | 2024-02-28 11:49:34 -0300 |
---|---|---|
committer | Hisham Muhammad <hisham@gobolinux.org> | 2024-02-29 15:31:46 +0000 |
commit | 3f0f3028321154cbacecd6690833d0e8c805ccd8 (patch) | |
tree | 76150d9b8cc50f89fa32d5716a26b6261f4e087e /spec/util | |
parent | 6f07395f37459d7e0c2732888a1f7312fea0c67c (diff) | |
download | luarocks-3f0f3028321154cbacecd6690833d0e8c805ccd8.tar.gz luarocks-3f0f3028321154cbacecd6690833d0e8c805ccd8.tar.bz2 luarocks-3f0f3028321154cbacecd6690833d0e8c805ccd8.zip |
feat: more informative reports no bad LUA_{INC,LIB}DIR configs
Diffstat (limited to 'spec/util')
-rw-r--r-- | spec/util/quick.lua | 2 | ||||
-rw-r--r-- | spec/util/test_env.lua | 17 |
2 files changed, 11 insertions, 8 deletions
diff --git a/spec/util/quick.lua b/spec/util/quick.lua index cb4bb4cf..c313f575 100644 --- a/spec/util/quick.lua +++ b/spec/util/quick.lua | |||
@@ -347,7 +347,7 @@ function quick.compile(filename, env) | |||
347 | write(([=[ ok, err = make_dir(%q) ]=]):format(op.file)) | 347 | write(([=[ ok, err = make_dir(%q) ]=]):format(op.file)) |
348 | write(([=[ assert.truthy((lfs.attributes(%q) or {}).mode == "directory", error_message(%d, "MKDIR failed: " .. %q .. " - " .. (err or "") )) ]=]):format(op.file, op.line, op.file)) | 348 | write(([=[ assert.truthy((lfs.attributes(%q) or {}).mode == "directory", error_message(%d, "MKDIR failed: " .. %q .. " - " .. (err or "") )) ]=]):format(op.file, op.line, op.file)) |
349 | elseif op.op == "RUN" then | 349 | elseif op.op == "RUN" then |
350 | local cmd_helper = cmd_helpers[op.program] or op.program | 350 | local cmd_helper = cmd_helpers[op.program] or ("%q"):format(op.program) |
351 | local redirs = " 1>stdout.txt 2>stderr.txt " | 351 | local redirs = " 1>stdout.txt 2>stderr.txt " |
352 | write(([=[ local ok, _, code = os.execute(%s .. " " .. %q .. %q) ]=]):format(cmd_helper, op.args, redirs)) | 352 | write(([=[ local ok, _, code = os.execute(%s .. " " .. %q .. %q) ]=]):format(cmd_helper, op.args, redirs)) |
353 | write([=[ if type(ok) == "number" then code = (ok >= 256 and ok / 256 or ok) end ]=]) | 353 | write([=[ if type(ok) == "number" then code = (ok >= 256 and ok / 256 or ok) end ]=]) |
diff --git a/spec/util/test_env.lua b/spec/util/test_env.lua index 24a1de9e..8ccb494b 100644 --- a/spec/util/test_env.lua +++ b/spec/util/test_env.lua | |||
@@ -207,13 +207,16 @@ function test_env.run_in_tmp(f, finally) | |||
207 | end | 207 | end |
208 | fs.change_dir(tmpdir) | 208 | fs.change_dir(tmpdir) |
209 | 209 | ||
210 | if finally then | 210 | local lr_config = test_env.env_variables.LUAROCKS_CONFIG |
211 | finally(function() | 211 | |
212 | lfs.chdir(olddir) | 212 | test_env.copy(lr_config, lr_config .. ".bak") |
213 | lfs.rmdir(tmpdir) | 213 | |
214 | fs.change_dir(olddir) | 214 | finally(function() |
215 | end) | 215 | test_env.copy(lr_config .. ".bak", lr_config) |
216 | end | 216 | lfs.chdir(olddir) |
217 | lfs.rmdir(tmpdir) | ||
218 | fs.change_dir(olddir) | ||
219 | end) | ||
217 | 220 | ||
218 | f(tmpdir) | 221 | f(tmpdir) |
219 | end | 222 | end |