From 1a15b2299551837c18c38e055b4976dc980f9352 Mon Sep 17 00:00:00 2001 From: Mathias Kraus Date: Fri, 23 Aug 2024 00:26:37 +0200 Subject: [PATCH] iox-#2301 Fix tests for 32 bit builds --- .../test/moduletests/test_time_unit_duration.cpp | 8 ++++---- iceoryx_posh/test/moduletests/test_mepoo_mempool.cpp | 12 ++++++++++-- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/iceoryx_hoofs/test/moduletests/test_time_unit_duration.cpp b/iceoryx_hoofs/test/moduletests/test_time_unit_duration.cpp index 5cf61a5026..8c5f842d2b 100644 --- a/iceoryx_hoofs/test/moduletests/test_time_unit_duration.cpp +++ b/iceoryx_hoofs/test/moduletests/test_time_unit_duration.cpp @@ -1050,7 +1050,7 @@ TEST(Duration_test, ConvertTimespecWithNoneReferenceFromDurationMoreThanOneSecon TEST(Duration_test, ConvertTimespecWithNoneReferenceFromDurationResultsNotYetInSaturation) { ::testing::Test::RecordProperty("TEST_ID", "70f11b99-78ec-442a-aefe-4dd9152b7903"); - constexpr int64_t SECONDS{std::numeric_limits::max()}; + constexpr int64_t SECONDS{std::numeric_limits::max()}; constexpr int64_t NANOSECONDS{NANOSECS_PER_SECOND - 1U}; auto duration = createDuration(SECONDS, NANOSECONDS); @@ -1064,7 +1064,7 @@ TEST(Duration_test, ConvertTimespecWithNoneReferenceFromDurationResultsNotYetInS TEST(Duration_test, ConvertTimespecWithNoneReferenceFromMaxDurationResultsInSaturation) { ::testing::Test::RecordProperty("TEST_ID", "3bf4bb34-46f3-4889-84f5-9220b32fff73"); - constexpr int64_t SECONDS{std::numeric_limits::max()}; + constexpr int64_t SECONDS{std::numeric_limits::max()}; constexpr int64_t NANOSECONDS{NANOSECS_PER_SECOND - 1U}; const timespec sut = DurationAccessor::max().timespec(iox::units::TimeSpecReference::None); @@ -1101,7 +1101,7 @@ TEST(Duration_test, ConvertTimespecWithMonotonicReference) TEST(Duration_test, ConvertTimespecWithMonotonicReferenceFromMaxDurationResultsInSaturation) { ::testing::Test::RecordProperty("TEST_ID", "ff5a1fe2-65c8-490a-b31d-4d8ea615c91a"); - constexpr int64_t SECONDS{std::numeric_limits::max()}; + constexpr int64_t SECONDS{std::numeric_limits::max()}; constexpr int64_t NANOSECONDS{NANOSECS_PER_SECOND - 1U}; const timespec sut = DurationAccessor::max().timespec(iox::units::TimeSpecReference::Monotonic); @@ -1129,7 +1129,7 @@ TEST(Duration_test, ConvertTimespecWithEpochReference) TEST(Duration_test, ConvertTimespecWithEpochReferenceFromMaxDurationResultsInSaturation) { ::testing::Test::RecordProperty("TEST_ID", "97ff4204-a7f7-43ef-b81e-0e359d1dce93"); - constexpr int64_t SECONDS{std::numeric_limits::max()}; + constexpr int64_t SECONDS{std::numeric_limits::max()}; constexpr int64_t NANOSECONDS{NANOSECS_PER_SECOND - 1U}; const timespec sut = DurationAccessor::max().timespec(iox::units::TimeSpecReference::Epoch); diff --git a/iceoryx_posh/test/moduletests/test_mepoo_mempool.cpp b/iceoryx_posh/test/moduletests/test_mepoo_mempool.cpp index 53749a4469..718717cf26 100644 --- a/iceoryx_posh/test/moduletests/test_mepoo_mempool.cpp +++ b/iceoryx_posh/test/moduletests/test_mepoo_mempool.cpp @@ -20,6 +20,7 @@ #include "iceoryx_posh/internal/posh_error_reporting.hpp" #include "iox/bump_allocator.hpp" #include "iox/detail/hoofs_error_reporting.hpp" +#include "iox/detail/system_configuration.hpp" #include "iceoryx_hoofs/testing/fatal_failure.hpp" #include "test.hpp" @@ -46,8 +47,8 @@ class MemPool_test : public Test { } - void SetUp(){}; - void TearDown(){}; + void SetUp() {}; + void TearDown() {}; alignas(MemPool::CHUNK_MEMORY_ALIGNMENT) uint8_t m_rawMemory[NUMBER_OF_CHUNKS * CHUNK_SIZE + LOFFLI_MEMORY_REQUIREMENT]; @@ -138,6 +139,13 @@ TEST_F(MemPool_test, MempoolPointeToIndexConversionForMemoryOffsetsLargerThan4GB constexpr uint64_t GB{1ULL << 30}; constexpr uint64_t CHUNK_SIZE{128 * MB}; constexpr uint64_t RAW_MEMORY_BASE{0x7f60d90c5000ULL}; + + if (iox::detail::isCompiledOn32BitSystem()) + { + GTEST_SKIP() << "This test does not work on 32 bit builds since it requires pointer larger than the 32 bit " + "address space"; + } + uint8_t* const RAW_MEMORY_PTR{reinterpret_cast(RAW_MEMORY_BASE)}; constexpr uint32_t EXPECTED_INDEX{42}; uint8_t* const CHUNK_PTR{RAW_MEMORY_PTR + static_cast(EXPECTED_INDEX) * CHUNK_SIZE};