From 5a1ab18eb6a883f41f004b3c252e526f6cc4ab9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dietrich=20Kr=C3=B6nke?= Date: Tue, 28 Sep 2021 11:12:37 +0200 Subject: [PATCH] iox-#910 Set callback function in waitset tests Add test cases for using nullptr as callback function in waitset --- .../moduletests/test_notification_info.cpp | 13 ++- .../test/moduletests/test_subscriber.cpp | 10 +- .../test/moduletests/test_user_trigger.cpp | 10 +- .../test/moduletests/test_wait_set.cpp | 94 ++++++++++++------- 4 files changed, 78 insertions(+), 49 deletions(-) diff --git a/iceoryx_binding_c/test/moduletests/test_notification_info.cpp b/iceoryx_binding_c/test/moduletests/test_notification_info.cpp index 5a1404c9b1e..3febe8af1ab 100644 --- a/iceoryx_binding_c/test/moduletests/test_notification_info.cpp +++ b/iceoryx_binding_c/test/moduletests/test_notification_info.cpp @@ -91,6 +91,9 @@ class iox_notification_info_test : public Test return m_memoryManager.getChunk(chunkSettings); } + static void triggerCallback(iox_sub_t sub IOX_MAYBE_UNUSED) + { + } static UserTrigger* m_lastNotificationCallbackArgument; ConditionVariableData m_condVar{"myApp"}; @@ -142,7 +145,7 @@ TEST_F(iox_notification_info_test, notificationOriginIsUserTriggerPointerWhenIts TEST_F(iox_notification_info_test, notificationOriginIsSubscriberPointerWhenItsOriginatingFromThemStateBased) { - iox_ws_attach_subscriber_state(&m_waitSet, m_subscriberHandle, SubscriberState_HAS_DATA, 587U, NULL); + iox_ws_attach_subscriber_state(&m_waitSet, m_subscriberHandle, SubscriberState_HAS_DATA, 587U, triggerCallback); this->Subscribe(&m_portPtr); m_chunkPusher.push(getChunkFromMemoryManager()); @@ -154,7 +157,8 @@ TEST_F(iox_notification_info_test, notificationOriginIsSubscriberPointerWhenItsO TEST_F(iox_notification_info_test, notificationOriginIsSubscriberPointerWhenItsOriginatingFromThemEventBased) { - iox_ws_attach_subscriber_event(&m_waitSet, m_subscriberHandle, SubscriberEvent_DATA_RECEIVED, 587U, NULL); + iox_ws_attach_subscriber_event( + &m_waitSet, m_subscriberHandle, SubscriberEvent_DATA_RECEIVED, 587U, triggerCallback); this->Subscribe(&m_portPtr); m_chunkPusher.push(getChunkFromMemoryManager()); @@ -178,7 +182,7 @@ TEST_F(iox_notification_info_test, getOriginReturnsPointerToUserTriggerWhenOrigi TEST_F(iox_notification_info_test, getOriginReturnsPointerToSubscriberWhenOriginatingFromThemStateBased) { - iox_ws_attach_subscriber_state(&m_waitSet, m_subscriberHandle, SubscriberState_HAS_DATA, 587U, NULL); + iox_ws_attach_subscriber_state(&m_waitSet, m_subscriberHandle, SubscriberState_HAS_DATA, 587U, triggerCallback); this->Subscribe(&m_portPtr); m_chunkPusher.push(getChunkFromMemoryManager()); @@ -190,7 +194,8 @@ TEST_F(iox_notification_info_test, getOriginReturnsPointerToSubscriberWhenOrigin TEST_F(iox_notification_info_test, getOriginReturnsPointerToSubscriberWhenOriginatingFromThemEventBased) { - iox_ws_attach_subscriber_event(&m_waitSet, m_subscriberHandle, SubscriberEvent_DATA_RECEIVED, 587U, NULL); + iox_ws_attach_subscriber_event( + &m_waitSet, m_subscriberHandle, SubscriberEvent_DATA_RECEIVED, 587U, triggerCallback); this->Subscribe(&m_portPtr); m_chunkPusher.push(getChunkFromMemoryManager()); diff --git a/iceoryx_binding_c/test/moduletests/test_subscriber.cpp b/iceoryx_binding_c/test/moduletests/test_subscriber.cpp index 57d5e6ee61d..ddfea654f63 100644 --- a/iceoryx_binding_c/test/moduletests/test_subscriber.cpp +++ b/iceoryx_binding_c/test/moduletests/test_subscriber.cpp @@ -327,7 +327,7 @@ TEST_F(iox_sub_test, sendingTooMuchLeadsToOverflow) TEST_F(iox_sub_test, attachingToWaitSetWorks) { - EXPECT_EQ(iox_ws_attach_subscriber_state(m_waitSet.get(), m_sut, SubscriberState_HAS_DATA, 0U, NULL), + EXPECT_EQ(iox_ws_attach_subscriber_state(m_waitSet.get(), m_sut, SubscriberState_HAS_DATA, 0U, triggerCallback), WaitSetResult_SUCCESS); EXPECT_EQ(m_waitSet->size(), 1U); } @@ -335,9 +335,9 @@ TEST_F(iox_sub_test, attachingToWaitSetWorks) TEST_F(iox_sub_test, attachingToAnotherWaitsetCleansupAtOriginalWaitset) { WaitSetMock m_waitSet2{m_condVar}; - iox_ws_attach_subscriber_state(m_waitSet.get(), m_sut, SubscriberState_HAS_DATA, 0U, NULL); + iox_ws_attach_subscriber_state(m_waitSet.get(), m_sut, SubscriberState_HAS_DATA, 0U, triggerCallback); - EXPECT_EQ(iox_ws_attach_subscriber_state(&m_waitSet2, m_sut, SubscriberState_HAS_DATA, 0U, NULL), + EXPECT_EQ(iox_ws_attach_subscriber_state(&m_waitSet2, m_sut, SubscriberState_HAS_DATA, 0U, triggerCallback), WaitSetResult_SUCCESS); EXPECT_EQ(m_waitSet->size(), 0U); EXPECT_EQ(m_waitSet2.size(), 1U); @@ -345,14 +345,14 @@ TEST_F(iox_sub_test, attachingToAnotherWaitsetCleansupAtOriginalWaitset) TEST_F(iox_sub_test, detachingFromWaitSetWorks) { - iox_ws_attach_subscriber_state(m_waitSet.get(), m_sut, SubscriberState_HAS_DATA, 0U, NULL); + iox_ws_attach_subscriber_state(m_waitSet.get(), m_sut, SubscriberState_HAS_DATA, 0U, triggerCallback); iox_ws_detach_subscriber_state(m_waitSet.get(), m_sut, SubscriberState_HAS_DATA); EXPECT_EQ(m_waitSet->size(), 0U); } TEST_F(iox_sub_test, hasDataTriggersWaitSetWithCorrectNotificationId) { - iox_ws_attach_subscriber_state(m_waitSet.get(), m_sut, SubscriberState_HAS_DATA, 587U, NULL); + iox_ws_attach_subscriber_state(m_waitSet.get(), m_sut, SubscriberState_HAS_DATA, 587U, triggerCallback); this->Subscribe(&m_portPtr); m_chunkPusher.push(getChunkFromMemoryManager()); diff --git a/iceoryx_binding_c/test/moduletests/test_user_trigger.cpp b/iceoryx_binding_c/test/moduletests/test_user_trigger.cpp index d16548b3a2c..a80cb3227ba 100644 --- a/iceoryx_binding_c/test/moduletests/test_user_trigger.cpp +++ b/iceoryx_binding_c/test/moduletests/test_user_trigger.cpp @@ -79,14 +79,14 @@ TEST_F(iox_user_trigger_test, cannotBeTriggeredWhenNotAttached) TEST_F(iox_user_trigger_test, canBeTriggeredWhenAttached) { - iox_ws_attach_user_trigger_event(&m_waitSet, m_sut, 0U, NULL); + iox_ws_attach_user_trigger_event(&m_waitSet, m_sut, 0U, triggerCallback); iox_user_trigger_trigger(m_sut); EXPECT_TRUE(iox_user_trigger_has_triggered(m_sut)); } TEST_F(iox_user_trigger_test, triggeringWaitSetResultsInCorrectNotificationId) { - iox_ws_attach_user_trigger_event(&m_waitSet, m_sut, 88191U, NULL); + iox_ws_attach_user_trigger_event(&m_waitSet, m_sut, 88191U, triggerCallback); iox_user_trigger_trigger(m_sut); auto eventVector = m_waitSet.wait(); @@ -111,9 +111,9 @@ TEST_F(iox_user_trigger_test, triggeringWaitSetResultsInCorrectCallback) TEST_F(iox_user_trigger_test, attachingToAnotherWaitSetCleansupFirstWaitset) { WaitSetMock m_waitSet2{m_condVar}; - iox_ws_attach_user_trigger_event(&m_waitSet, m_sut, 0U, NULL); + iox_ws_attach_user_trigger_event(&m_waitSet, m_sut, 0U, triggerCallback); - iox_ws_attach_user_trigger_event(&m_waitSet2, m_sut, 0U, NULL); + iox_ws_attach_user_trigger_event(&m_waitSet2, m_sut, 0U, triggerCallback); EXPECT_EQ(m_waitSet.size(), 0U); EXPECT_EQ(m_waitSet2.size(), 1U); @@ -122,7 +122,7 @@ TEST_F(iox_user_trigger_test, attachingToAnotherWaitSetCleansupFirstWaitset) TEST_F(iox_user_trigger_test, disable_trigger_eventingItFromWaitsetCleansup) { WaitSetMock m_waitSet2{m_condVar}; - iox_ws_attach_user_trigger_event(&m_waitSet, m_sut, 0U, NULL); + iox_ws_attach_user_trigger_event(&m_waitSet, m_sut, 0U, triggerCallback); iox_ws_detach_user_trigger_event(&m_waitSet, m_sut); diff --git a/iceoryx_binding_c/test/moduletests/test_wait_set.cpp b/iceoryx_binding_c/test/moduletests/test_wait_set.cpp index f5d74adaa08..c55c2caa074 100644 --- a/iceoryx_binding_c/test/moduletests/test_wait_set.cpp +++ b/iceoryx_binding_c/test/moduletests/test_wait_set.cpp @@ -142,7 +142,7 @@ TEST_F(iox_ws_test, SizeIsZeroWhenConstructed) TEST_F(iox_ws_test, SizeIsOneWhenOneUserTriggerIsAttached) { - EXPECT_EQ(iox_ws_attach_user_trigger_event(m_sut, m_userTrigger[0U], 0U, NULL), + EXPECT_EQ(iox_ws_attach_user_trigger_event(m_sut, m_userTrigger[0U], 0U, userTriggerCallback), iox_WaitSetResult::WaitSetResult_SUCCESS); EXPECT_EQ(iox_ws_size(m_sut), 1U); } @@ -150,29 +150,52 @@ TEST_F(iox_ws_test, SizeIsOneWhenOneUserTriggerIsAttached) TEST_F(iox_ws_test, SizeIsOneWhenOneSubscriberStateIsAttached) { constexpr uint64_t customId = 123U; - EXPECT_EQ(iox_ws_attach_subscriber_state(m_sut, &m_subscriberVector[0U], SubscriberState_HAS_DATA, customId, NULL), + EXPECT_EQ(iox_ws_attach_subscriber_state( + m_sut, &m_subscriberVector[0U], SubscriberState_HAS_DATA, customId, subscriberCallback), iox_WaitSetResult::WaitSetResult_SUCCESS); EXPECT_EQ(iox_ws_size(m_sut), 1U); } -TEST_F(iox_ws_test, SizeIsOneWhenOneSubscriberEventIsAttached) +#if !defined(__SANITIZE_ADDRESS__) +/// @note The two testcases get a nullptr as callback function to check that the attach function do not silently fail. +/// They are from ASAN to avoid an error of type +TEST_F(iox_ws_test, SizeIsOneWhenOneUserTriggerWithoutCallbackIsAttached) +{ + EXPECT_EQ(iox_ws_attach_user_trigger_event(m_sut, m_userTrigger[0U], 0U, nullptr), + iox_WaitSetResult::WaitSetResult_SUCCESS); + EXPECT_EQ(iox_ws_size(m_sut), 1U); +} + + +TEST_F(iox_ws_test, SizeIsOneWhenOneSubscriberStateWithoutCallbackIsAttached) { constexpr uint64_t customId = 123U; EXPECT_EQ( - iox_ws_attach_subscriber_event(m_sut, &m_subscriberVector[0U], SubscriberEvent_DATA_RECEIVED, customId, NULL), + iox_ws_attach_subscriber_state(m_sut, &m_subscriberVector[0U], SubscriberState_HAS_DATA, customId, nullptr), iox_WaitSetResult::WaitSetResult_SUCCESS); EXPECT_EQ(iox_ws_size(m_sut), 1U); } +#endif + +TEST_F(iox_ws_test, SizeIsOneWhenOneSubscriberEventIsAttached) +{ + constexpr uint64_t customId = 123U; + EXPECT_EQ(iox_ws_attach_subscriber_event( + m_sut, &m_subscriberVector[0U], SubscriberEvent_DATA_RECEIVED, customId, subscriberCallback), + iox_WaitSetResult::WaitSetResult_SUCCESS); + EXPECT_EQ(iox_ws_size(m_sut), 1U); +} TEST_F(iox_ws_test, AttachingMoreUserTriggerThanCapacityAvailableFails) { for (uint64_t i = 0U; i < MAX_NUMBER_OF_ATTACHMENTS_PER_WAITSET; ++i) { - EXPECT_EQ(iox_ws_attach_user_trigger_event(m_sut, m_userTrigger[i], 0U, NULL), + EXPECT_EQ(iox_ws_attach_user_trigger_event(m_sut, m_userTrigger[i], 0U, userTriggerCallback), iox_WaitSetResult::WaitSetResult_SUCCESS); EXPECT_EQ(iox_ws_size(m_sut), i + 1U); } - EXPECT_EQ(iox_ws_attach_user_trigger_event(m_sut, m_userTrigger[MAX_NUMBER_OF_ATTACHMENTS_PER_WAITSET], 0U, NULL), + EXPECT_EQ(iox_ws_attach_user_trigger_event( + m_sut, m_userTrigger[MAX_NUMBER_OF_ATTACHMENTS_PER_WAITSET], 0U, userTriggerCallback), iox_WaitSetResult::WaitSetResult_WAIT_SET_FULL); } @@ -181,16 +204,16 @@ TEST_F(iox_ws_test, AttachingMoreSubscriberStatesThanCapacityAvailableFails) constexpr uint64_t customId = 123U; for (uint64_t i = 0U; i < MAX_NUMBER_OF_ATTACHMENTS_PER_WAITSET; ++i) { - EXPECT_EQ( - iox_ws_attach_subscriber_state(m_sut, &m_subscriberVector[i], SubscriberState_HAS_DATA, customId, NULL), - iox_WaitSetResult::WaitSetResult_SUCCESS); + EXPECT_EQ(iox_ws_attach_subscriber_state( + m_sut, &m_subscriberVector[i], SubscriberState_HAS_DATA, customId, subscriberCallback), + iox_WaitSetResult::WaitSetResult_SUCCESS); EXPECT_EQ(iox_ws_size(m_sut), i + 1U); } EXPECT_EQ(iox_ws_attach_subscriber_state(m_sut, &m_subscriberVector[MAX_NUMBER_OF_ATTACHMENTS_PER_WAITSET], SubscriberState_HAS_DATA, customId, - NULL), + subscriberCallback), iox_WaitSetResult::WaitSetResult_WAIT_SET_FULL); } @@ -200,7 +223,7 @@ TEST_F(iox_ws_test, AttachingMoreSubscriberEventsThanCapacityAvailableFails) for (uint64_t i = 0U; i < MAX_NUMBER_OF_ATTACHMENTS_PER_WAITSET; ++i) { EXPECT_EQ(iox_ws_attach_subscriber_event( - m_sut, &m_subscriberVector[i], SubscriberEvent_DATA_RECEIVED, customId, NULL), + m_sut, &m_subscriberVector[i], SubscriberEvent_DATA_RECEIVED, customId, subscriberCallback), iox_WaitSetResult::WaitSetResult_SUCCESS); EXPECT_EQ(iox_ws_size(m_sut), i + 1U); } @@ -208,13 +231,13 @@ TEST_F(iox_ws_test, AttachingMoreSubscriberEventsThanCapacityAvailableFails) &m_subscriberVector[MAX_NUMBER_OF_ATTACHMENTS_PER_WAITSET], SubscriberEvent_DATA_RECEIVED, customId, - NULL), + subscriberCallback), iox_WaitSetResult::WaitSetResult_WAIT_SET_FULL); } TEST_F(iox_ws_test, SizeDecreasesWhenAttachedUserTriggerIsDeinitialized) { - iox_ws_attach_user_trigger_event(m_sut, m_userTrigger[0U], 0U, NULL); + iox_ws_attach_user_trigger_event(m_sut, m_userTrigger[0U], 0U, userTriggerCallback); iox_ws_detach_user_trigger_event(m_sut, m_userTrigger[0U]); EXPECT_EQ(iox_ws_size(m_sut), 0U); } @@ -222,7 +245,8 @@ TEST_F(iox_ws_test, SizeDecreasesWhenAttachedUserTriggerIsDeinitialized) TEST_F(iox_ws_test, SizeDecreasesWhenAttachedSubscriberStateIsDeinitialized) { constexpr uint64_t customId = 123U; - EXPECT_EQ(iox_ws_attach_subscriber_state(m_sut, &m_subscriberVector[0U], SubscriberState_HAS_DATA, customId, NULL), + EXPECT_EQ(iox_ws_attach_subscriber_state( + m_sut, &m_subscriberVector[0U], SubscriberState_HAS_DATA, customId, subscriberCallback), iox_WaitSetResult::WaitSetResult_SUCCESS); iox_ws_detach_subscriber_state(m_sut, &m_subscriberVector[0U], SubscriberState_HAS_DATA); EXPECT_EQ(iox_ws_size(m_sut), 0U); @@ -231,16 +255,16 @@ TEST_F(iox_ws_test, SizeDecreasesWhenAttachedSubscriberStateIsDeinitialized) TEST_F(iox_ws_test, SizeDecreasesWhenAttachedSubscriberEventIsDeinitialized) { constexpr uint64_t customId = 123U; - EXPECT_EQ( - iox_ws_attach_subscriber_event(m_sut, &m_subscriberVector[0U], SubscriberEvent_DATA_RECEIVED, customId, NULL), - iox_WaitSetResult::WaitSetResult_SUCCESS); + EXPECT_EQ(iox_ws_attach_subscriber_event( + m_sut, &m_subscriberVector[0U], SubscriberEvent_DATA_RECEIVED, customId, subscriberCallback), + iox_WaitSetResult::WaitSetResult_SUCCESS); iox_ws_detach_subscriber_event(m_sut, &m_subscriberVector[0U], SubscriberEvent_DATA_RECEIVED); EXPECT_EQ(iox_ws_size(m_sut), 0U); } TEST_F(iox_ws_test, NumberOfTriggeredConditionsIsOneWhenOneWasTriggered) { - iox_ws_attach_user_trigger_event(m_sut, m_userTrigger[0U], 0U, NULL); + iox_ws_attach_user_trigger_event(m_sut, m_userTrigger[0U], 0U, userTriggerCallback); iox_user_trigger_trigger(m_userTrigger[0U]); EXPECT_EQ(iox_ws_wait(m_sut, m_eventInfoStorage, MAX_NUMBER_OF_ATTACHMENTS_PER_WAITSET, &m_missedElements), 1U); @@ -250,7 +274,7 @@ TEST_F(iox_ws_test, NumberOfTriggeredConditionsIsCorrectWhenMultipleWereTriggere { for (uint64_t i = 0U; i < 10U; ++i) { - iox_ws_attach_user_trigger_event(m_sut, m_userTrigger[i], 0U, NULL); + iox_ws_attach_user_trigger_event(m_sut, m_userTrigger[i], 0U, userTriggerCallback); iox_user_trigger_trigger(m_userTrigger[i]); } @@ -261,7 +285,7 @@ TEST_F(iox_ws_test, NumberOfTriggeredConditionsIsCorrectWhenAllWereTriggered) { for (uint64_t i = 0U; i < MAX_NUMBER_OF_ATTACHMENTS_PER_WAITSET; ++i) { - iox_ws_attach_user_trigger_event(m_sut, m_userTrigger[i], 0U, NULL); + iox_ws_attach_user_trigger_event(m_sut, m_userTrigger[i], 0U, userTriggerCallback); iox_user_trigger_trigger(m_userTrigger[i]); } @@ -271,7 +295,7 @@ TEST_F(iox_ws_test, NumberOfTriggeredConditionsIsCorrectWhenAllWereTriggered) TEST_F(iox_ws_test, SingleTriggerCaseWaitReturnsCorrectTrigger) { - iox_ws_attach_user_trigger_event(m_sut, m_userTrigger[0], 5678U, NULL); + iox_ws_attach_user_trigger_event(m_sut, m_userTrigger[0], 5678U, userTriggerCallback); iox_user_trigger_trigger(m_userTrigger[0U]); iox_ws_wait(m_sut, m_eventInfoStorage, MAX_NUMBER_OF_ATTACHMENTS_PER_WAITSET, &m_missedElements); @@ -286,7 +310,7 @@ TEST_F(iox_ws_test, MultiTriggerCaseWaitReturnsCorrectTrigger) { for (uint64_t i = 0U; i < 8; ++i) { - iox_ws_attach_user_trigger_event(m_sut, m_userTrigger[i], 1337U + i, NULL); + iox_ws_attach_user_trigger_event(m_sut, m_userTrigger[i], 1337U + i, userTriggerCallback); iox_user_trigger_trigger(m_userTrigger[i]); } @@ -304,7 +328,7 @@ TEST_F(iox_ws_test, MaxTriggerCaseWaitReturnsCorrectTrigger) { for (uint64_t i = 0U; i < MAX_NUMBER_OF_ATTACHMENTS_PER_WAITSET; ++i) { - iox_ws_attach_user_trigger_event(m_sut, m_userTrigger[i], 42U * i + 1U, NULL); + iox_ws_attach_user_trigger_event(m_sut, m_userTrigger[i], 42U * i + 1U, userTriggerCallback); iox_user_trigger_trigger(m_userTrigger[i]); } @@ -320,7 +344,7 @@ TEST_F(iox_ws_test, MaxTriggerCaseWaitReturnsCorrectTrigger) TEST_F(iox_ws_test, TimedWaitNumberOfTriggeredConditionsIsOneWhenOneWasTriggered) { - iox_ws_attach_user_trigger_event(m_sut, m_userTrigger[0U], 0U, NULL); + iox_ws_attach_user_trigger_event(m_sut, m_userTrigger[0U], 0U, userTriggerCallback); iox_user_trigger_trigger(m_userTrigger[0U]); EXPECT_EQ(iox_ws_timed_wait( @@ -332,7 +356,7 @@ TEST_F(iox_ws_test, TimedWaitNumberOfTriggeredConditionsIsCorrectWhenMultipleWer { for (uint64_t i = 0U; i < 10U; ++i) { - iox_ws_attach_user_trigger_event(m_sut, m_userTrigger[i], 0U, NULL); + iox_ws_attach_user_trigger_event(m_sut, m_userTrigger[i], 0U, userTriggerCallback); iox_user_trigger_trigger(m_userTrigger[i]); } @@ -345,7 +369,7 @@ TEST_F(iox_ws_test, TimedWaitNumberOfTriggeredConditionsIsCorrectWhenAllWereTrig { for (uint64_t i = 0U; i < MAX_NUMBER_OF_ATTACHMENTS_PER_WAITSET; ++i) { - iox_ws_attach_user_trigger_event(m_sut, m_userTrigger[i], 0U, NULL); + iox_ws_attach_user_trigger_event(m_sut, m_userTrigger[i], 0U, userTriggerCallback); iox_user_trigger_trigger(m_userTrigger[i]); } @@ -356,7 +380,7 @@ TEST_F(iox_ws_test, TimedWaitNumberOfTriggeredConditionsIsCorrectWhenAllWereTrig TEST_F(iox_ws_test, SingleTriggerCaseTimedWaitReturnsCorrectTrigger) { - iox_ws_attach_user_trigger_event(m_sut, m_userTrigger[0U], 5678U, NULL); + iox_ws_attach_user_trigger_event(m_sut, m_userTrigger[0U], 5678U, userTriggerCallback); iox_user_trigger_trigger(m_userTrigger[0U]); iox_ws_timed_wait(m_sut, m_timeout, m_eventInfoStorage, MAX_NUMBER_OF_ATTACHMENTS_PER_WAITSET, &m_missedElements); @@ -371,7 +395,7 @@ TEST_F(iox_ws_test, MultiTriggerCaseTimedWaitReturnsCorrectTrigger) { for (uint64_t i = 0U; i < 8U; ++i) { - iox_ws_attach_user_trigger_event(m_sut, m_userTrigger[i], 1337U + i, NULL); + iox_ws_attach_user_trigger_event(m_sut, m_userTrigger[i], 1337U + i, userTriggerCallback); iox_user_trigger_trigger(m_userTrigger[i]); } @@ -389,7 +413,7 @@ TEST_F(iox_ws_test, MaxTriggerCaseTimedWaitReturnsCorrectTrigger) { for (uint64_t i = 0U; i < MAX_NUMBER_OF_ATTACHMENTS_PER_WAITSET; ++i) { - iox_ws_attach_user_trigger_event(m_sut, m_userTrigger[i], 42U * i + 1U, NULL); + iox_ws_attach_user_trigger_event(m_sut, m_userTrigger[i], 42U * i + 1U, userTriggerCallback); iox_user_trigger_trigger(m_userTrigger[i]); } @@ -407,7 +431,7 @@ TEST_F(iox_ws_test, MissedElementsIsZeroWhenNothingWasMissed) { for (uint64_t i = 0U; i < 12U; ++i) { - iox_ws_attach_user_trigger_event(m_sut, m_userTrigger[i], 0U, NULL); + iox_ws_attach_user_trigger_event(m_sut, m_userTrigger[i], 0U, userTriggerCallback); iox_user_trigger_trigger(m_userTrigger[i]); } @@ -420,7 +444,7 @@ TEST_F(iox_ws_test, MissedElementsIsCorrectWhenSomethingWasMissed) { for (uint64_t i = 0U; i < 12U; ++i) { - iox_ws_attach_user_trigger_event(m_sut, m_userTrigger[i], 0U, NULL); + iox_ws_attach_user_trigger_event(m_sut, m_userTrigger[i], 0U, userTriggerCallback); iox_user_trigger_trigger(m_userTrigger[i]); } @@ -433,7 +457,7 @@ TEST_F(iox_ws_test, MissedElementsIsCorrectWhenAllWereMissed) { for (uint64_t i = 0U; i < MAX_NUMBER_OF_ATTACHMENTS_PER_WAITSET; ++i) { - iox_ws_attach_user_trigger_event(m_sut, m_userTrigger[i], 0U, NULL); + iox_ws_attach_user_trigger_event(m_sut, m_userTrigger[i], 0U, userTriggerCallback); iox_user_trigger_trigger(m_userTrigger[i]); } @@ -443,7 +467,7 @@ TEST_F(iox_ws_test, MissedElementsIsCorrectWhenAllWereMissed) } TIMING_TEST_F(iox_ws_test, WaitIsBlockingTillTriggered, Repeat(5), [&] { - iox_ws_attach_user_trigger_event(m_sut, m_userTrigger[0U], 0U, NULL); + iox_ws_attach_user_trigger_event(m_sut, m_userTrigger[0U], 0U, userTriggerCallback); std::atomic_bool waitWasCalled{false}; std::thread t([&] { @@ -480,7 +504,7 @@ TIMING_TEST_F(iox_ws_test, WaitIsNonBlockingAfterMarkForDestruction, Repeat(5), TIMING_TEST_F(iox_ws_test, TimedWaitIsBlockingTillTriggered, Repeat(5), [&] { - iox_ws_attach_user_trigger_event(m_sut, m_userTrigger[0U], 0U, NULL); + iox_ws_attach_user_trigger_event(m_sut, m_userTrigger[0U], 0U, userTriggerCallback); std::atomic_bool waitWasCalled{false}; std::thread t([&] { @@ -516,7 +540,7 @@ TIMING_TEST_F(iox_ws_test, TimedWaitIsNonBlockingAfterMarkForDestruction, Repeat }); TIMING_TEST_F(iox_ws_test, TimedWaitBlocksTillTimeout, Repeat(5), [&] { - iox_ws_attach_user_trigger_event(m_sut, m_userTrigger[0U], 0U, NULL); + iox_ws_attach_user_trigger_event(m_sut, m_userTrigger[0U], 0U, userTriggerCallback); std::atomic_bool waitWasCalled{false}; std::thread t([&] {