mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-10-19 02:52:53 +02:00
[libFuzzer] make one test faster, fix compiler warnings in tests
llvm-svn: 308945
This commit is contained in:
parent
7f64536d37
commit
b2de8fb7b9
@ -8,7 +8,7 @@
|
|||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
|
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)) {
|
if (Size >= 6 && !memcmp(S, "qwerty", 6)) {
|
||||||
fprintf(stderr, "BINGO\n");
|
fprintf(stderr, "BINGO\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
|
@ -13,7 +13,7 @@ bool Eq(const uint8_t *Data, size_t Size, const char *Str) {
|
|||||||
size_t Len = strlen(Str);
|
size_t Len = strlen(Str);
|
||||||
if (Size < Len) return false;
|
if (Size < Len) return false;
|
||||||
if (Len >= sizeof(Buff)) return false;
|
if (Len >= sizeof(Buff)) return false;
|
||||||
memcpy(Buff, (char*)Data, Len);
|
memcpy(Buff, (const char*)Data, Len);
|
||||||
Buff[Len] = 0;
|
Buff[Len] = 0;
|
||||||
int res = strcmp(Buff, Str);
|
int res = strcmp(Buff, Str);
|
||||||
return res == 0;
|
return res == 0;
|
||||||
|
@ -11,7 +11,7 @@ static volatile int sink;
|
|||||||
|
|
||||||
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
|
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
|
||||||
// TODO: check other sizes.
|
// TODO: check other sizes.
|
||||||
char *S = (char*)Data;
|
const char *S = (const char*)Data;
|
||||||
if (Size >= 8 && strncmp(S, "123", 8))
|
if (Size >= 8 && strncmp(S, "123", 8))
|
||||||
sink = 1;
|
sink = 1;
|
||||||
if (Size >= 8 && strncmp(S, "01234567", 8) == 0) {
|
if (Size >= 8 && strncmp(S, "01234567", 8) == 0) {
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
CHECK: BINGO
|
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
Block a user