mirror of
https://github.com/RPCSX/llvm.git
synced 2025-02-03 19:15:30 +00:00
[libFuzzer] add a test that is built w/o coverage instrumentation but has the coverage rt (it should now fail with a descriptive message)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272090 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
9f5007947e
commit
fd9cb1a5c5
@ -391,6 +391,11 @@ void Fuzzer::ShuffleAndMinimize() {
|
||||
for (auto &X : Corpus)
|
||||
UnitHashesAddedToCorpus.insert(Hash(X));
|
||||
PrintStats("INITED");
|
||||
if (Corpus.empty()) {
|
||||
Printf("ERROR: no interesting inputs were found. "
|
||||
"Is the code instrumented for coverage? Exiting.\n");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
bool Fuzzer::UpdateMaxCoverage() {
|
||||
|
@ -149,6 +149,7 @@ else()
|
||||
endif()
|
||||
|
||||
add_subdirectory(uninstrumented)
|
||||
add_subdirectory(no-coverage)
|
||||
add_subdirectory(ubsan)
|
||||
add_subdirectory(trace-bb)
|
||||
add_subdirectory(trace-pc)
|
||||
|
@ -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
|
||||
|
16
lib/Fuzzer/test/no-coverage/CMakeLists.txt
Normal file
16
lib/Fuzzer/test/no-coverage/CMakeLists.txt
Normal file
@ -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)
|
@ -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")
|
||||
|
Loading…
x
Reference in New Issue
Block a user