aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/nvim/CMakeLists.txt29
-rw-r--r--test/helpers.lua36
2 files changed, 44 insertions, 21 deletions
diff --git a/src/nvim/CMakeLists.txt b/src/nvim/CMakeLists.txt
index 1daa5dc3c4..cb003c2026 100644
--- a/src/nvim/CMakeLists.txt
+++ b/src/nvim/CMakeLists.txt
@@ -42,6 +42,9 @@ set(LINT_PRG ${PROJECT_SOURCE_DIR}/src/clint.py)
set(DOWNLOAD_SCRIPT ${PROJECT_SOURCE_DIR}/cmake/Download.cmake)
set(LINT_SUPPRESSES_ROOT ${PROJECT_BINARY_DIR}/errors)
set(LINT_SUPPRESSES_URL "${LINT_SUPPRESS_URL_BASE}/errors.tar.gz")
+set(LINT_SUPPRESSES_ARCHIVE ${LINT_SUPPRESSES_ROOT}/errors.tar.gz)
+set(LINT_SUPPRESSES_TOUCH_FILE "${TOUCHES_DIR}/unpacked-clint-errors-archive")
+set(LINT_SUPPRESSES_INSTALL_SCRIPT "${PROJECT_SOURCE_DIR}/cmake/InstallClintErrors.cmake")
include_directories(${GENERATED_DIR})
include_directories(${CACHED_GENERATED_DIR})
@@ -50,6 +53,8 @@ include_directories(${GENERATED_INCLUDES_DIR})
file(MAKE_DIRECTORY ${TOUCHES_DIR})
file(MAKE_DIRECTORY ${GENERATED_DIR})
file(MAKE_DIRECTORY ${GENERATED_INCLUDES_DIR})
+file(MAKE_DIRECTORY ${LINT_SUPPRESSES_ROOT})
+file(MAKE_DIRECTORY ${LINT_SUPPRESSES_ROOT}/src)
file(GLOB NVIM_SOURCES *.c)
file(GLOB NVIM_HEADERS *.h)
@@ -486,18 +491,18 @@ function(add_download output url allow_failure)
)
endfunction()
-include(ExternalProject)
-ExternalProject_Add(
- clint-error-files
- PREFIX "${LINT_SUPPRESSES_ROOT}"
- URL "${LINT_SUPPRESSES_URL}"
- CONFIGURE_COMMAND ""
- BUILD_COMMAND ""
- BUILD_IN_SOURCE 1
- INSTALL_COMMAND
- "${CMAKE_COMMAND}"
+add_download(${LINT_SUPPRESSES_ARCHIVE} ${LINT_SUPPRESSES_URL} off)
+
+add_custom_command(
+ OUTPUT ${LINT_SUPPRESSES_TOUCH_FILE}
+ WORKING_DIRECTORY ${LINT_SUPPRESSES_ROOT}/src
+ COMMAND ${CMAKE_COMMAND} -E tar xfz ${LINT_SUPPRESSES_ARCHIVE}
+ COMMAND
+ ${CMAKE_COMMAND}
-DTARGET=${LINT_SUPPRESSES_ROOT}
- -P "${PROJECT_SOURCE_DIR}/cmake/InstallClintErrors.cmake"
+ -P ${LINT_SUPPRESSES_INSTALL_SCRIPT}
+ DEPENDS
+ ${LINT_SUPPRESSES_ARCHIVE} ${LINT_SUPPRESSES_INSTALL_SCRIPT}
)
add_download(${LINT_SUPPRESS_FILE} ${LINT_SUPPRESS_URL} off)
@@ -514,7 +519,7 @@ foreach(sfile ${LINT_NVIM_SOURCES})
COMMAND ${LINT_PRG} --suppress-errors=${suppress_file} ${rsfile}
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
COMMAND ${CMAKE_COMMAND} -E touch ${touch_file}
- DEPENDS ${LINT_PRG} ${sfile} clint-error-files
+ DEPENDS ${LINT_PRG} ${sfile} ${LINT_SUPPRESSES_TOUCH_FILE}
)
list(APPEND LINT_TARGETS ${touch_file})
list(APPEND LINT_NVIM_REL_SOURCES ${rsfile})
diff --git a/test/helpers.lua b/test/helpers.lua
index beef53b5a9..d0b1ad552b 100644
--- a/test/helpers.lua
+++ b/test/helpers.lua
@@ -17,18 +17,28 @@ local ok = function(res)
return assert.is_true(res)
end
+-- initial_path: directory to recurse into
+-- re: include pattern (string)
+-- exc_re: exclude pattern(s) (string or table)
local function glob(initial_path, re, exc_re)
+ exc_re = type(exc_re) == 'table' and exc_re or { exc_re }
local paths_to_check = {initial_path}
local ret = {}
local checked_files = {}
+ local function is_excluded(path)
+ for _, pat in pairs(exc_re) do
+ if path:match(pat) then return true end
+ end
+ return false
+ end
+
while #paths_to_check > 0 do
local cur_path = paths_to_check[#paths_to_check]
paths_to_check[#paths_to_check] = nil
for e in lfs.dir(cur_path) do
local full_path = cur_path .. '/' .. e
local checked_path = full_path:sub(#initial_path + 1)
- if ((not exc_re or not checked_path:match(exc_re))
- and e:sub(1, 1) ~= '.') then
+ if (not is_excluded(checked_path)) and e:sub(1, 1) ~= '.' then
local attrs = lfs.attributes(full_path)
if attrs then
local check_key = attrs.dev .. ':' .. tostring(attrs.ino)
@@ -106,13 +116,20 @@ local uname = (function()
end)
end)()
+local function tmpdir_get()
+ return os.getenv('TMPDIR') and os.getenv('TMPDIR') or os.getenv('TEMP')
+end
+
+-- Is temp directory `dir` defined local to the project workspace?
+local function tmpdir_is_local(dir)
+ return not not (dir and string.find(dir, 'Xtest'))
+end
+
local tmpname = (function()
local seq = 0
- local tmpdir = os.getenv('TMPDIR') and os.getenv('TMPDIR') or os.getenv('TEMP')
- -- Is $TMPDIR defined local to the project workspace?
- local in_workspace = not not (tmpdir and string.find(tmpdir, 'Xtest'))
+ local tmpdir = tmpdir_get()
return (function()
- if in_workspace then
+ if tmpdir_is_local(tmpdir) then
-- Cannot control os.tmpname() dir, so hack our own tmpname() impl.
seq = seq + 1
local fname = tmpdir..'/nvim-test-lua-'..seq
@@ -168,22 +185,23 @@ local function check_cores(app, force)
local gdb_db_cmd = 'gdb -n -batch -ex "thread apply all bt full" "$_NVIM_TEST_APP" -c "$_NVIM_TEST_CORE"'
local lldb_db_cmd = 'lldb -Q -o "bt all" -f "$_NVIM_TEST_APP" -c "$_NVIM_TEST_CORE"'
local random_skip = false
+ local local_tmpdir = tmpdir_is_local(tmpdir_get()) and tmpdir_get() or nil
local db_cmd
if hasenv('NVIM_TEST_CORE_GLOB_DIRECTORY') then
initial_path = os.getenv('NVIM_TEST_CORE_GLOB_DIRECTORY')
re = os.getenv('NVIM_TEST_CORE_GLOB_RE')
- exc_re = os.getenv('NVIM_TEST_CORE_EXC_RE')
+ exc_re = { os.getenv('NVIM_TEST_CORE_EXC_RE'), local_tmpdir }
db_cmd = os.getenv('NVIM_TEST_CORE_DB_CMD') or gdb_db_cmd
random_skip = os.getenv('NVIM_TEST_CORE_RANDOM_SKIP')
elseif os.getenv('TRAVIS_OS_NAME') == 'osx' then
initial_path = '/cores'
re = nil
- exc_re = nil
+ exc_re = { local_tmpdir }
db_cmd = lldb_db_cmd
else
initial_path = '.'
re = '/core[^/]*$'
- exc_re = '^/%.deps$'
+ exc_re = { '^/%.deps$', local_tmpdir }
db_cmd = gdb_db_cmd
random_skip = true
end