summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Fuzzer
diff options
context:
space:
mode:
authorKostya Serebryany <kcc@google.com>2017-07-19 23:45:46 +0000
committerKostya Serebryany <kcc@google.com>2017-07-19 23:45:46 +0000
commita168af7b5fa5143e511aac50fe3782f8da12ab3a (patch)
tree4e109a34f561f86de3a1afbd79e6cf89e059763b /llvm/lib/Fuzzer
parent388f88070eaefaab233f7aeaca98987fd7b042b0 (diff)
downloadbcm5719-llvm-a168af7b5fa5143e511aac50fe3782f8da12ab3a.tar.gz
bcm5719-llvm-a168af7b5fa5143e511aac50fe3782f8da12ab3a.zip
[libFuzzer] change several tests to not limit the max len: with reduce_inputs=1 they are now fast enough even w/o this
llvm-svn: 308553
Diffstat (limited to 'llvm/lib/Fuzzer')
-rw-r--r--llvm/lib/Fuzzer/test/AbsNegAndConstant64Test.cpp2
-rw-r--r--llvm/lib/Fuzzer/test/FourIndependentBranchesTest.cpp1
-rw-r--r--llvm/lib/Fuzzer/test/ShrinkControlFlowTest.cpp1
-rw-r--r--llvm/lib/Fuzzer/test/SimpleHashTest.cpp2
-rw-r--r--llvm/lib/Fuzzer/test/SingleStrncmpTest.cpp3
-rw-r--r--llvm/lib/Fuzzer/test/shrink.test3
6 files changed, 5 insertions, 7 deletions
diff --git a/llvm/lib/Fuzzer/test/AbsNegAndConstant64Test.cpp b/llvm/lib/Fuzzer/test/AbsNegAndConstant64Test.cpp
index b5a61ddca71..dfb6007b797 100644
--- a/llvm/lib/Fuzzer/test/AbsNegAndConstant64Test.cpp
+++ b/llvm/lib/Fuzzer/test/AbsNegAndConstant64Test.cpp
@@ -9,7 +9,7 @@
#include <cstring>
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
- if (Size < 16 || Size > 64) return 0;
+ if (Size < 16) return 0;
int64_t x;
uint64_t y;
memcpy(&x, Data, sizeof(x));
diff --git a/llvm/lib/Fuzzer/test/FourIndependentBranchesTest.cpp b/llvm/lib/Fuzzer/test/FourIndependentBranchesTest.cpp
index ba963d9b1de..bbf5ea235c7 100644
--- a/llvm/lib/Fuzzer/test/FourIndependentBranchesTest.cpp
+++ b/llvm/lib/Fuzzer/test/FourIndependentBranchesTest.cpp
@@ -8,7 +8,6 @@
#include <iostream>
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
- if (Size > 64) return 0;
int bits = 0;
if (Size > 0 && Data[0] == 'F') bits |= 1;
if (Size > 1 && Data[1] == 'U') bits |= 2;
diff --git a/llvm/lib/Fuzzer/test/ShrinkControlFlowTest.cpp b/llvm/lib/Fuzzer/test/ShrinkControlFlowTest.cpp
index 37eeede7cbf..d0954296362 100644
--- a/llvm/lib/Fuzzer/test/ShrinkControlFlowTest.cpp
+++ b/llvm/lib/Fuzzer/test/ShrinkControlFlowTest.cpp
@@ -11,7 +11,6 @@
static volatile int Sink;
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
- if (Size > 64) return 0;
int8_t Ids[256];
memset(Ids, -1, sizeof(Ids));
for (size_t i = 0; i < Size; i++)
diff --git a/llvm/lib/Fuzzer/test/SimpleHashTest.cpp b/llvm/lib/Fuzzer/test/SimpleHashTest.cpp
index a3f4211ebee..99e96cb25dc 100644
--- a/llvm/lib/Fuzzer/test/SimpleHashTest.cpp
+++ b/llvm/lib/Fuzzer/test/SimpleHashTest.cpp
@@ -26,7 +26,7 @@ static uint32_t simple_hash(const uint8_t *Data, size_t Size) {
}
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
- if (Size < 14 || Size > 64)
+ if (Size < 14)
return 0;
uint32_t Hash = simple_hash(&Data[0], Size - 4);
diff --git a/llvm/lib/Fuzzer/test/SingleStrncmpTest.cpp b/llvm/lib/Fuzzer/test/SingleStrncmpTest.cpp
index b38c7995d8f..47298763f28 100644
--- a/llvm/lib/Fuzzer/test/SingleStrncmpTest.cpp
+++ b/llvm/lib/Fuzzer/test/SingleStrncmpTest.cpp
@@ -8,8 +8,7 @@
#include <cstring>
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
- if (Size > 64) return 0;
- char *S = (char*)Data;
+ const char *S = (const char*)Data;
volatile auto Strncmp = &(strncmp); // Make sure strncmp is not inlined.
if (Size >= 6 && !Strncmp(S, "qwerty", 6)) {
fprintf(stderr, "BINGO\n");
diff --git a/llvm/lib/Fuzzer/test/shrink.test b/llvm/lib/Fuzzer/test/shrink.test
index 79355a8f71a..b58aa80e470 100644
--- a/llvm/lib/Fuzzer/test/shrink.test
+++ b/llvm/lib/Fuzzer/test/shrink.test
@@ -1,5 +1,6 @@
RUN: LLVMFuzzer-ShrinkControlFlowTest -seed=1 -exit_on_item=0eb8e4ed029b774d80f2b66408203801cb982a60 -runs=1000000 -shrink=1 -reduce_inputs=0 2>&1 | FileCheck %s --check-prefix=SHRINK1
-RUN: LLVMFuzzer-ShrinkControlFlowTest -seed=1 -exit_on_item=0eb8e4ed029b774d80f2b66408203801cb982a60 -runs=1000000 -shrink=0 -reduce_inputs=0 2>&1 | FileCheck %s --check-prefix=SHRINK0
+# Limit max_len to run this negative test faster.
+RUN: LLVMFuzzer-ShrinkControlFlowTest -seed=1 -exit_on_item=0eb8e4ed029b774d80f2b66408203801cb982a60 -runs=1000000 -shrink=0 -reduce_inputs=0 -max_len=64 2>&1 | FileCheck %s --check-prefix=SHRINK0
RUN: LLVMFuzzer-ShrinkValueProfileTest -seed=1 -exit_on_item=aea2e3923af219a8956f626558ef32f30a914ebc -runs=100000 -shrink=1 -reduce_inputs=0 -use_value_profile=1 2>&1 | FileCheck %s --check-prefix=SHRINK1_VP
SHRINK0: Done 1000000 runs in
OpenPOWER on IntegriCloud