libubox/tests/CMakeLists.txt
Petr Štetiar 436d6363a1 tests: add libFuzzer based tests
LibFuzzer is in-process, coverage-guided, evolutionary fuzzing engine.

LibFuzzer is linked with the library under test, and feeds fuzzed inputs
to the library via a specific fuzzing entrypoint (aka "target
function"); the fuzzer then tracks which areas of the code are reached,
and generates mutations on the corpus of input data in order to maximize
the code coverage.

Lets use libFuzzer to fuzz blob and blobmsg parsing for the start.

Ref: https://llvm.org/docs/LibFuzzer.html
Signed-off-by: Petr Štetiar <ynezz@true.cz>
2019-12-25 10:31:58 +01:00

18 lines
534 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)
IF(CMAKE_C_COMPILER_ID STREQUAL "Clang")
ADD_SUBDIRECTORY(fuzz)
ENDIF()