diff options
author | Kostya Serebryany <kcc@google.com> | 2016-02-12 02:32:03 +0000 |
---|---|---|
committer | Kostya Serebryany <kcc@google.com> | 2016-02-12 02:32:03 +0000 |
commit | 9d14e4bb1523f9d29ea1f26af7d0294013682cea (patch) | |
tree | 52b0cd362b8385ac0705ecc0a31886f17e2927e5 /llvm/lib/Fuzzer/test/NthRunCrashTest.cpp | |
parent | 39a84d0b9bd4865ea01e8c6d6c99d8f9d294da81 (diff) | |
download | llvm-9d14e4bb1523f9d29ea1f26af7d0294013682cea.zip llvm-9d14e4bb1523f9d29ea1f26af7d0294013682cea.tar.gz llvm-9d14e4bb1523f9d29ea1f26af7d0294013682cea.tar.bz2 |
[libFuzzer] make -runs=N flag also affect the simple runner (will execute every input N times)
llvm-svn: 260649
Diffstat (limited to 'llvm/lib/Fuzzer/test/NthRunCrashTest.cpp')
-rw-r--r-- | llvm/lib/Fuzzer/test/NthRunCrashTest.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/llvm/lib/Fuzzer/test/NthRunCrashTest.cpp b/llvm/lib/Fuzzer/test/NthRunCrashTest.cpp new file mode 100644 index 0000000..03d03d0 --- /dev/null +++ b/llvm/lib/Fuzzer/test/NthRunCrashTest.cpp @@ -0,0 +1,15 @@ +// Crash on the N-th execution. +#include <cstdint> +#include <cstddef> +#include <iostream> + +static int Counter; + +extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { + if (Counter++ == 1000) { + std::cout << "BINGO; Found the target, exiting\n"; + exit(1); + } + return 0; +} + |