[llvm] r299179 - [libFuzzer] tests: don't test 64-bit comparison on 32-bit builds
Kostya Serebryany via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 30 20:51:40 PDT 2017
Author: kcc
Date: Thu Mar 30 22:51:40 2017
New Revision: 299179
URL: http://llvm.org/viewvc/llvm-project?rev=299179&view=rev
Log:
[libFuzzer] tests: don't test 64-bit comparison on 32-bit builds
Modified:
llvm/trunk/lib/Fuzzer/test/SimpleCmpTest.cpp
llvm/trunk/lib/Fuzzer/test/SwapCmpTest.cpp
Modified: llvm/trunk/lib/Fuzzer/test/SimpleCmpTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/test/SimpleCmpTest.cpp?rev=299179&r1=299178&r2=299179&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/test/SimpleCmpTest.cpp (original)
+++ llvm/trunk/lib/Fuzzer/test/SimpleCmpTest.cpp Thu Mar 30 22:51:40 2017
@@ -26,12 +26,13 @@ extern "C" int LLVMFuzzerTestOneInput(co
memcpy(&y, Data + 8, 8); // 16
memcpy(&z, Data + 16, sizeof(z)); // 20
memcpy(&a, Data + 20, sizeof(a)); // 22
+ const bool k32bit = sizeof(void*) == 4;
- if (x > 1234567890 && PrintOnce(__LINE__) &&
- x < 1234567895 && PrintOnce(__LINE__) &&
+ if ((k32bit || x > 1234567890) && PrintOnce(__LINE__) &&
+ (k32bit || x < 1234567895) && PrintOnce(__LINE__) &&
a == 0x4242 && PrintOnce(__LINE__) &&
- y >= 987654321 && PrintOnce(__LINE__) &&
- y <= 987654325 && PrintOnce(__LINE__) &&
+ (k32bit || y >= 987654321) && PrintOnce(__LINE__) &&
+ (k32bit || y <= 987654325) && PrintOnce(__LINE__) &&
z < -10000 && PrintOnce(__LINE__) &&
z >= -10005 && PrintOnce(__LINE__) &&
z != -10003 && PrintOnce(__LINE__) &&
Modified: llvm/trunk/lib/Fuzzer/test/SwapCmpTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/test/SwapCmpTest.cpp?rev=299179&r1=299178&r2=299179&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/test/SwapCmpTest.cpp (original)
+++ llvm/trunk/lib/Fuzzer/test/SwapCmpTest.cpp Thu Mar 30 22:51:40 2017
@@ -19,8 +19,9 @@ extern "C" int LLVMFuzzerTestOneInput(co
x = __builtin_bswap64(x);
y = __builtin_bswap32(y);
z = __builtin_bswap16(z);
+ const bool k32bit = sizeof(void*) == 4;
- if (x == 0x46555A5A5A5A5546ULL &&
+ if ((k32bit || x == 0x46555A5A5A5A5546ULL) &&
z == 0x4F4B &&
y == 0x66757A7A &&
true
More information about the llvm-commits
mailing list