diff options
author | Kostya Serebryany <kcc@google.com> | 2016-03-18 20:58:29 +0000 |
---|---|---|
committer | Kostya Serebryany <kcc@google.com> | 2016-03-18 20:58:29 +0000 |
commit | 49e409068af85ba10e9b08bdc1d2d5f3b345c1e7 (patch) | |
tree | eae319c59138416a0739d33e57e4a4c4cd010d4f /llvm/lib/Fuzzer/test/SpamyTest.cpp | |
parent | 5ba3d3e632fbc30edf9cc2eae4715c28b1a4ffb7 (diff) | |
download | bcm5719-llvm-49e409068af85ba10e9b08bdc1d2d5f3b345c1e7.tar.gz bcm5719-llvm-49e409068af85ba10e9b08bdc1d2d5f3b345c1e7.zip |
[libFuzzer] add a flag close_fd_mask so that we can silence spammy targets by closing stderr/stdout
llvm-svn: 263831
Diffstat (limited to 'llvm/lib/Fuzzer/test/SpamyTest.cpp')
-rw-r--r-- | llvm/lib/Fuzzer/test/SpamyTest.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/llvm/lib/Fuzzer/test/SpamyTest.cpp b/llvm/lib/Fuzzer/test/SpamyTest.cpp new file mode 100644 index 00000000000..63776d6dfb9 --- /dev/null +++ b/llvm/lib/Fuzzer/test/SpamyTest.cpp @@ -0,0 +1,18 @@ +// The test spams to stderr and stdout. +#include <assert.h> +#include <cstdint> +#include <cstdio> +#include <cstddef> +#include <iostream> + +extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { + assert(Data); + printf("PRINTF_STDOUT\n"); + fflush(stdout); + fprintf(stderr, "PRINTF_STDERR\n"); + std::cout << "STREAM_COUT\n"; + std::cout.flush(); + std::cerr << "STREAM_CERR\n"; + return 0; +} + |