Currently we run all tests via Valgrind. This patch adds 2nd batch of tests which are compiled with Clang AddressSanitizer[1], LeakSanitizer[2] and UndefinedBehaviorSanitizer[3] in order to catch more issues during QA on CI. AddressSanitizer is a fast memory error detector. The tool can detect the following types of bugs: * Out-of-bounds accesses to heap, stack and globals * Use-after-free, use-after-return, use-after-scope * Double-free, invalid free LeakSanitizer is a run-time memory leak detector. It can be combined with AddressSanitizer to get both memory error and leak detection, or used in a stand-alone mode. UndefinedBehaviorSanitizer (UBSan) is a fast undefined behavior detector. UBSan modifies the program at compile-time to catch various kinds of undefined behavior during program execution, for example: * Using misaligned or null pointer * Signed integer overflow * Conversion to, from, or between floating-point types which would overflow the destination 1. http://clang.llvm.org/docs/AddressSanitizer.html 2. http://http://clang.llvm.org/docs/LeakSanitizer.html 3. http://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html Signed-off-by: Petr Štetiar <ynezz@true.cz>
14 lines
459 B
CMake
14 lines
459 B
CMake
ADD_SUBDIRECTORY(cram)
|
|
|
|
MACRO(ADD_UNIT_TEST name)
|
|
ADD_EXECUTABLE(${name} ${name}.c)
|
|
TARGET_LINK_LIBRARIES(${name} ubox blobmsg_json json_script ${json})
|
|
TARGET_INCLUDE_DIRECTORIES(${name} PRIVATE ${PROJECT_SOURCE_DIR})
|
|
ENDMACRO(ADD_UNIT_TEST)
|
|
|
|
FILE(GLOB test_cases "test-*.c")
|
|
FOREACH(test_case ${test_cases})
|
|
GET_FILENAME_COMPONENT(test_case ${test_case} NAME_WE)
|
|
ADD_UNIT_TEST(${test_case})
|
|
ADD_UNIT_TEST_SAN(${test_case})
|
|
ENDFOREACH(test_case)
|