From 10ab2ace1359fd96cd662ad235797e29f9ba3daa Mon Sep 17 00:00:00 2001 From: George Karpenkov Date: Mon, 21 Aug 2017 23:25:50 +0000 Subject: Move libFuzzer to compiler_rt. Resulting library binaries will be named libclang_rt.fuzzer*, and will be placed in Clang toolchain, allowing redistribution. Differential Revision: https://reviews.llvm.org/D36908 llvm-svn: 311407 --- compiler-rt/test/fuzzer/CounterTest.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 compiler-rt/test/fuzzer/CounterTest.cpp (limited to 'compiler-rt/test/fuzzer/CounterTest.cpp') diff --git a/compiler-rt/test/fuzzer/CounterTest.cpp b/compiler-rt/test/fuzzer/CounterTest.cpp new file mode 100644 index 00000000000..4917934c62e --- /dev/null +++ b/compiler-rt/test/fuzzer/CounterTest.cpp @@ -0,0 +1,18 @@ +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. + +// Test for a fuzzer: must find the case where a particular basic block is +// executed many times. +#include + +extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { + int Num = 0; + for (size_t i = 0; i < Size; i++) + if (Data[i] == 'A' + i) + Num++; + if (Num >= 4) { + std::cerr << "BINGO!\n"; + exit(1); + } + return 0; +} -- cgit v1.2.3