[libFuzzer] make one test faster, fix compiler warnings in tests
llvm-svn: 308945
This commit is contained in:
parent
c485ca05ac
commit
6f7befd10f
|
@ -8,7 +8,7 @@
|
|||
#include <cstring>
|
||||
|
||||
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
|
||||
char *S = (char*)Data;
|
||||
const char *S = (const char*)Data;
|
||||
if (Size >= 6 && !memcmp(S, "qwerty", 6)) {
|
||||
fprintf(stderr, "BINGO\n");
|
||||
exit(1);
|
||||
|
|
|
@ -13,7 +13,7 @@ bool Eq(const uint8_t *Data, size_t Size, const char *Str) {
|
|||
size_t Len = strlen(Str);
|
||||
if (Size < Len) return false;
|
||||
if (Len >= sizeof(Buff)) return false;
|
||||
memcpy(Buff, (char*)Data, Len);
|
||||
memcpy(Buff, (const char*)Data, Len);
|
||||
Buff[Len] = 0;
|
||||
int res = strcmp(Buff, Str);
|
||||
return res == 0;
|
||||
|
|
|
@ -11,7 +11,7 @@ static volatile int sink;
|
|||
|
||||
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
|
||||
// TODO: check other sizes.
|
||||
char *S = (char*)Data;
|
||||
const char *S = (const char*)Data;
|
||||
if (Size >= 8 && strncmp(S, "123", 8))
|
||||
sink = 1;
|
||||
if (Size >= 8 && strncmp(S, "01234567", 8) == 0) {
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
CHECK: BINGO
|
||||
RUN: not LLVMFuzzer-SimpleHashTest -seed=1 -use_cmp=0 -use_value_profile=1 -runs=100000000 2>&1 | FileCheck %s
|
||||
RUN: not LLVMFuzzer-SimpleHashTest -seed=1 -use_cmp=0 -use_value_profile=1 -runs=100000000 -max_len=64 2>&1 | FileCheck %s
|
||||
|
|
Loading…
Reference in New Issue