summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMatt Morehouse <mascasa@google.com>2017-11-09 20:44:08 +0000
committerMatt Morehouse <mascasa@google.com>2017-11-09 20:44:08 +0000
commit8630529c291d7974dca280343e1f73321b6c6ad8 (patch)
tree73f3ef02f45ac9e048652f51473c2ca331c24950 /test
parent5646b9ef2068f1577569226326f62d90e2de5f09 (diff)
[libFuzzer] Don't add leaking inputs to corpus.
Reviewers: kcc Reviewed By: kcc Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D39850 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@317831 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r--test/fuzzer/fuzzer-leak.test6
1 files changed, 5 insertions, 1 deletions
diff --git a/test/fuzzer/fuzzer-leak.test b/test/fuzzer/fuzzer-leak.test
index f8e99ce3f..0652a88f9 100644
--- a/test/fuzzer/fuzzer-leak.test
+++ b/test/fuzzer/fuzzer-leak.test
@@ -3,7 +3,8 @@ RUN: %cpp_compiler %S/LeakTest.cpp -o %t-LeakTest
RUN: %cpp_compiler %S/ThreadedLeakTest.cpp -o %t-ThreadedLeakTest
RUN: %cpp_compiler %S/LeakTimeoutTest.cpp -o %t-LeakTimeoutTest
-RUN: not %t-LeakTest -runs=100000 -detect_leaks=1 2>&1 | FileCheck %s --check-prefix=LEAK_DURING
+RUN: rm -rf %t-corpus && mkdir -p %t-corpus
+RUN: not %t-LeakTest -runs=100000 -detect_leaks=1 %t-corpus 2>&1 | FileCheck %s --check-prefix=LEAK_DURING
LEAK_DURING: ERROR: LeakSanitizer: detected memory leaks
LEAK_DURING: Direct leak of 4 byte(s) in 1 object(s) allocated from:
LEAK_DURING: INFO: to ignore leaks on libFuzzer side use -detect_leaks=0
@@ -11,6 +12,9 @@ LEAK_DURING: Test unit written to ./leak-
LEAK_DURING-NOT: DONE
LEAK_DURING-NOT: Done
+// Verify leaking input was not added to corpus
+RUN: %t-LeakTest -runs=0 %t-corpus
+
RUN: not %t-LeakTest -runs=0 -detect_leaks=1 %S 2>&1 | FileCheck %s --check-prefix=LEAK_IN_CORPUS
LEAK_IN_CORPUS: ERROR: LeakSanitizer: detected memory leaks
LEAK_IN_CORPUS: INFO: a leak has been found in the initial corpus.