llvm.org GIT mirror llvm / ba96863
[libFuzzer tests] Only enable libFuzzer tests if -DLIBFUZZER_ENABLE_TESTS=ON is set. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310100 91177308-0d34-0410-b5e6-96231b3b80d8 George Karpenkov 2 years ago
3 changed file(s) with 17 addition(s) and 20 deletion(s). Raw diff Collapse all Expand all
627627 Users of other operating systems can explicitly request compilation using
628628 ``-DLIBFUZZER_ENABLE=YES`` flag.
629629 Tests are run using ``check-fuzzer`` target from the build directory
630 (note that tests will take a long time to run if the compiler was compiled
631 without optimizations):
630 which was configured with ``-DLIBFUZZER_ENABLE_TESTS=ON`` flag.
632631
633632 .. code-block:: console
634633
2121 # Compile libFuzzer if the compilation is specifically requested, OR
2222 # if the platform is known to be working.
2323 set(LIBFUZZER_ENABLE ${LIBFUZZER_ENABLED_CHECK} CACHE BOOL "Build libFuzzer and its tests")
24 set(LIBFUZZER_ENABLE_TESTS OFF CACHE BOOL "Build libFuzzer and its tests")
2425
2526 if (LIBFUZZER_ENABLE)
2627 add_library(LLVMFuzzerNoMainObjects OBJECT
6465 add_custom_command(TARGET check-fuzzer
6566 COMMAND cmake -E echo "check-fuzzer is disalbed on Windows")
6667 else()
67 if (LLVM_INCLUDE_TESTS AND LIBFUZZER_ENABLE)
68 if (LLVM_INCLUDE_TESTS AND LIBFUZZER_ENABLE_TESTS)
6869 add_subdirectory(test)
6970 endif()
7071 endif()
4646 set(LIBFUZZER_TEST_COMPILER ${LLVM_RUNTIME_OUTPUT_INTDIR}/clang)
4747 set(LIBFUZZER_TEST_CXX_COMPILER ${LLVM_RUNTIME_OUTPUT_INTDIR}/clang++)
4848
49 if ((TARGET asan) AND (TARGET clang))
50 # LIT-based libFuzzer tests.
51 configure_lit_site_cfg(
52 ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in
53 ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
54 )
49 # LIT-based libFuzzer tests.
50 configure_lit_site_cfg(
51 ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in
52 ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
53 )
5554
56 # libFuzzer unit tests.
57 configure_lit_site_cfg(
58 ${CMAKE_CURRENT_SOURCE_DIR}/unit/lit.site.cfg.in
59 ${CMAKE_CURRENT_BINARY_DIR}/unit/lit.site.cfg
60 )
55 # libFuzzer unit tests.
56 configure_lit_site_cfg(
57 ${CMAKE_CURRENT_SOURCE_DIR}/unit/lit.site.cfg.in
58 ${CMAKE_CURRENT_BINARY_DIR}/unit/lit.site.cfg
59 )
6160
62 add_lit_testsuite(check-fuzzer "Running Fuzzer tests"
63 ${CMAKE_CURRENT_BINARY_DIR}
64 DEPENDS LLVMFuzzer-Unittest)
61 add_lit_testsuite(check-fuzzer "Running Fuzzer tests"
62 ${CMAKE_CURRENT_BINARY_DIR}
63 DEPENDS LLVMFuzzer-Unittest)
6564
66 add_dependencies(check-fuzzer LLVMFuzzer asan clang llvm-symbolizer FileCheck sancov not)
67 endif()
68
65 add_dependencies(check-fuzzer LLVMFuzzer asan clang llvm-symbolizer FileCheck sancov not)