[llvm] r308945 - [libFuzzer] make one test faster, fix compiler warnings in tests
Kostya Serebryany via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 24 19:09:46 PDT 2017
Author: kcc
Date: Mon Jul 24 19:09:46 2017
New Revision: 308945
URL: http://llvm.org/viewvc/llvm-project?rev=308945&view=rev
Log:
[libFuzzer] make one test faster, fix compiler warnings in tests
Modified:
llvm/trunk/lib/Fuzzer/test/SingleMemcmpTest.cpp
llvm/trunk/lib/Fuzzer/test/StrcmpTest.cpp
llvm/trunk/lib/Fuzzer/test/StrncmpTest.cpp
llvm/trunk/lib/Fuzzer/test/value-profile-cmp2.test
Modified: llvm/trunk/lib/Fuzzer/test/SingleMemcmpTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/test/SingleMemcmpTest.cpp?rev=308945&r1=308944&r2=308945&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/test/SingleMemcmpTest.cpp (original)
+++ llvm/trunk/lib/Fuzzer/test/SingleMemcmpTest.cpp Mon Jul 24 19:09:46 2017
@@ -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);
Modified: llvm/trunk/lib/Fuzzer/test/StrcmpTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/test/StrcmpTest.cpp?rev=308945&r1=308944&r2=308945&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/test/StrcmpTest.cpp (original)
+++ llvm/trunk/lib/Fuzzer/test/StrcmpTest.cpp Mon Jul 24 19:09:46 2017
@@ -13,7 +13,7 @@ bool Eq(const uint8_t *Data, size_t Size
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;
Modified: llvm/trunk/lib/Fuzzer/test/StrncmpTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/test/StrncmpTest.cpp?rev=308945&r1=308944&r2=308945&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/test/StrncmpTest.cpp (original)
+++ llvm/trunk/lib/Fuzzer/test/StrncmpTest.cpp Mon Jul 24 19:09:46 2017
@@ -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) {
Modified: llvm/trunk/lib/Fuzzer/test/value-profile-cmp2.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/test/value-profile-cmp2.test?rev=308945&r1=308944&r2=308945&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/test/value-profile-cmp2.test (original)
+++ llvm/trunk/lib/Fuzzer/test/value-profile-cmp2.test Mon Jul 24 19:09:46 2017
@@ -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
More information about the llvm-commits
mailing list