[llvm] r308553 - [libFuzzer] change several tests to not limit the max len: with reduce_inputs=1 they are now fast enough even w/o this
Kostya Serebryany via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 19 16:45:46 PDT 2017
Author: kcc
Date: Wed Jul 19 16:45:46 2017
New Revision: 308553
URL: http://llvm.org/viewvc/llvm-project?rev=308553&view=rev
Log:
[libFuzzer] change several tests to not limit the max len: with reduce_inputs=1 they are now fast enough even w/o this
Modified:
llvm/trunk/lib/Fuzzer/test/AbsNegAndConstant64Test.cpp
llvm/trunk/lib/Fuzzer/test/FourIndependentBranchesTest.cpp
llvm/trunk/lib/Fuzzer/test/ShrinkControlFlowTest.cpp
llvm/trunk/lib/Fuzzer/test/SimpleHashTest.cpp
llvm/trunk/lib/Fuzzer/test/SingleStrncmpTest.cpp
llvm/trunk/lib/Fuzzer/test/shrink.test
Modified: llvm/trunk/lib/Fuzzer/test/AbsNegAndConstant64Test.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/test/AbsNegAndConstant64Test.cpp?rev=308553&r1=308552&r2=308553&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/test/AbsNegAndConstant64Test.cpp (original)
+++ llvm/trunk/lib/Fuzzer/test/AbsNegAndConstant64Test.cpp Wed Jul 19 16:45:46 2017
@@ -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));
Modified: llvm/trunk/lib/Fuzzer/test/FourIndependentBranchesTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/test/FourIndependentBranchesTest.cpp?rev=308553&r1=308552&r2=308553&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/test/FourIndependentBranchesTest.cpp (original)
+++ llvm/trunk/lib/Fuzzer/test/FourIndependentBranchesTest.cpp Wed Jul 19 16:45:46 2017
@@ -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;
Modified: llvm/trunk/lib/Fuzzer/test/ShrinkControlFlowTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/test/ShrinkControlFlowTest.cpp?rev=308553&r1=308552&r2=308553&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/test/ShrinkControlFlowTest.cpp (original)
+++ llvm/trunk/lib/Fuzzer/test/ShrinkControlFlowTest.cpp Wed Jul 19 16:45:46 2017
@@ -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++)
Modified: llvm/trunk/lib/Fuzzer/test/SimpleHashTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/test/SimpleHashTest.cpp?rev=308553&r1=308552&r2=308553&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/test/SimpleHashTest.cpp (original)
+++ llvm/trunk/lib/Fuzzer/test/SimpleHashTest.cpp Wed Jul 19 16:45:46 2017
@@ -26,7 +26,7 @@ static uint32_t simple_hash(const uint8_
}
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);
Modified: llvm/trunk/lib/Fuzzer/test/SingleStrncmpTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/test/SingleStrncmpTest.cpp?rev=308553&r1=308552&r2=308553&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/test/SingleStrncmpTest.cpp (original)
+++ llvm/trunk/lib/Fuzzer/test/SingleStrncmpTest.cpp Wed Jul 19 16:45:46 2017
@@ -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");
Modified: llvm/trunk/lib/Fuzzer/test/shrink.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/test/shrink.test?rev=308553&r1=308552&r2=308553&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/test/shrink.test (original)
+++ llvm/trunk/lib/Fuzzer/test/shrink.test Wed Jul 19 16:45:46 2017
@@ -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
More information about the llvm-commits
mailing list