[libFuzzer] make one test faster, fix compiler warnings in tests

llvm-svn: 308945
This commit is contained in:
Kostya Serebryany 2017-07-25 02:09:46 +00:00
parent c485ca05ac
commit 6f7befd10f
4 changed files with 4 additions and 4 deletions

View File

@ -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);

View File

@ -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;

View File

@ -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) {

View File

@ -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