summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Fuzzer/test
diff options
context:
space:
mode:
authorKostya Serebryany <kcc@google.com>2016-06-08 01:46:13 +0000
committerKostya Serebryany <kcc@google.com>2016-06-08 01:46:13 +0000
commit76f425211e83cd387e93390f53c8a9b56cfeb231 (patch)
treec7240e260993a7cefb7b3a4195f7a2a8437ebccc /llvm/lib/Fuzzer/test
parent33b8b64aef936b142ebdc536db0cb3210ae93787 (diff)
downloadbcm5719-llvm-76f425211e83cd387e93390f53c8a9b56cfeb231.tar.gz
bcm5719-llvm-76f425211e83cd387e93390f53c8a9b56cfeb231.zip
[libFuzzer] add a test that is built w/o coverage instrumentation but has the coverage rt (it should now fail with a descriptive message)
llvm-svn: 272090
Diffstat (limited to 'llvm/lib/Fuzzer/test')
-rw-r--r--llvm/lib/Fuzzer/test/CMakeLists.txt1
-rw-r--r--llvm/lib/Fuzzer/test/fuzzer.test3
-rw-r--r--llvm/lib/Fuzzer/test/no-coverage/CMakeLists.txt16
-rw-r--r--llvm/lib/Fuzzer/test/uninstrumented/CMakeLists.txt3
4 files changed, 22 insertions, 1 deletions
diff --git a/llvm/lib/Fuzzer/test/CMakeLists.txt b/llvm/lib/Fuzzer/test/CMakeLists.txt
index 85fb62e3345..9421606aec0 100644
--- a/llvm/lib/Fuzzer/test/CMakeLists.txt
+++ b/llvm/lib/Fuzzer/test/CMakeLists.txt
@@ -149,6 +149,7 @@ else()
endif()
add_subdirectory(uninstrumented)
+add_subdirectory(no-coverage)
add_subdirectory(ubsan)
add_subdirectory(trace-bb)
add_subdirectory(trace-pc)
diff --git a/llvm/lib/Fuzzer/test/fuzzer.test b/llvm/lib/Fuzzer/test/fuzzer.test
index 25ca5ff5bd2..11343ae3834 100644
--- a/llvm/lib/Fuzzer/test/fuzzer.test
+++ b/llvm/lib/Fuzzer/test/fuzzer.test
@@ -32,6 +32,9 @@ RUN: not LLVMFuzzer-CallerCalleeTest -cross_over=0 -max_len=
RUN: not LLVMFuzzer-UninstrumentedTest-Uninstrumented 2>&1 | FileCheck %s --check-prefix=UNINSTRUMENTED
UNINSTRUMENTED: ERROR: __sanitizer_set_death_callback is not defined. Exiting.
+RUN: not LLVMFuzzer-UninstrumentedTest-NoCoverage 2>&1 | FileCheck %s --check-prefix=NO_COVERAGE
+NO_COVERAGE: ERROR: no interesting inputs were found. Is the code instrumented for coverage? Exiting
+
RUN: not LLVMFuzzer-BufferOverflowOnInput 2>&1 | FileCheck %s --check-prefix=OOB
OOB: AddressSanitizer: heap-buffer-overflow
OOB: is located 0 bytes to the right of 3-byte region
diff --git a/llvm/lib/Fuzzer/test/no-coverage/CMakeLists.txt b/llvm/lib/Fuzzer/test/no-coverage/CMakeLists.txt
new file mode 100644
index 00000000000..1dc7d15926c
--- /dev/null
+++ b/llvm/lib/Fuzzer/test/no-coverage/CMakeLists.txt
@@ -0,0 +1,16 @@
+# These tests are not instrumented with coverage,
+# but have coverage rt in the binary.
+
+set(CMAKE_CXX_FLAGS
+ "${LIBFUZZER_FLAGS_BASE} -fno-sanitize-coverage=edge,trace-cmp,indirect-calls,8bit-counters")
+
+set(NoCoverageTests
+ UninstrumentedTest
+ )
+
+foreach(Test ${NoCoverageTests})
+ add_libfuzzer_test(${Test}-NoCoverage SOURCES ../${Test}.cpp)
+endforeach()
+
+# Propagate value into parent directory
+set(TestBinaries ${TestBinaries} PARENT_SCOPE)
diff --git a/llvm/lib/Fuzzer/test/uninstrumented/CMakeLists.txt b/llvm/lib/Fuzzer/test/uninstrumented/CMakeLists.txt
index 35c96481af3..06e48985e7e 100644
--- a/llvm/lib/Fuzzer/test/uninstrumented/CMakeLists.txt
+++ b/llvm/lib/Fuzzer/test/uninstrumented/CMakeLists.txt
@@ -1,4 +1,5 @@
-# These tests are not instrumented with coverage.
+# These tests are not instrumented with coverage and don't
+# 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")
OpenPOWER on IntegriCloud