Skip to content

Commit

Permalink
iox-eclipse-iceoryx#2185 Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
elBoberido committed Feb 19, 2024
1 parent 17ab63c commit 529837f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
7 changes: 5 additions & 2 deletions iceoryx_binding_c/test/moduletests/test_runtime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,17 @@ TEST_F(BindingC_Runtime_test, SuccessfulRegistration)
TEST_F(BindingC_Runtime_test, RuntimeNameLengthIsMax)
{
::testing::Test::RecordProperty("TEST_ID", "854a471d-936e-4c98-b56e-ba8a7d83460e");
std::string maxName(iox::MAX_RUNTIME_NAME_LENGTH, 's');

RuntimeName_t dummy{"a"};
auto prefixLength = runtime::ipcChannelNameToInterfaceName(dummy).value().size() - dummy.size();
std::string maxName(iox::MAX_RUNTIME_NAME_LENGTH - prefixLength, 's');

iox_runtime_init(maxName.c_str());

char actualRuntimeName[iox::MAX_RUNTIME_NAME_LENGTH + 1];
auto nameLength = iox_runtime_get_instance_name(actualRuntimeName, iox::MAX_RUNTIME_NAME_LENGTH + 1);

ASSERT_THAT(nameLength, Eq(iox::MAX_RUNTIME_NAME_LENGTH));
ASSERT_THAT(nameLength, Eq(iox::MAX_RUNTIME_NAME_LENGTH - prefixLength));
}

TEST_F(BindingC_Runtime_test, RuntimeNameLengthIsOutOfLimit)
Expand Down
10 changes: 6 additions & 4 deletions iceoryx_posh/test/moduletests/test_mepoo_segment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,14 +154,16 @@ TEST_F(MePooSegment_test, SharedMemoryCreationParameter)
::testing::Test::RecordProperty("TEST_ID", "0fcfefd4-3a84-43a5-9805-057a60239184");
GTEST_SKIP_FOR_ADDITIONAL_USER() << "This test requires the -DTEST_WITH_ADDITIONAL_USER=ON cmake argument";

MePooSegment_test::SharedMemoryObject_MOCK::createVerificator = [](const detail::PosixSharedMemory::Name_t f_name,
MePooSegment_test::SharedMemoryObject_MOCK::createVerificator = [](const detail::PosixSharedMemory::Name_t name,
const uint64_t,
const iox::AccessMode f_accessMode,
const iox::AccessMode accessMode,
const iox::OpenMode openMode,
const void*,
const iox::access_rights) {
EXPECT_THAT(f_name, Eq(detail::PosixSharedMemory::Name_t("iox_roudi_test2")));
EXPECT_THAT(f_accessMode, Eq(iox::AccessMode::READ_WRITE));
EXPECT_THAT(name,
Eq(detail::PosixSharedMemory::Name_t(
concatenate(iceoryxResourcePrefix(roudi::DEFAULT_UNIQUE_ROUDI_ID, "p"), "iox_roudi_test2"))));
EXPECT_THAT(accessMode, Eq(iox::AccessMode::READ_WRITE));
EXPECT_THAT(openMode, Eq(iox::OpenMode::PURGE_AND_CREATE));
};
SUT sut{mepooConfig, m_managementAllocator, PosixGroup{"iox_roudi_test1"}, PosixGroup{"iox_roudi_test2"}};
Expand Down

0 comments on commit 529837f

Please sign in to comment.