From 9a0ada3ebf1348b6ccab0bae0ab1f73f5adcf46c Mon Sep 17 00:00:00 2001 From: Benign X <1341398182@qq.com> Date: Wed, 17 Jan 2024 18:17:46 +0800 Subject: [PATCH] feat(tests): add whitelist for compile flag check (#5356) --- tests/CMakeLists.txt | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 9d93e7e32..fd831be25 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -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)