Changeset View
Changeset View
Standalone View
Standalone View
src/test/fuzz/CMakeLists.txt
# Fuzzer test harness | # Fuzzer test harness | ||||
add_custom_target(bitcoin-fuzzers) | add_custom_target(bitcoin-fuzzers) | ||||
macro(add_fuzz_target TARGET EXE_NAME) | |||||
add_executable(${TARGET} EXCLUDE_FROM_ALL | |||||
fuzz.cpp | |||||
${ARGN} | |||||
) | |||||
set_target_properties(${TARGET} PROPERTIES OUTPUT_NAME ${EXE_NAME}) | |||||
target_link_libraries(${TARGET} server) | |||||
if("fuzzer" IN_LIST ENABLE_SANITIZERS) | |||||
target_compile_options(${TARGET} PRIVATE -fsanitize=fuzzer) | |||||
target_link_libraries(${TARGET} -fsanitize=fuzzer) | |||||
deadalnix: I'm fairly confident this isn't the ay it supposed to be done. I'm somewhat surprised that that… | |||||
endif() | |||||
add_dependencies(bitcoin-fuzzers ${TARGET}) | |||||
endmacro() | |||||
include(SanitizeHelper) | include(SanitizeHelper) | ||||
function(add_deserialize_fuzz_targets) | function(add_deserialize_fuzz_targets) | ||||
foreach(_fuzz_test_name ${ARGN}) | foreach(_fuzz_test_name ${ARGN}) | ||||
sanitize_target_name("fuzz-" ${_fuzz_test_name} _fuzz_target_name) | sanitize_target_name("fuzz-" ${_fuzz_test_name} _fuzz_target_name) | ||||
add_executable(${_fuzz_target_name} EXCLUDE_FROM_ALL | add_fuzz_target( | ||||
${_fuzz_target_name} | |||||
${_fuzz_test_name} | |||||
# Sources | |||||
deserialize.cpp | deserialize.cpp | ||||
fuzz.cpp | fuzz.cpp | ||||
) | ) | ||||
set_target_properties(${_fuzz_target_name} PROPERTIES OUTPUT_NAME ${_fuzz_test_name}) | |||||
sanitize_c_cxx_definition("" ${_fuzz_test_name} _target_definition) | sanitize_c_cxx_definition("" ${_fuzz_test_name} _target_definition) | ||||
string(TOUPPER ${_target_definition} _target_definition) | string(TOUPPER ${_target_definition} _target_definition) | ||||
target_compile_definitions(${_fuzz_target_name} PRIVATE ${_target_definition}) | target_compile_definitions(${_fuzz_target_name} PRIVATE ${_target_definition}) | ||||
target_link_libraries(${_fuzz_target_name} server) | |||||
if("fuzzer" IN_LIST ENABLE_SANITIZERS) | |||||
target_compile_options(${_fuzz_target_name} PRIVATE -fsanitize=fuzzer) | |||||
target_link_libraries(${_fuzz_target_name} -fsanitize=fuzzer) | |||||
endif() | |||||
add_dependencies(bitcoin-fuzzers ${_fuzz_target_name}) | |||||
endforeach() | endforeach() | ||||
endfunction() | endfunction() | ||||
add_deserialize_fuzz_targets( | add_deserialize_fuzz_targets( | ||||
address_deserialize | address_deserialize | ||||
addrman_deserialize | addrman_deserialize | ||||
banentry_deserialize | banentry_deserialize | ||||
block_deserialize | block_deserialize | ||||
Show All 9 Lines | add_deserialize_fuzz_targets( | ||||
inv_deserialize | inv_deserialize | ||||
messageheader_deserialize | messageheader_deserialize | ||||
netaddr_deserialize | netaddr_deserialize | ||||
service_deserialize | service_deserialize | ||||
transaction_deserialize | transaction_deserialize | ||||
txoutcompressor_deserialize | txoutcompressor_deserialize | ||||
txundo_deserialize | txundo_deserialize | ||||
) | ) | ||||
add_fuzz_target( | |||||
fuzz-script_flags | |||||
script_flags | |||||
deadalnixUnsubmitted Not Done Inline ActionsIs that important that the target has this very specific name? Because if not, then simplify. deadalnix: Is that important that the target has this very specific name? Because if not, then simplify. | |||||
FabienAuthorUnsubmitted Done Inline ActionsNo it's not. It is only done that way for consistency with autotools and I'll be happy to clean it. Fabien: No it's not. It is only done that way for consistency with autotools and I'll be happy to clean… | |||||
# Sources | |||||
fuzz.cpp | |||||
script_flags.cpp | |||||
) |
I'm fairly confident this isn't the ay it supposed to be done. I'm somewhat surprised that that works at all :)
I think you are making this more complex that it needs to be by only setting the flag on some specific files.