Index: lib/Fuzzer/CMakeLists.txt =================================================================== --- lib/Fuzzer/CMakeLists.txt +++ lib/Fuzzer/CMakeLists.txt @@ -63,6 +63,10 @@ target_link_libraries(LLVMFuzzer ${LLVM_PTHREAD_LIB}) endif() -if( LLVM_USE_SANITIZE_COVERAGE AND LLVM_INCLUDE_TESTS ) - add_subdirectory(test) +if( LLVM_USE_SANITIZE_COVERAGE AND LLVM_INCLUDE_TESTS) + + # Libfuzzer tests are currently not supported on Windows. + if (NOT MSVC) + add_subdirectory(test) + endif() endif() Index: lib/Fuzzer/test/CMakeLists.txt =================================================================== --- lib/Fuzzer/test/CMakeLists.txt +++ lib/Fuzzer/test/CMakeLists.txt @@ -17,28 +17,6 @@ # Enable the coverage instrumentation (it is disabled for the Fuzzer lib). set(CMAKE_CXX_FLAGS "${LIBFUZZER_FLAGS_BASE} -fsanitize-coverage=trace-pc-guard,indirect-calls,trace-cmp,trace-div,trace-gep -gline-tables-only") -if(MSVC) - # For tests use the CRT specified for release build - # (asan doesn't support MDd and MTd) - if ("${LLVM_USE_CRT_RELEASE}" STREQUAL "") - set(CRT_FLAG " /MD ") - else() - set(CRT_FLAG " /${LLVM_USE_CRT_RELEASE} ") - endif() - # In order to use the sanitizers in Windows, we need to link against many - # runtime libraries which will depend on the target being created - # (executable or dll) and the c runtime library used (MT/MD). - # By default, cmake uses link.exe for linking, which fails because we don't - # specify the appropiate dependencies. - # As we don't want to consider all of that possible situations which depends - # on the implementation of the compiler-rt, the simplest option is to change - # the rules for linking executables and shared libraries, using the compiler - # instead of link.exe. Clang will consider the sanitizer flags, and - # automatically provide the required libraries to the linker. - set(CMAKE_CXX_LINK_EXECUTABLE " ${CMAKE_CXX_FLAGS} ${CRT_FLAG} -o /link ") - set(CMAKE_CXX_CREATE_SHARED_LIBRARY " ${CMAKE_CXX_FLAGS} ${CRT_FLAG} /LD -o /link ") -endif() - add_custom_target(TestBinaries) # add_libfuzzer_test( @@ -138,7 +116,7 @@ TwoDifferentBugsTest ) -if(APPLE OR MSVC) +if(APPLE) # LeakSanitizer is not supported on OSX and Windows right now set(HAS_LSAN 0) message(WARNING "LeakSanitizer is not supported." @@ -152,18 +130,6 @@ add_libfuzzer_test(${Test} SOURCES ${Test}.cpp) endforeach() -function(test_export_symbol target symbol) - if(MSVC) - set_target_properties(LLVMFuzzer-${target} PROPERTIES LINK_FLAGS - "-export:${symbol}") - endif() -endfunction() - -test_export_symbol(FlagsTest "LLVMFuzzerInitialize") -test_export_symbol(InitializeTest "LLVMFuzzerInitialize") -test_export_symbol(BogusInitializeTest "LLVMFuzzerInitialize") -test_export_symbol(CustomCrossOverTest "LLVMFuzzerCustomCrossOver") -test_export_symbol(CustomMutatorTest "LLVMFuzzerCustomMutator") ############################################################################### # Unit tests @@ -210,9 +176,7 @@ add_subdirectory(no-coverage) add_subdirectory(trace-pc) add_subdirectory(ubsan) -if (NOT MSVC) - add_subdirectory(inline-8bit-counters) -endif() +add_subdirectory(inline-8bit-counters) add_library(LLVMFuzzer-DSO1 SHARED DSO1.cpp) add_library(LLVMFuzzer-DSO2 SHARED DSO2.cpp) @@ -230,19 +194,10 @@ set_target_properties(LLVMFuzzer-DSOTest PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib/Fuzzer/test") -if(MSVC) - set_output_directory(LLVMFuzzer-DSO1 - BINARY_DIR "${CMAKE_BINARY_DIR}/lib/Fuzzer/test" - LIBRARY_DIR "${CMAKE_BINARY_DIR}/lib/Fuzzer/test") - set_output_directory(LLVMFuzzer-DSO2 - BINARY_DIR "${CMAKE_BINARY_DIR}/lib/Fuzzer/test" - LIBRARY_DIR "${CMAKE_BINARY_DIR}/lib/Fuzzer/test") -else(MSVC) - set_output_directory(LLVMFuzzer-DSO1 - LIBRARY_DIR "${CMAKE_BINARY_DIR}/lib/Fuzzer/lib") - set_output_directory(LLVMFuzzer-DSO2 - LIBRARY_DIR "${CMAKE_BINARY_DIR}/lib/Fuzzer/lib") -endif() +set_output_directory(LLVMFuzzer-DSO1 + LIBRARY_DIR "${CMAKE_BINARY_DIR}/lib/Fuzzer/lib") +set_output_directory(LLVMFuzzer-DSO2 + LIBRARY_DIR "${CMAKE_BINARY_DIR}/lib/Fuzzer/lib") add_dependencies(TestBinaries LLVMFuzzer-DSOTest) @@ -252,10 +207,6 @@ # Note this is done after declaring all tests so we can inform lit if any tests # need to be disabled. ############################################################################### -set(LIBFUZZER_POSIX 1) -if (MSVC) - set(LIBFUZZER_POSIX 0) -endif() configure_lit_site_cfg( ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in Index: lib/Fuzzer/test/afl-driver-extra-stats.test =================================================================== --- lib/Fuzzer/test/afl-driver-extra-stats.test +++ lib/Fuzzer/test/afl-driver-extra-stats.test @@ -1,5 +1,3 @@ -REQUIRES: posix - ; Test that not specifying an extra stats file isn't broken. RUN: unset AFL_DRIVER_EXTRA_STATS_FILENAME RUN: AFLDriverTest Index: lib/Fuzzer/test/afl-driver-stderr.test =================================================================== --- lib/Fuzzer/test/afl-driver-stderr.test +++ lib/Fuzzer/test/afl-driver-stderr.test @@ -1,5 +1,3 @@ -REQUIRES: posix - ; Test that not specifying a stderr file isn't broken. RUN: unset AFL_DRIVER_STDERR_DUPLICATE_FILENAME RUN: AFLDriverTest Index: lib/Fuzzer/test/equivalence-signals.test =================================================================== --- lib/Fuzzer/test/equivalence-signals.test +++ lib/Fuzzer/test/equivalence-signals.test @@ -1,4 +1,3 @@ -REQUIRES: posix # Run EquivalenceATest against itself with a small timeout # to stress the signal handling and ensure that shmem doesn't mind # the signals. Index: lib/Fuzzer/test/equivalence.test =================================================================== --- lib/Fuzzer/test/equivalence.test +++ lib/Fuzzer/test/equivalence.test @@ -1,5 +1,3 @@ -REQUIRES: posix - RUN: LLVMFuzzer-EquivalenceATest -run_equivalence_server=EQUIV_TEST & export APID=$! RUN: sleep 3 RUN: not LLVMFuzzer-EquivalenceBTest -use_equivalence_server=EQUIV_TEST -max_len=4096 2>&1 | FileCheck %s Index: lib/Fuzzer/test/lit.cfg =================================================================== --- lib/Fuzzer/test/lit.cfg +++ lib/Fuzzer/test/lit.cfg @@ -43,9 +43,6 @@ if sys.platform.startswith('darwin'): config.available_features.add('darwin') -if config.is_posix: - config.available_features.add('posix') - if sys.platform.startswith('linux'): # Note the value of ``sys.platform`` is not consistent # between python 2 and 3, hence the use of ``.startswith()``. Index: lib/Fuzzer/test/lit.site.cfg.in =================================================================== --- lib/Fuzzer/test/lit.site.cfg.in +++ lib/Fuzzer/test/lit.site.cfg.in @@ -1,5 +1,4 @@ config.test_exec_root = "@CMAKE_CURRENT_BINARY_DIR@" config.llvm_tools_dir = "@LLVM_TOOLS_DIR@" config.has_lsan = True if @HAS_LSAN@ == 1 else False -config.is_posix = @LIBFUZZER_POSIX@ lit_config.load_config(config, "@CMAKE_CURRENT_SOURCE_DIR@/lit.cfg") Index: lib/Fuzzer/test/merge-posix.test =================================================================== --- lib/Fuzzer/test/merge-posix.test +++ lib/Fuzzer/test/merge-posix.test @@ -1,5 +1,3 @@ -REQUIRES: posix - RUN: rm -rf %tmp/T1 %tmp/T2 RUN: mkdir -p %tmp/T1 %tmp/T2 Index: lib/Fuzzer/test/ulimit.test =================================================================== --- lib/Fuzzer/test/ulimit.test +++ lib/Fuzzer/test/ulimit.test @@ -1,4 +1,2 @@ -REQUIRES: posix - RUN: ulimit -s 1000 RUN: not LLVMFuzzer-SimpleTest