mirror of
https://github.com/neovim/neovim.git
synced 2025-09-05 19:08:15 +00:00
test: simplify ASAN detection
This commit is contained in:
@@ -6,6 +6,7 @@ for p in ("${TEST_INCLUDE_DIRS}" .. ";"):gmatch("[^;]+") do
|
||||
end
|
||||
|
||||
M.translations_enabled = "${ENABLE_TRANSLATIONS}" == "ON"
|
||||
M.is_asan = "${ENABLE_ASAN_UBSAN}" == "ON"
|
||||
M.vterm_test_file = "${VTERM_TEST_FILE}"
|
||||
M.test_build_dir = "${CMAKE_BINARY_DIR}"
|
||||
M.test_source_path = "${CMAKE_SOURCE_DIR}"
|
||||
|
@@ -13,10 +13,9 @@ local load_adjust = n.load_adjust
|
||||
local write_file = t.write_file
|
||||
local is_os = t.is_os
|
||||
local is_ci = t.is_ci
|
||||
local is_asan = n.is_asan
|
||||
|
||||
clear()
|
||||
if is_asan() then
|
||||
if t.is_asan() then
|
||||
pending('ASAN build is difficult to estimate memory usage', function() end)
|
||||
return
|
||||
elseif is_os('win') then
|
||||
|
@@ -905,11 +905,6 @@ function M.testprg(name)
|
||||
return ('%s/%s%s'):format(M.nvim_dir, name, ext)
|
||||
end
|
||||
|
||||
function M.is_asan()
|
||||
local version = M.eval('execute("verbose version")')
|
||||
return version:match('-fsanitize=[a-z,]*address')
|
||||
end
|
||||
|
||||
--- Returns a valid, platform-independent Nvim listen address.
|
||||
--- Useful for communicating with child instances.
|
||||
---
|
||||
|
@@ -418,6 +418,10 @@ function M.is_arch(s)
|
||||
return s == architecture
|
||||
end
|
||||
|
||||
function M.is_asan()
|
||||
return M.paths.is_asan
|
||||
end
|
||||
|
||||
local tmpname_id = 0
|
||||
local tmpdir = os.getenv('TMPDIR') or os.getenv('TEMP')
|
||||
local tmpdir_is_local = not not (tmpdir and tmpdir:find('Xtest'))
|
||||
|
@@ -876,18 +876,6 @@ local function ptr2key(ptr)
|
||||
return ffi.string(s)
|
||||
end
|
||||
|
||||
local function is_asan()
|
||||
cimport('./src/nvim/version.h')
|
||||
local status, res = pcall(function()
|
||||
return lib.version_cflags
|
||||
end)
|
||||
if status then
|
||||
return ffi.string(res):match('-fsanitize=[a-z,]*address')
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
--- @class test.unit.testutil.module
|
||||
local M = {
|
||||
cimport = cimport,
|
||||
@@ -916,7 +904,6 @@ local M = {
|
||||
ptr2addr = ptr2addr,
|
||||
ptr2key = ptr2key,
|
||||
debug_log = debug_log,
|
||||
is_asan = is_asan,
|
||||
}
|
||||
--- @class test.unit.testutil: test.unit.testutil.module, test.testutil
|
||||
M = vim.tbl_extend('error', M, t_global)
|
||||
|
Reference in New Issue
Block a user