test: simplify ASAN detection

This commit is contained in:
dundargoc
2025-03-01 13:30:28 +01:00
committed by dundargoc
parent b45a44dd32
commit 59c328bc88
5 changed files with 6 additions and 20 deletions

View File

@@ -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}"

View File

@@ -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

View File

@@ -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.
---

View File

@@ -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'))

View File

@@ -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)