aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZyX <kp-pav@yandex.ru>2017-03-11 23:13:09 +0300
committerZyX <kp-pav@yandex.ru>2017-03-11 23:23:50 +0300
commitec730daee9bbdc34e250dea3beb7c15e6e7927dc (patch)
tree3c80093e4262d24050a3653d49dd1913b685616e
parentce12bda712bfe41ec606dc86604011e33690df3c (diff)
downloadrneovim-ec730daee9bbdc34e250dea3beb7c15e6e7927dc.tar.gz
rneovim-ec730daee9bbdc34e250dea3beb7c15e6e7927dc.tar.bz2
rneovim-ec730daee9bbdc34e250dea3beb7c15e6e7927dc.zip
unittests: Do not use which, add data to paths.lua.in instead
-rw-r--r--test/config/paths.lua.in9
-rw-r--r--test/helpers.lua7
-rw-r--r--test/unit/helpers.lua4
3 files changed, 16 insertions, 4 deletions
diff --git a/test/config/paths.lua.in b/test/config/paths.lua.in
index 80cc5629d1..8dd4de75db 100644
--- a/test/config/paths.lua.in
+++ b/test/config/paths.lua.in
@@ -8,6 +8,15 @@ end
module.test_include_path = "${CMAKE_BINARY_DIR}/test/includes/post"
module.test_libnvim_path = "${TEST_LIBNVIM_PATH}"
module.test_source_path = "${CMAKE_SOURCE_DIR}"
+module.test_lua_prg = "${LUA_PRG}"
+module.test_luajit_prg = ""
+if module.test_luajit_prg == '' then
+ if module.test_lua_prg:sub(-6) == 'luajit' then
+ module.test_luajit_prg = module.test_lua_prg
+ else
+ module.test_luajit_prg = nil
+ end
+end
table.insert(module.include_paths, "${CMAKE_BINARY_DIR}/include")
return module
diff --git a/test/helpers.lua b/test/helpers.lua
index ecf90869c4..d3dca00385 100644
--- a/test/helpers.lua
+++ b/test/helpers.lua
@@ -216,8 +216,11 @@ local function which(exe)
local pipe = io.popen('which ' .. exe, 'r')
local ret = pipe:read('*a')
pipe:close()
- assert(ret:sub(-1) == '\n')
- return ret:sub(1, -2)
+ if ret == '' then
+ return nil
+ else
+ return ret:sub(1, -2)
+ end
end
return {
diff --git a/test/unit/helpers.lua b/test/unit/helpers.lua
index a8c621fd6d..11a46c52ea 100644
--- a/test/unit/helpers.lua
+++ b/test/unit/helpers.lua
@@ -520,7 +520,7 @@ local function gen_itp(it)
if not err then
if allow_failure then
io.stderr:write('Errorred out:\n' .. tostring(emsg) .. '\n')
- os.execute([[sh -c "source .ci/common/test.sh ; check_core_dumps --delete \"\$(which luajit)\""]])
+ os.execute([[sh -c "source .ci/common/test.sh ; check_core_dumps --delete \"]] .. Paths.test_luajit_prg .. [[\""]])
else
error(emsg)
end
@@ -560,7 +560,7 @@ local module = {
return function(after_each)
if after_each then
after_each(function()
- check_cores(which('luajit'))
+ check_cores(Paths.test_luajit_prg)
end)
end
return module