From bd3306aecb3a15e8967143b8cdbbccf2b1b19b74 Mon Sep 17 00:00:00 2001 From: patrick Date: Sat, 14 Jan 2017 19:55:43 +0000 Subject: Import LLVM 3.9.1 including clang and lld. --- gnu/llvm/lib/Fuzzer/test/SimpleThreadedTest.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 gnu/llvm/lib/Fuzzer/test/SimpleThreadedTest.cpp (limited to 'gnu/llvm/lib/Fuzzer/test/SimpleThreadedTest.cpp') diff --git a/gnu/llvm/lib/Fuzzer/test/SimpleThreadedTest.cpp b/gnu/llvm/lib/Fuzzer/test/SimpleThreadedTest.cpp new file mode 100644 index 00000000000..5f02d3f8457 --- /dev/null +++ b/gnu/llvm/lib/Fuzzer/test/SimpleThreadedTest.cpp @@ -0,0 +1,25 @@ +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. + +// Threaded test for a fuzzer. The fuzzer should find "H" +#include +#include +#include +#include +#include +#include + +extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { + auto C = [&] { + if (Size >= 2 && Data[0] == 'H') { + std::cout << "BINGO; Found the target, exiting\n"; + abort(); + } + }; + std::thread T[] = {std::thread(C), std::thread(C), std::thread(C), + std::thread(C), std::thread(C), std::thread(C)}; + for (auto &X : T) + X.join(); + return 0; +} + -- cgit v1.2.3-59-g8ed1b