1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-14 06:42:58 +08:00

feat(tests): add whitelist for compile flag check (#5356)

This commit is contained in:
Benign X 2024-01-17 18:17:46 +08:00 committed by GitHub
parent ff897e3b6f
commit 9a0ada3ebf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -11,11 +11,18 @@ project(lvgl_tests LANGUAGES C CXX)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_C_STANDARD 99)
set(FLAG_CHECK_WHITELIST --coverage -fsanitize=address)
include(CheckCCompilerFlag)
include(CheckCXXCompilerFlag)
function(filter_compiler_options lang options_out)
set(options ${ARGN})
foreach(option ${options})
if (option IN_LIST FLAG_CHECK_WHITELIST)
list(APPEND ${options_out} ${option})
continue()
endif ()
string(TOUPPER FLAG_SUPPORTED_FOR_${lang}_${option} option_var_name)
if (${lang} STREQUAL C)
@ -94,14 +101,12 @@ elseif (OPTIONS_FULL_32BIT)
set (BUILD_OPTIONS ${LVGL_TEST_OPTIONS_FULL_32BIT})
elseif (OPTIONS_TEST_SYSHEAP)
set (BUILD_OPTIONS ${LVGL_TEST_OPTIONS_TEST_SYSHEAP} -fsanitize=address -fsanitize=leak -fsanitize=undefined --coverage)
filter_compiler_options (C TEST_LIBS --coverage -fsanitize=leak -fsanitize=undefined)
list(APPEND TEST_LIBS -fsanitize=address)
filter_compiler_options (C TEST_LIBS --coverage -fsanitize=address -fsanitize=leak -fsanitize=undefined)
set (LV_CONF_BUILD_DISABLE_EXAMPLES ON)
set (ENABLE_TESTS ON)
elseif (OPTIONS_TEST_DEFHEAP)
set (BUILD_OPTIONS ${LVGL_TEST_OPTIONS_TEST_DEFHEAP})
filter_compiler_options (C TEST_LIBS --coverage -fsanitize=leak -fsanitize=undefined)
list(APPEND TEST_LIBS -fsanitize=address)
filter_compiler_options (C TEST_LIBS --coverage -fsanitize=address -fsanitize=leak -fsanitize=undefined)
set (LV_CONF_BUILD_DISABLE_EXAMPLES ON)
set (ENABLE_TESTS ON)
elseif (OPTIONS_TEST_MEMORYCHECK)