Skip to content

Commit

Permalink
cmake: Add fuzz_coverage target
Browse files Browse the repository at this point in the history
  • Loading branch information
hebasto committed Nov 29, 2024
1 parent 30e25a7 commit e82cc06
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,20 @@ if(BUILD_FOR_COVERAGE)
DEPENDS ${PROJECT_BINARY_DIR}/total.coverage/index.html
)
add_dependencies(total_coverage test_bitcoin_coverage)
else()
if(NOT FUZZ_CORPORA_DIR)
set(FUZZ_CORPORA_DIR ${CMAKE_CURRENT_SOURCE_DIR}/qa-assets/fuzz_corpora)
endif()
add_custom_command(
OUTPUT ${PROJECT_BINARY_DIR}/fuzz.coverage/index.html
COMMAND Python3::Interpreter test/fuzz/test_runner.py ${FUZZ_CORPORA_DIR} --loglevel DEBUG
COMMAND llvm-profdata merge --instr ${PROFILE_DATA_DIR}/*.profraw --output ${PROFILE_DATA_DIR}/fuzz.profdata
COMMAND llvm-cov show -instr-profile=${PROFILE_DATA_DIR}/fuzz.profdata -object=$<TARGET_FILE:fuzz> -output-dir=${PROJECT_BINARY_DIR}/fuzz.coverage -format=html ${coverage_ignore_paths}
DEPENDS fuzz
)
add_custom_target(fuzz_coverage
DEPENDS ${PROJECT_BINARY_DIR}/fuzz.coverage/index.html
)
endif()
endif()

Expand Down

0 comments on commit e82cc06

Please sign in to comment.