From: Kostya Serebryany Date: Sat, 10 Dec 2016 02:26:23 +0000 (+0000) Subject: [libFuzzer] switch all libFuzzer tests to use -fsanitize-coverage=trace-pc-guard... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1b6cd25422cc3b8434ed0a6e79700d1e07d42900;p=llvm [libFuzzer] switch all libFuzzer tests to use -fsanitize-coverage=trace-pc-guard. Support for the previosly used instrumentation will be removed in the following changes git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289311 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/cmake/modules/HandleLLVMOptions.cmake b/cmake/modules/HandleLLVMOptions.cmake index a2a71f666ea..964fa59c0ba 100644 --- a/cmake/modules/HandleLLVMOptions.cmake +++ b/cmake/modules/HandleLLVMOptions.cmake @@ -567,7 +567,7 @@ if(LLVM_USE_SANITIZER) message(FATAL_ERROR "LLVM_USE_SANITIZER is not supported on this platform.") endif() if (LLVM_USE_SANITIZE_COVERAGE) - append("-fsanitize-coverage=edge,indirect-calls,8bit-counters,trace-cmp" CMAKE_C_FLAGS CMAKE_CXX_FLAGS) + append("-fsanitize-coverage=trace-pc-guard,indirect-calls,trace-cmp" CMAKE_C_FLAGS CMAKE_CXX_FLAGS) endif() endif() diff --git a/lib/Fuzzer/test/CMakeLists.txt b/lib/Fuzzer/test/CMakeLists.txt index a664e944585..fddb1517f1e 100644 --- a/lib/Fuzzer/test/CMakeLists.txt +++ b/lib/Fuzzer/test/CMakeLists.txt @@ -25,8 +25,7 @@ foreach (VARNAME ${variables_to_filter}) endforeach() # Enable the coverage instrumentation (it is disabled for the Fuzzer lib). -#set(CMAKE_CXX_FLAGS "${LIBFUZZER_FLAGS_BASE} -fno-sanitize-coverage=8bit-counters -fsanitize-coverage=edge,indirect-calls,trace-cmp,trace-div,trace-gep,trace-pc-guard -g") -set(CMAKE_CXX_FLAGS "${LIBFUZZER_FLAGS_BASE} -fsanitize-coverage=edge,indirect-calls,trace-cmp,trace-div,trace-gep -g") +set(CMAKE_CXX_FLAGS "${LIBFUZZER_FLAGS_BASE} -fsanitize-coverage=trace-pc-guard,indirect-calls,trace-cmp,trace-div,trace-gep -g") # add_libfuzzer_test( # SOURCES source0.cpp [source1.cpp ...] diff --git a/lib/Fuzzer/test/caller-callee.test b/lib/Fuzzer/test/caller-callee.test new file mode 100644 index 00000000000..cbe631c01aa --- /dev/null +++ b/lib/Fuzzer/test/caller-callee.test @@ -0,0 +1,2 @@ +CHECK: BINGO +RUN: not LLVMFuzzer-CallerCalleeTest -use_value_profile=1 -cross_over=0 -max_len=6 -seed=1 -max_total_time=15 2>&1 | FileCheck %s diff --git a/lib/Fuzzer/test/fuzzer.test b/lib/Fuzzer/test/fuzzer.test index ccca3d33fc5..0fc9ff9aebe 100644 --- a/lib/Fuzzer/test/fuzzer.test +++ b/lib/Fuzzer/test/fuzzer.test @@ -32,11 +32,6 @@ COUNTERS: NEW {{.*}} {{bits:|ft:}} {{[1-9]*}} COUNTERS: NEW {{.*}} {{bits:|ft:}} {{[1-9]*}} COUNTERS: BINGO -RUN: not LLVMFuzzer-CallerCalleeTest -use_value_profile=1 -cross_over=0 -max_len=6 -seed=1 -max_total_time=15 2>&1 | FileCheck %s -RUN: not LLVMFuzzer-CallerCalleeTest-TracePC -use_value_profile=1 -cross_over=0 -max_len=6 -seed=1 -max_total_time=15 2>&1 | FileCheck %s -# This one is flaky, may actually find the goal even w/o use_indir_calls. -# LLVMFuzzer-CallerCalleeTest -use_indir_calls=0 -cross_over=0 -max_len=6 -seed=1 -runs=1000000 2>&1 | FileCheck %s --check-prefix=Done1000000 - RUN: not LLVMFuzzer-UninstrumentedTest-Uninstrumented 2>&1 | FileCheck %s --check-prefix=UNINSTRUMENTED UNINSTRUMENTED: ERROR: __sanitizer_set_death_callback is not defined. Exiting. diff --git a/lib/Fuzzer/test/no-coverage/CMakeLists.txt b/lib/Fuzzer/test/no-coverage/CMakeLists.txt index e0e68499ef0..d2f6f438ad7 100644 --- a/lib/Fuzzer/test/no-coverage/CMakeLists.txt +++ b/lib/Fuzzer/test/no-coverage/CMakeLists.txt @@ -2,7 +2,7 @@ # but have coverage rt in the binary. set(CMAKE_CXX_FLAGS - "${LIBFUZZER_FLAGS_BASE} -fno-sanitize-coverage=edge,trace-cmp,indirect-calls,8bit-counters") + "${LIBFUZZER_FLAGS_BASE} -fno-sanitize-coverage=edge,trace-cmp,indirect-calls,8bit-counters,trace-pc-guard") set(NoCoverageTests UninstrumentedTest diff --git a/lib/Fuzzer/test/trace-pc/CMakeLists.txt b/lib/Fuzzer/test/trace-pc/CMakeLists.txt index d5caa188ed4..91becaef15b 100644 --- a/lib/Fuzzer/test/trace-pc/CMakeLists.txt +++ b/lib/Fuzzer/test/trace-pc/CMakeLists.txt @@ -1,7 +1,7 @@ # These tests are not instrumented with coverage. set(CMAKE_CXX_FLAGS - "${LIBFUZZER_FLAGS_BASE} -fno-sanitize-coverage=8bit-counters -fsanitize-coverage=trace-pc-guard") + "${LIBFUZZER_FLAGS_BASE} ") set(TracePCTests SimpleTest diff --git a/lib/Fuzzer/test/uninstrumented/CMakeLists.txt b/lib/Fuzzer/test/uninstrumented/CMakeLists.txt index 06e48985e7e..29b66e6e586 100644 --- a/lib/Fuzzer/test/uninstrumented/CMakeLists.txt +++ b/lib/Fuzzer/test/uninstrumented/CMakeLists.txt @@ -2,7 +2,7 @@ # have coverage rt in the binary. set(CMAKE_CXX_FLAGS - "${LIBFUZZER_FLAGS_BASE} -fno-sanitize=all -fno-sanitize-coverage=edge,trace-cmp,indirect-calls,8bit-counters") + "${LIBFUZZER_FLAGS_BASE} -fno-sanitize=all -fno-sanitize-coverage=edge,trace-cmp,indirect-calls,8bit-counters,trace-pc-guard") set(UninstrumentedTests UninstrumentedTest