Skip to content

Commit

Permalink
Makes building of fuzz test optional
Browse files Browse the repository at this point in the history
This further makes the fuzz test compilation dependent on whether you
want to include the fuzz test in the ctest "make test" rule. This is
mostly for sonar cloud such that it doesn't complain that the fuzz test
code isn't being run as a false positive (because it isn't included in
the test)

Signed-off-by: Kimball Thurston <kdt3rd@gmail.com>
  • Loading branch information
kdt3rd authored and xlietz committed Aug 9, 2019
1 parent 29eab92 commit 73d5676
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions OpenEXR/IlmImfFuzzTest/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
# SPDX-License-Identifier: BSD-3-Clause
# Copyright Contributors to the OpenEXR Project.

add_executable( IlmImfFuzzTest
fuzzFile.cpp
main.cpp
testFuzzDeepTiles.cpp
testFuzzDeepScanLines.cpp
testFuzzScanLines.cpp
testFuzzTiles.cpp
)
target_link_libraries(IlmImfFuzzTest OpenEXR::IlmImf)
set_target_properties(IlmImfFuzzTest PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin"
)
option(OPENEXR_RUN_FUZZ_TESTS "Controls whether to include the fuzz tests (slow) in default test cases, there is a custom fuzz target" OFF)
if(OPENEXR_RUN_FUZZ_TESTS)
add_executable( IlmImfFuzzTest
fuzzFile.cpp
main.cpp
testFuzzDeepTiles.cpp
testFuzzDeepScanLines.cpp
testFuzzScanLines.cpp
testFuzzTiles.cpp
)
target_link_libraries(IlmImfFuzzTest OpenEXR::IlmImf)
set_target_properties(IlmImfFuzzTest PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin"
)
add_test(NAME OpenEXR.ImfFuzz COMMAND $<TARGET_FILE:IlmImfFuzzTest>)
set_tests_properties(OpenEXR.ImfFuzz PROPERTIES TIMEOUT 36000)
endif()

add_custom_target(fuzz ${CMAKE_CURRENT_BINARY_DIR}/IlmImfFuzzTest)
add_dependencies(fuzz IlmImfFuzzTest)
add_custom_target(fuzz ${CMAKE_CURRENT_BINARY_DIR}/IlmImfFuzzTest)
add_dependencies(fuzz IlmImfFuzzTest)
endif()

0 comments on commit 73d5676

Please sign in to comment.