forked from OSchip/llvm-project
[libFuzzer] re-enable LLVMFuzzer-RepeatedMemcmp test, cleanup the test runner nearby
llvm-svn: 292683
This commit is contained in:
parent
26c353835f
commit
59e1df524f
|
@ -8,13 +8,16 @@
|
|||
#include <cstdlib>
|
||||
|
||||
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
|
||||
int Matches = 0;
|
||||
for (size_t i = 0; i + 2 < Size; i += 3) {
|
||||
const char *Pat = i % 2 ? "foo" : "bar";
|
||||
if (!memcmp(Data + i, Pat, 3))
|
||||
Matches++;
|
||||
}
|
||||
if (Matches > 20) {
|
||||
int Matches1 = 0;
|
||||
for (size_t i = 0; i + 2 < Size; i += 3)
|
||||
if (!memcmp(Data + i, "foo", 3))
|
||||
Matches1++;
|
||||
int Matches2 = 0;
|
||||
for (size_t i = 0; i + 2 < Size; i += 3)
|
||||
if (!memcmp(Data + i, "bar", 3))
|
||||
Matches2++;
|
||||
|
||||
if (Matches1 > 10 && Matches2 > 10) {
|
||||
fprintf(stderr, "BINGO!\n");
|
||||
exit(1);
|
||||
}
|
||||
|
|
|
@ -3,21 +3,13 @@
|
|||
// than linux
|
||||
REQUIRES: linux
|
||||
CHECK: BINGO
|
||||
Done1000000: Done 1000000 runs in
|
||||
|
||||
RUN: not LLVMFuzzer-MemcmpTest -seed=1 -runs=1000000 2>&1 | FileCheck %s
|
||||
ZZZ: LLVMFuzzer-MemcmpTest -use_memcmp=0 -seed=4294967295 -runs=1000000 2>&1 | FileCheck %s --check-prefix=Done1000000
|
||||
RUN: not LLVMFuzzer-MemcmpTest -seed=1 -runs=2000000 2>&1 | FileCheck %s
|
||||
RUN: not LLVMFuzzer-StrncmpTest -seed=1 -runs=2000000 2>&1 | FileCheck %s
|
||||
RUN: not LLVMFuzzer-StrcmpTest -seed=1 -runs=2000000 2>&1 | FileCheck %s
|
||||
RUN: not LLVMFuzzer-StrstrTest -seed=1 -runs=2000000 2>&1 | FileCheck %s
|
||||
|
||||
RUN: not LLVMFuzzer-StrncmpTest -seed=2 -runs=1000000 2>&1 | FileCheck %s
|
||||
ZZZ: LLVMFuzzer-StrncmpTest -use_memcmp=0 -seed=3 -runs=1000000 2>&1 | FileCheck %s --check-prefix=Done1000000
|
||||
|
||||
RUN: not LLVMFuzzer-StrcmpTest -seed=4 -runs=1000000 2>&1 | FileCheck %s
|
||||
ZZZ: LLVMFuzzer-StrcmpTest -use_memcmp=0 -seed=5 -runs=1000000 2>&1 | FileCheck %s --check-prefix=Done1000000
|
||||
|
||||
RUN: not LLVMFuzzer-StrstrTest -seed=6 -runs=200000 2>&1 | FileCheck %s
|
||||
ZZZ: LLVMFuzzer-StrstrTest -use_memmem=0 -seed=7 -runs=1000000 2>&1 | FileCheck %s --check-prefix=Done1000000
|
||||
|
||||
DISABLED: LLVMFuzzer-RepeatedMemcmp -seed=11 -runs=100000 2>&1 | FileCheck %s --check-prefix=RECOMMENDED_DICT
|
||||
RUN: LLVMFuzzer-RepeatedMemcmp -seed=11 -runs=100000 2>&1 | FileCheck %s --check-prefix=RECOMMENDED_DICT
|
||||
RECOMMENDED_DICT:###### Recommended dictionary. ######
|
||||
RECOMMENDED_DICT-DAG: "foo"
|
||||
RECOMMENDED_DICT-DAG: "bar"
|
||||
|
|
Loading…
Reference in New Issue