Debian Codegraph @

tests/thirdparty/Fuzzer/test/SimpleThreadedTest.cpp

raw symbols SCIP
1 // This file is distributed under the University of Illinois Open Source
2 // License. See LICENSE.TXT for details.
3
4 // Threaded test for a fuzzer. The fuzzer should find "H"
5 #include <assert.h>
6 #include <cstdint>
7 #include <cstddef>
8 #include <cstring>
9 #include <iostream>
10 #include <thread>
11
12 extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
13 auto C = [&] {
14 if (Size >= 2 && Data[0] == 'H') {
15 std::cout << "BINGO; Found the target, exiting\n";
16 abort();
17 }
18 };
19 std::thread T[] = {std::thread(C), std::thread(C), std::thread(C),
20 std::thread(C), std::thread(C), std::thread(C)};
21 for (auto &X : T)
22 X.join();
23 return 0;
24 }
25