Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compile avif_fuzztest_helpers.cc only once. #2417

Merged
merged 2 commits into from
Aug 30, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Compile avif_fuzztest_helpers.cc only once.
  • Loading branch information
vrabaud committed Aug 30, 2024
commit d9aac2801421c67820c9e659bb76e9e3bdd7e1d5
9 changes: 7 additions & 2 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,9 @@ if(AVIF_ENABLE_FUZZTEST)
# Adds a fuzztest from file TEST_NAME.cc located in the gtest folder. Extra arguments
# are considered as extra source files.
macro(add_avif_fuzztest TEST_NAME)
add_executable(${TEST_NAME} gtest/${TEST_NAME}.cc gtest/avif_fuzztest_helpers.cc ${ARGN})
add_executable(${TEST_NAME} gtest/${TEST_NAME}.cc ${ARGN})
# FuzzTest bundles GoogleTest so no need to link to gtest librairies.
target_link_libraries(${TEST_NAME} PRIVATE aviftest_helpers_internal avif_enable_warnings)
target_link_libraries(${TEST_NAME} PRIVATE aviftest_helpers_internal avif_enable_warnings avif_fuzztest_helpers)
vrabaud marked this conversation as resolved.
Show resolved Hide resolved
link_fuzztest(${TEST_NAME})
add_test(NAME ${TEST_NAME} COMMAND ${TEST_NAME})
set_property(TEST ${TEST_NAME} PROPERTY ENVIRONMENT "TEST_DATA_DIRS=${CMAKE_CURRENT_SOURCE_DIR}/data/")
Expand Down Expand Up @@ -220,6 +220,11 @@ if(AVIF_ENABLE_FUZZTEST)
endif()
fuzztest_setup_fuzzing_flags()

# Create a library with avif_fuzztest_helpers.cc to compile it only once.
add_library(avif_fuzztest_helpers OBJECT gtest/avif_fuzztest_helpers.cc)
target_link_libraries(avif_fuzztest_helpers PUBLIC aviftest_helpers_internal)
link_fuzztest(avif_fuzztest_helpers)

add_avif_fuzztest(avif_fuzztest_dec)
add_avif_fuzztest(avif_fuzztest_dec_incr gtest/avifincrtest_helpers.cc)
add_avif_fuzztest(avif_fuzztest_enc_dec)
Expand Down