forked from Green-Sky/tomato
Green Sky
b1fe064484
73d9b845a3 cleanup: Remove old type-ordered event getters. b0840cc02d feat: add ngc events 7df9a51349 refactor: Make event dispatch ordered by receive time. bcb6592af5 test: Add C++ classes wrapping system interfaces. 4cea4f9ca4 fix: Make all the fuzzers work again, and add a test for protodump. c4e209ea1d refactor: Factor out malloc+memcpy into memdup. 87bcc4322d fix: Remove fatal error for non-erroneous case REVERT: 6d634674a9 cleanup: Remove old type-ordered event getters. REVERT: d1d48d1dfc feat: add ngc events REVERT: 994ffecc6b refactor: Make event dispatch ordered by receive time. git-subtree-dir: external/toxcore/c-toxcore git-subtree-split: 73d9b845a310c3f56d2d6d77ed56b93d84256d6e
30 lines
1.3 KiB
CMake
30 lines
1.3 KiB
CMake
# Override network and random functions
|
|
add_library(fuzz_support func_conversion.h fuzz_support.cc fuzz_support.h)
|
|
|
|
set(LIBFUZZER_LINKER_FLAGS)
|
|
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
|
set(LIBFUZZER_LINKER_FLAGS "-fsanitize=fuzzer")
|
|
else()
|
|
message(SEND_ERROR "Compiler must be Clang to build fuzz targets")
|
|
endif()
|
|
|
|
function(fuzz_test target source_dir)
|
|
set(CORPUS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/toktok-fuzzer/corpus/${target}_fuzz_test)
|
|
file(GLOB CORPUS "${CORPUS_DIR}/*")
|
|
add_executable(${target}_fuzz_test ${source_dir}/${target}_fuzz_test.cc)
|
|
target_link_libraries(${target}_fuzz_test PRIVATE fuzz_support test_util toxcore_fuzz ${LIBFUZZER_LINKER_FLAGS})
|
|
if(CORPUS)
|
|
add_test(NAME ${target}_fuzz COMMAND ${CROSSCOMPILING_EMULATOR} ${target}_fuzz_test -max_total_time=10 ${CORPUS})
|
|
set_property(TEST ${target}_fuzz PROPERTY ENVIRONMENT "LLVM_PROFILE_FILE=${target}.profraw;srcdir=${CMAKE_CURRENT_SOURCE_DIR}")
|
|
endif()
|
|
endfunction()
|
|
|
|
fuzz_test(bootstrap .) # Fuzzes the bootstrap process
|
|
fuzz_test(toxsave .) # Fuzzes the bootstrap process
|
|
|
|
fuzz_test(DHT ../../toxcore)
|
|
fuzz_test(forwarding ../../toxcore)
|
|
fuzz_test(group_announce ../../toxcore)
|
|
fuzz_test(group_moderation ../../toxcore)
|
|
fuzz_test(tox_events ../../toxcore)
|