diff options
author | Petr Štetiar <ynezz@true.cz> | 2021-03-19 17:04:29 +0100 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2021-04-23 00:42:30 +0200 |
commit | df73b25de218833588a9770f6beb9e4a2908bcb7 (patch) | |
tree | dc28a1b956ad7699a13914f896f37295242a4c1e /CMakeLists.txt | |
parent | 41d33d0b2b09efb7b3cddefa2793cf2133a7b5dc (diff) |
tests: add more tests
* add cram based tests
* test under either valgrind or LLVM sanitizers
* add libFuzzer template
Signed-off-by: Petr Štetiar <ynezz@true.cz>
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index c9eb31a..88ee376 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -38,7 +38,8 @@ IF(JSONC_FOUND) INCLUDE_DIRECTORIES(${JSONC_INCLUDE_DIRS}) ENDIF() -ADD_EXECUTABLE(ucode main.c lexer.c lib.c vm.c chunk.c value.c object.c compiler.c source.c) +SET(UCODE_SOURCES main.c lexer.c lib.c vm.c chunk.c value.c object.c compiler.c source.c) +ADD_EXECUTABLE(ucode ${UCODE_SOURCES}) TARGET_LINK_LIBRARIES(ucode ${json}) CHECK_FUNCTION_EXISTS(dlopen DLOPEN_FUNCTION_EXISTS) @@ -89,12 +90,26 @@ ENDIF() IF(UCI_SUPPORT) FIND_LIBRARY(uci NAMES uci) + FIND_LIBRARY(ubox NAMES ubox) FIND_PATH(uci_include_dir uci.h) INCLUDE_DIRECTORIES(${uci_include_dir}) SET(LIBRARIES ${LIBRARIES} uci_lib) ADD_LIBRARY(uci_lib MODULE lib/uci.c) SET_TARGET_PROPERTIES(uci_lib PROPERTIES OUTPUT_NAME uci PREFIX "") - TARGET_LINK_LIBRARIES(uci_lib ${uci}) + TARGET_LINK_LIBRARIES(uci_lib ${uci} ${ubox}) +ENDIF() + +IF(UNIT_TESTING) + ENABLE_TESTING() + ADD_DEFINITIONS(-DUNIT_TESTING) + ADD_SUBDIRECTORY(tests) + + IF(CMAKE_C_COMPILER_ID STREQUAL "Clang") + ADD_EXECUTABLE(ucode-san ${UCODE_SOURCES}) + TARGET_LINK_LIBRARIES(ucode-san ${json}) + TARGET_COMPILE_OPTIONS(ucode-san PRIVATE -g -fno-omit-frame-pointer -fsanitize=undefined,address,leak -fno-sanitize-recover=all) + TARGET_LINK_OPTIONS(ucode-san PRIVATE -fsanitize=undefined,address,leak) + ENDIF() ENDIF() INSTALL(TARGETS ucode RUNTIME DESTINATION bin) |