Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Development/messagedispatcher #1715

Merged
merged 38 commits into from
Aug 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
94149a0
[Tests/unit/core] : WIP to fix test_message_dispatcher.
msieben May 16, 2024
ff3c391
Adding new tests to each corner case of cyclic buffer overflow
VeithMetro May 20, 2024
db7d407
[Tests/unit/core] : cherry pick '081a0a1a5f6a2f0699d32b943764893198af…
msieben May 21, 2024
d16eecb
Merge branch 'master' into development/messagedispatcher
msieben May 23, 2024
98572b7
Merge branch 'master' into development/messagedispatcher
msieben May 29, 2024
d9a5af8
[Tests/unit/core] : Fix build 'test_message-dispatcher'.
msieben May 29, 2024
02c5ba7
Merge branch 'master' into development/messagedispatcher
pwielders Jun 1, 2024
d6bb105
Merge branch 'master' into development/messagedispatcher
msieben Jun 3, 2024
507ebc1
[Tests/unit/core] : Re-enable 'test_workerpool' and 'test_threadpool'
msieben May 30, 2024
b9cd498
Merge branch 'master' into development/messagedispatcher
msieben Jun 10, 2024
540b996
Merge branch 'master' into development/messagedispatcher
msieben Jun 10, 2024
754e777
Merge branch 'master' into development/messagedispatcher
msieben Jun 12, 2024
3793120
[Tests/unit] : Do not depend on 'IPTestAdministrator' if not used
msieben Jun 20, 2024
1f58b65
Merge branch 'master' into development/iptestadministrator
msieben Jun 21, 2024
3eb94a9
Merge branch 'master' into development/iptestadministrator
msieben Jun 24, 2024
0674ec8
Merge branch 'master' into development/iptestadministrator
msieben Jun 24, 2024
dd920b9
Merge branch 'master' into development/iptestadministrator
MFransen69 Jun 25, 2024
cfcf37a
Merge branch 'master' into development/messagedispatcher
msieben Jun 26, 2024
1171951
Merge branch 'master' into development/messagedispatcher
msieben Jun 26, 2024
cf6db20
Merge branch 'master' into development/messagedispatcher
pwielders Jul 5, 2024
c9156cb
Merge branch 'master' into development/iptestadministrator
msieben Jul 8, 2024
5e55df6
[Tests/unit/tests] : Cherry pick 'test_iptestmanager' from developmen…
msieben Jul 15, 2024
9579773
[Tests/unit / Tests/unit/tests] : Improve synchronization usage of 'I…
msieben Jul 15, 2024
8bc4c8a
[core/IPCChannel] : cherry-pick from 'development/ipcchannel_dangling…
msieben Jul 16, 2024
22e7e3b
Tests/unit/core] : align tests with '957977381dfa8137f1475131622390eb…
msieben Jul 16, 2024
346fb6e
[Tests/unit] : Improve synchronization with premature signalling
msieben Jul 22, 2024
3696efa
[Tests/unit] : Add test cases to 'Tests/unit/tests/test_iptestmanager…
msieben Jul 22, 2024
7c9a286
[Tests/unit/core] : align tests with '346fb6ec2a0da5058f7a581190e63c7…
msieben Jul 22, 2024
a7ef6b2
Merge branch 'master' into development/iptestadministrator
msieben Jul 24, 2024
3737343
[Tests/unit/core] : amend '7c9a286d1398de9f2b470b02bb58596120f0d8c9'
msieben Jul 25, 2024
9c470c7
[Tests/core/unit] : cherry pick from 'development/messageunit'
msieben Jul 26, 2024
be5e514
[Tests/unit/core] : Use 'IPTestAdministrator' for 'PopMessageShouldRe…
msieben Jul 26, 2024
a9f6728
[Tests/unit/IPTestAdministrator] : Try to prevent to leak shared memo…
msieben Aug 5, 2024
3852e59
[Tests/unit/core] : fix 'test_message_dispatcher'
msieben Aug 5, 2024
7e65c06
Merge branch 'master' into development/messagedispatcher
msieben Aug 6, 2024
a03823a
Merge branch 'master' into development/messagedispatcher
msieben Aug 7, 2024
20a2393
Merge branch 'master' into development/messagedispatcher
pwielders Aug 15, 2024
dab04c3
Merge branch 'master' into development/messagedispatcher
msieben Aug 15, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Tests/unit/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ add_executable(${TEST_RUNNER_NAME}
test_lockablecontainer.cpp
test_measurementtype.cpp
test_memberavailability.cpp
test_message_dispatcher.cpp
test_messageException.cpp
test_networkinfo.cpp
test_nodeid.cpp
Expand Down Expand Up @@ -106,7 +107,6 @@ add_executable(${TEST_RUNNER_NAME}
test_lockablecontainer.cpp
test_measurementtype.cpp
test_memberavailability.cpp
# test_message_dispatcher.cpp
test_messageException.cpp
test_networkinfo.cpp
test_nodeid.cpp
Expand Down
29 changes: 20 additions & 9 deletions Tests/unit/core/test_message_dispatcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,30 +189,41 @@ namespace Core {

TEST_F(Core_MessageDispatcher, WriteAndReadDataAreEqualInDifferentProcesses)
{
auto lambdaFunc = [this](IPTestAdministrator& testAdmin) {
constexpr uint32_t initHandshakeValue = 0, maxWaitTime = 4, maxWaitTimeMs = 4000, maxInitTime = 2000;
constexpr uint8_t maxRetries = 1;

IPTestAdministrator::Callback callback_child = [&](IPTestAdministrator& testAdmin) {
::Thunder::Messaging::MessageDataBuffer dispatcher(this->_identifier, this->_instanceId, this->_basePath, DATA_SIZE, 0, false);

uint8_t readData[4];
uint16_t readLength = sizeof(readData);

// Arbitrary timeout value, 1 second
ASSERT_EQ(dispatcher.Wait(1000), ::Thunder::Core::ERROR_NONE);
ASSERT_EQ(dispatcher.Wait(maxWaitTimeMs), ::Thunder::Core::ERROR_NONE);
ASSERT_EQ(dispatcher.PopData(readLength, readData), ::Thunder::Core::ERROR_NONE);

ASSERT_EQ(readLength, 2);
ASSERT_EQ(readData[0], 13);
ASSERT_EQ(readData[1], 37);
};

static std::function<void(IPTestAdministrator&)> lambdaVar = lambdaFunc;
IPTestAdministrator::OtherSideMain otherSide = [](IPTestAdministrator& testAdmin) { lambdaVar(testAdmin); };
ASSERT_EQ(testAdmin.Signal(initHandshakeValue, maxRetries), ::Thunder::Core::ERROR_NONE);
};

// This side (tested) acts as writer
IPTestAdministrator testAdmin(otherSide);
{
IPTestAdministrator::Callback callback_parent = [&](IPTestAdministrator& testAdmin) {
// a small delay so the child can be set up
SleepMs(maxInitTime);

uint8_t testData[2] = { 13, 37 };
ASSERT_EQ(_dispatcher->PushData(sizeof(testData), testData), ::Thunder::Core::ERROR_NONE);
}

ASSERT_EQ(testAdmin.Wait(initHandshakeValue), ::Thunder::Core::ERROR_NONE);
};

IPTestAdministrator testAdmin(callback_parent, callback_child, initHandshakeValue, maxWaitTime);

// Code after this line is executed by both parent and child

::Thunder::Core::Singleton::Dispose();
}

TEST_F(Core_MessageDispatcher, PushDataShouldNotFitWhenExcedingDataBufferSize)
Expand Down