summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Fuzzer/test/DFSanMemcmpTest.cpp
diff options
context:
space:
mode:
authorKostya Serebryany <kcc@google.com>2015-05-08 21:45:19 +0000
committerKostya Serebryany <kcc@google.com>2015-05-08 21:45:19 +0000
commitf3f3ed323acae3e4a6a558d8fa338c717ad5db58 (patch)
treefd2fe12d73d4506519632eafcff36c945a1b6f57 /llvm/lib/Fuzzer/test/DFSanMemcmpTest.cpp
parenta7046002959f3e1fad47b028b51756084934934c (diff)
downloadbcm5719-llvm-f3f3ed323acae3e4a6a558d8fa338c717ad5db58.tar.gz
bcm5719-llvm-f3f3ed323acae3e4a6a558d8fa338c717ad5db58.zip
[lib/Fuzzer] build tests that work well with dfsan also w/o dfsan
llvm-svn: 236909
Diffstat (limited to 'llvm/lib/Fuzzer/test/DFSanMemcmpTest.cpp')
-rw-r--r--llvm/lib/Fuzzer/test/DFSanMemcmpTest.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/llvm/lib/Fuzzer/test/DFSanMemcmpTest.cpp b/llvm/lib/Fuzzer/test/DFSanMemcmpTest.cpp
new file mode 100644
index 00000000000..510a2439800
--- /dev/null
+++ b/llvm/lib/Fuzzer/test/DFSanMemcmpTest.cpp
@@ -0,0 +1,12 @@
+// Simple test for a fuzzer. The fuzzer must find a particular string.
+#include <cstring>
+#include <cstdint>
+#include <cstdio>
+#include <cstdlib>
+
+extern "C" void LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
+ if (Size >= 8 && memcmp(Data, "01234567", 8) == 0) {
+ fprintf(stderr, "BINGO\n");
+ exit(1);
+ }
+}
OpenPOWER on IntegriCloud