summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Fuzzer/test
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Fuzzer/test')
-rw-r--r--llvm/lib/Fuzzer/test/CMakeLists.txt3
-rw-r--r--llvm/lib/Fuzzer/test/ShrinkControlFlowTest.cpp (renamed from llvm/lib/Fuzzer/test/MinimizeCorpusTest.cpp)0
-rw-r--r--llvm/lib/Fuzzer/test/ShrinkValueProfileTest.cpp21
-rw-r--r--llvm/lib/Fuzzer/test/fuzzer.test2
-rw-r--r--llvm/lib/Fuzzer/test/trace-pc/CMakeLists.txt3
5 files changed, 26 insertions, 3 deletions
diff --git a/llvm/lib/Fuzzer/test/CMakeLists.txt b/llvm/lib/Fuzzer/test/CMakeLists.txt
index bf8e55274bb..d2ccc23fa17 100644
--- a/llvm/lib/Fuzzer/test/CMakeLists.txt
+++ b/llvm/lib/Fuzzer/test/CMakeLists.txt
@@ -80,7 +80,6 @@ set(Tests
LeakTest
LeakTimeoutTest
LoadTest
- MinimizeCorpusTest
NullDerefTest
NullDerefOnEmptyTest
NthRunCrashTest
@@ -98,6 +97,8 @@ set(Tests
SingleStrcmpTest
SingleStrncmpTest
SpamyTest
+ ShrinkControlFlowTest
+ ShrinkValueProfileTest
StrcmpTest
StrncmpTest
StrstrTest
diff --git a/llvm/lib/Fuzzer/test/MinimizeCorpusTest.cpp b/llvm/lib/Fuzzer/test/ShrinkControlFlowTest.cpp
index 2fa17f156e2..2fa17f156e2 100644
--- a/llvm/lib/Fuzzer/test/MinimizeCorpusTest.cpp
+++ b/llvm/lib/Fuzzer/test/ShrinkControlFlowTest.cpp
diff --git a/llvm/lib/Fuzzer/test/ShrinkValueProfileTest.cpp b/llvm/lib/Fuzzer/test/ShrinkValueProfileTest.cpp
new file mode 100644
index 00000000000..9ff5b19c7b6
--- /dev/null
+++ b/llvm/lib/Fuzzer/test/ShrinkValueProfileTest.cpp
@@ -0,0 +1,21 @@
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+
+// Test that we can find the minimal item in the corpus (3 bytes: "FUZ").
+#include <cstdint>
+#include <cstdlib>
+#include <cstddef>
+#include <cstring>
+#include <cstdio>
+
+static volatile uint32_t Sink;
+
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
+ if (Size < sizeof(uint32_t)) return 0;
+ uint32_t X;
+ size_t Offset = Size < 8 ? 0 : Size / 2;
+ memcpy(&X, Data + Offset, sizeof(uint32_t));
+ Sink = X == 0xAABBCCDD;
+ return 0;
+}
+
diff --git a/llvm/lib/Fuzzer/test/fuzzer.test b/llvm/lib/Fuzzer/test/fuzzer.test
index b48d734ef67..98139c09d6f 100644
--- a/llvm/lib/Fuzzer/test/fuzzer.test
+++ b/llvm/lib/Fuzzer/test/fuzzer.test
@@ -54,6 +54,6 @@ DSO: INFO: Loaded 3 modules
DSO: BINGO
RUN: LLVMFuzzer-SimpleTest-TracePC -exit_on_src_pos=SimpleTest.cpp:17 2>&1 | FileCheck %s --check-prefix=EXIT_ON_SRC_POS
-RUN: LLVMFuzzer-MinimizeCorpusTest-TracePC -exit_on_src_pos=MinimizeCorpusTest.cpp:23 2>&1 | FileCheck %s --check-prefix=EXIT_ON_SRC_POS
+RUN: LLVMFuzzer-ShrinkControlFlowTest-TracePC -exit_on_src_pos=ShrinkControlFlowTest.cpp:23 2>&1 | FileCheck %s --check-prefix=EXIT_ON_SRC_POS
EXIT_ON_SRC_POS: INFO: found line matching '{{.*}}', exiting.
diff --git a/llvm/lib/Fuzzer/test/trace-pc/CMakeLists.txt b/llvm/lib/Fuzzer/test/trace-pc/CMakeLists.txt
index 3def7271424..a1eeb7263c0 100644
--- a/llvm/lib/Fuzzer/test/trace-pc/CMakeLists.txt
+++ b/llvm/lib/Fuzzer/test/trace-pc/CMakeLists.txt
@@ -8,7 +8,8 @@ set(TracePCTests
CounterTest
CallerCalleeTest
NullDerefTest
- MinimizeCorpusTest
+ ShrinkControlFlowTest
+ ShrinkValueProfileTest
FullCoverageSetTest
)
OpenPOWER on IntegriCloud