CMakeLists.txt 771 B

123456789101112131415161718
  1. FILE(GLOB test_cases "test-*.c")
  2. MACRO(ADD_FUZZER_TEST name)
  3. ADD_EXECUTABLE(${name} ${name}.c)
  4. TARGET_COMPILE_OPTIONS(${name} PRIVATE -g -O1 -fno-omit-frame-pointer -fsanitize=fuzzer,address,leak,undefined)
  5. TARGET_INCLUDE_DIRECTORIES(${name} PRIVATE ${PROJECT_SOURCE_DIR})
  6. TARGET_LINK_OPTIONS(${name} PRIVATE -stdlib=libc++ -fsanitize=fuzzer,address,leak,undefined)
  7. TARGET_LINK_LIBRARIES(${name} ubus ubusd_library ${ubox_library} ${blob_library} ${json})
  8. ADD_TEST(
  9. NAME ${name}
  10. COMMAND ${name} -max_len=256 -timeout=10 -max_total_time=300 ${CMAKE_CURRENT_SOURCE_DIR}/corpus
  11. )
  12. ENDMACRO(ADD_FUZZER_TEST)
  13. FOREACH(test_case ${test_cases})
  14. GET_FILENAME_COMPONENT(test_case ${test_case} NAME_WE)
  15. ADD_FUZZER_TEST(${test_case})
  16. ENDFOREACH(test_case)