Add fuzzer instrumentation when building fuzzers

Without this the fuzzing is unguided and takes exponentially more time to find interesting corpus cases.

Change-Id: I1b66de153bc41a829a5276a02a729f4e6bb50ef0
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/33722
Reviewed-by: David Neto <dneto@google.com>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
This commit is contained in:
Ben Clayton
2020-11-24 15:28:06 +00:00
committed by Commit Bot service account
parent 1b543c6778
commit 12ed862c7e
2 changed files with 16 additions and 13 deletions

View File

@@ -435,10 +435,24 @@ if (${COMPILER_IS_LIKE_GNU})
target_compile_options(libtint PRIVATE -fvisibility=hidden)
endif()
if (${TINT_BUILD_FUZZERS})
# Tint library with fuzzer instrumentation
add_library(libtint-fuzz ${TINT_LIB_SRCS})
tint_default_compile_options(libtint-fuzz)
if (${COMPILER_IS_LIKE_GNU})
target_compile_options(libtint-fuzz PRIVATE -fvisibility=hidden)
endif()
target_compile_options(libtint-fuzz PUBLIC -fsanitize=fuzzer -fsanitize-coverage=trace-cmp)
target_link_options(libtint-fuzz PUBLIC -fsanitize=fuzzer -fsanitize-coverage=trace-cmp)
endif()
set_target_properties(libtint PROPERTIES OUTPUT_NAME "tint")
if(${TINT_BUILD_SPV_READER} OR ${TINT_BUILD_SPV_WRITER})
tint_spvtools_compile_options(libtint)
if (${TINT_BUILD_FUZZERS})
tint_spvtools_compile_options(libtint-fuzz)
endif()
endif()
if(${TINT_BUILD_SPV_READER})