diff options
author | Matt Morehouse <mascasa@google.com> | 2017-07-20 20:43:39 +0000 |
---|---|---|
committer | Matt Morehouse <mascasa@google.com> | 2017-07-20 20:43:39 +0000 |
commit | 9e689792b23b017507955dba1a0d21b239d4b869 (patch) | |
tree | 4f9c3fb6fa5cdf34aa510b6456939ffed92e3d89 /llvm/lib/Fuzzer/test/SimpleTest.cpp | |
parent | 0c8d26c312f62347e1640384c9a42fce97c2c657 (diff) | |
download | bcm5719-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/SimpleTest.cpp')
-rw-r--r-- | llvm/lib/Fuzzer/test/SimpleTest.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/Fuzzer/test/SimpleTest.cpp b/llvm/lib/Fuzzer/test/SimpleTest.cpp index a8b4988dff1..3882a842b88 100644 --- a/llvm/lib/Fuzzer/test/SimpleTest.cpp +++ b/llvm/lib/Fuzzer/test/SimpleTest.cpp @@ -7,6 +7,7 @@ #include <cstdint> #include <cstdlib> #include <iostream> +#include <ostream> static volatile int Sink; @@ -17,7 +18,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(0); } } |