summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Fuzzer/test/CustomMutatorTest.cpp
diff options
context:
space:
mode:
authorMatt Morehouse <mascasa@google.com>2017-07-20 20:43:39 +0000
committerMatt Morehouse <mascasa@google.com>2017-07-20 20:43:39 +0000
commit9e689792b23b017507955dba1a0d21b239d4b869 (patch)
tree4f9c3fb6fa5cdf34aa510b6456939ffed92e3d89 /llvm/lib/Fuzzer/test/CustomMutatorTest.cpp
parent0c8d26c312f62347e1640384c9a42fce97c2c657 (diff)
downloadbcm5719-llvm-9e689792b23b017507955dba1a0d21b239d4b869.tar.gz
bcm5719-llvm-9e689792b23b017507955dba1a0d21b239d4b869.zip
Generate error reports when a fuzz target exits.
Summary: Implements https://github.com/google/sanitizers/issues/835. Flush stdout before exiting in test cases. Since the atexit hook is used for exit reports, pending prints to stdout can be lost if they aren't flushed before calling exit(). Expect tests to have non-zero exit code if exit() is called. Reviewers: vitalybuka, kcc Reviewed By: kcc Subscribers: eraman, llvm-commits, hiraditya Differential Revision: https://reviews.llvm.org/D35602 llvm-svn: 308669
Diffstat (limited to 'llvm/lib/Fuzzer/test/CustomMutatorTest.cpp')
-rw-r--r--llvm/lib/Fuzzer/test/CustomMutatorTest.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/Fuzzer/test/CustomMutatorTest.cpp b/llvm/lib/Fuzzer/test/CustomMutatorTest.cpp
index 521d7f506b4..b2adb94082d 100644
--- a/llvm/lib/Fuzzer/test/CustomMutatorTest.cpp
+++ b/llvm/lib/Fuzzer/test/CustomMutatorTest.cpp
@@ -7,6 +7,7 @@
#include <cstdint>
#include <cstdlib>
#include <iostream>
+#include <ostream>
#include "FuzzerInterface.h"
@@ -19,7 +20,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
if (Size > 1 && Data[1] == 'i') {
Sink = 2;
if (Size > 2 && Data[2] == '!') {
- std::cout << "BINGO; Found the target, exiting\n";
+ std::cout << "BINGO; Found the target, exiting\n" << std::flush;
exit(1);
}
}
OpenPOWER on IntegriCloud