From e857d23c61479104ea245209667f201a283cc8d7 Mon Sep 17 00:00:00 2001 From: Kostya Serebryany Date: Fri, 31 Mar 2017 03:51:40 +0000 Subject: [PATCH] [libFuzzer] tests: don't test 64-bit comparison on 32-bit builds git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299179 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Fuzzer/test/SimpleCmpTest.cpp | 9 +++++---- lib/Fuzzer/test/SwapCmpTest.cpp | 3 ++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/Fuzzer/test/SimpleCmpTest.cpp b/lib/Fuzzer/test/SimpleCmpTest.cpp index 0220c30f9a6..12b5cdda066 100644 --- a/lib/Fuzzer/test/SimpleCmpTest.cpp +++ b/lib/Fuzzer/test/SimpleCmpTest.cpp @@ -26,12 +26,13 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { 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__) && diff --git a/lib/Fuzzer/test/SwapCmpTest.cpp b/lib/Fuzzer/test/SwapCmpTest.cpp index f79db4ccf71..b90ac72c22c 100644 --- a/lib/Fuzzer/test/SwapCmpTest.cpp +++ b/lib/Fuzzer/test/SwapCmpTest.cpp @@ -19,8 +19,9 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { 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 -- 2.50.1