[llvm] r310100 - [libFuzzer tests] Only enable libFuzzer tests if

George Karpenkov via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 4 12:29:17 PDT 2017


Author: george.karpenkov
Date: Fri Aug  4 12:29:16 2017
New Revision: 310100

URL: http://llvm.org/viewvc/llvm-project?rev=310100&view=rev
Log:
[libFuzzer tests] Only enable libFuzzer tests if
-DLIBFUZZER_ENABLE_TESTS=ON is set.

Modified:
    llvm/trunk/docs/LibFuzzer.rst
    llvm/trunk/lib/Fuzzer/CMakeLists.txt
    llvm/trunk/lib/Fuzzer/test/CMakeLists.txt

Modified: llvm/trunk/docs/LibFuzzer.rst
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/LibFuzzer.rst?rev=310100&r1=310099&r2=310100&view=diff
==============================================================================
--- llvm/trunk/docs/LibFuzzer.rst (original)
+++ llvm/trunk/docs/LibFuzzer.rst Fri Aug  4 12:29:16 2017
@@ -628,8 +628,7 @@ LibFuzzer is built as a part of LLVM pro
 Users of other operating systems can explicitly request compilation using
 ``-DLIBFUZZER_ENABLE=YES`` flag.
 Tests are run using ``check-fuzzer`` target from the build directory
-(note that tests will take a long time to run if the compiler was compiled
-without optimizations):
+which was configured with ``-DLIBFUZZER_ENABLE_TESTS=ON`` flag.
 
 .. code-block:: console
 

Modified: llvm/trunk/lib/Fuzzer/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/CMakeLists.txt?rev=310100&r1=310099&r2=310100&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/CMakeLists.txt (original)
+++ llvm/trunk/lib/Fuzzer/CMakeLists.txt Fri Aug  4 12:29:16 2017
@@ -22,6 +22,7 @@ endif()
 # Compile libFuzzer if the compilation is specifically requested, OR
 # if the platform is known to be working.
 set(LIBFUZZER_ENABLE ${LIBFUZZER_ENABLED_CHECK} CACHE BOOL "Build libFuzzer and its tests")
+set(LIBFUZZER_ENABLE_TESTS OFF CACHE BOOL "Build libFuzzer and its tests")
 
 if (LIBFUZZER_ENABLE)
   add_library(LLVMFuzzerNoMainObjects OBJECT
@@ -65,7 +66,7 @@ if (MSVC)
   add_custom_command(TARGET check-fuzzer
     COMMAND cmake -E echo "check-fuzzer is disalbed on Windows")
 else()
-  if (LLVM_INCLUDE_TESTS AND LIBFUZZER_ENABLE)
+  if (LLVM_INCLUDE_TESTS AND LIBFUZZER_ENABLE_TESTS)
     add_subdirectory(test)
   endif()
 endif()

Modified: llvm/trunk/lib/Fuzzer/test/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/test/CMakeLists.txt?rev=310100&r1=310099&r2=310100&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/test/CMakeLists.txt (original)
+++ llvm/trunk/lib/Fuzzer/test/CMakeLists.txt Fri Aug  4 12:29:16 2017
@@ -47,23 +47,20 @@ include_directories(..)
 set(LIBFUZZER_TEST_COMPILER ${LLVM_RUNTIME_OUTPUT_INTDIR}/clang)
 set(LIBFUZZER_TEST_CXX_COMPILER ${LLVM_RUNTIME_OUTPUT_INTDIR}/clang++)
 
-if ((TARGET asan) AND (TARGET clang))
-  # LIT-based libFuzzer tests.
-  configure_lit_site_cfg(
-    ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in
-    ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
-    )
+# LIT-based libFuzzer tests.
+configure_lit_site_cfg(
+  ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in
+  ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
+  )
 
-  # libFuzzer unit tests.
-  configure_lit_site_cfg(
-    ${CMAKE_CURRENT_SOURCE_DIR}/unit/lit.site.cfg.in
-    ${CMAKE_CURRENT_BINARY_DIR}/unit/lit.site.cfg
-    )
+# libFuzzer unit tests.
+configure_lit_site_cfg(
+  ${CMAKE_CURRENT_SOURCE_DIR}/unit/lit.site.cfg.in
+  ${CMAKE_CURRENT_BINARY_DIR}/unit/lit.site.cfg
+  )
 
-  add_lit_testsuite(check-fuzzer "Running Fuzzer tests"
-    ${CMAKE_CURRENT_BINARY_DIR}
-    DEPENDS LLVMFuzzer-Unittest)
-
-  add_dependencies(check-fuzzer LLVMFuzzer asan clang llvm-symbolizer FileCheck sancov not)
-endif()
+add_lit_testsuite(check-fuzzer "Running Fuzzer tests"
+  ${CMAKE_CURRENT_BINARY_DIR}
+  DEPENDS LLVMFuzzer-Unittest)
 
+add_dependencies(check-fuzzer LLVMFuzzer asan clang llvm-symbolizer FileCheck sancov not)




More information about the llvm-commits mailing list