From a36fee6b4ea94565f4733e8ca5cae55e3082e015 Mon Sep 17 00:00:00 2001 From: huangjialu Date: Tue, 13 Aug 2024 10:35:51 +0800 Subject: [PATCH 1/3] repair service found that CDR serial transmission data has a maximum of 65535 bytes Signed-off-by: huangjialu --- src/cpp/rtps/builtin/discovery/endpoint/EDPSimple.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cpp/rtps/builtin/discovery/endpoint/EDPSimple.cpp b/src/cpp/rtps/builtin/discovery/endpoint/EDPSimple.cpp index 861b47a0d76..fe52c0f596a 100644 --- a/src/cpp/rtps/builtin/discovery/endpoint/EDPSimple.cpp +++ b/src/cpp/rtps/builtin/discovery/endpoint/EDPSimple.cpp @@ -615,7 +615,7 @@ bool EDPSimple::serialize_proxy_data( #endif // if __BIG_ENDIAN__ data.writeToCDRMessage(&aux_msg, true); - change->serializedPayload.length = (uint16_t)aux_msg.length; + change->serializedPayload.length = aux_msg.length; if (remove_same_instance) { From 4aab850168f5485866795d9c8721e2f5d451ed67 Mon Sep 17 00:00:00 2001 From: huangjialu Date: Wed, 28 Aug 2024 14:09:24 +0800 Subject: [PATCH 2/3] Add regression testing Signed-off-by: huangjialu --- test/blackbox/api/dds-pim/PubSubWriter.hpp | 7 +++ .../common/BlackboxTestsDiscovery.cpp | 48 +++++++++++++++++++ 2 files changed, 55 insertions(+) diff --git a/test/blackbox/api/dds-pim/PubSubWriter.hpp b/test/blackbox/api/dds-pim/PubSubWriter.hpp index e39b2cd70a0..9447071437f 100644 --- a/test/blackbox/api/dds-pim/PubSubWriter.hpp +++ b/test/blackbox/api/dds-pim/PubSubWriter.hpp @@ -1418,6 +1418,13 @@ class PubSubWriter return *this; } + PubSubWriter& publisher_groupData( + std::vector group_data) + { + publisher_qos_.group_data() = group_data; + return *this; + } + PubSubWriter& user_data_max_size( uint32_t max_user_data) { diff --git a/test/blackbox/common/BlackboxTestsDiscovery.cpp b/test/blackbox/common/BlackboxTestsDiscovery.cpp index ad8f29561ce..aac78565637 100644 --- a/test/blackbox/common/BlackboxTestsDiscovery.cpp +++ b/test/blackbox/common/BlackboxTestsDiscovery.cpp @@ -1661,3 +1661,51 @@ TEST(Discovery, discovery_cyclone_participant_with_custom_pid) /* Clean up */ factory->delete_participant(participant); } + +//! Using the service to discover that the total sum of USER_DATA and GROUP DATA +//! data exceeds uint16ut byte CDR regression testing +//! Regression test for support case #5154 +TEST_P(Discovery, CdrWriteDataLength) +{ + PubSubReader reader(TEST_TOPIC_NAME); + PubSubWriter writer(TEST_TOPIC_NAME); + + std::size_t user_size = 65500; + std::vector user_data; + user_data.resize(user_size); + std::size_t group_size = 65000; + std::vector group_data; + group_data.resize(group_size); + writer.history_depth(100). + endpoint_userData(user_data).publisher_groupData(group_data).init(); + + ASSERT_TRUE(writer.isInitialized()); + + reader.setOnEndpointDiscoveryFunction([&writer, &user_size, &group_size](WriterDiscoveryStatus /*reason*/, + const PublicationBuiltinTopicData& info) -> bool + { + if (info.guid == writer.datawriter_guid()) + { + std::cout << "Received USER_DATA size from the writer program: " + << info.user_data.size() << std::endl; + std::cout << "Received GROUP_DATA size from the writer program: " + << info.group_data.size() << std::endl; + + return info.user_data.size() == user_size && info.group_data.size() == group_size; + } + + return false; + }); + + reader.history_depth(100). + reliability(eprosima::fastdds::dds::RELIABLE_RELIABILITY_QOS).init(); + + ASSERT_TRUE(reader.isInitialized()); + + + reader.wait_discovery(); + writer.wait_discovery(); + + reader.wait_discovery_result(); + +} \ No newline at end of file From 6cdc22cc19a9029f26e8db9bcf08d0021ce40333 Mon Sep 17 00:00:00 2001 From: huangjialu Date: Wed, 28 Aug 2024 14:26:47 +0800 Subject: [PATCH 3/3] fix ci Signed-off-by: huangjialu --- test/blackbox/common/BlackboxTestsDiscovery.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/blackbox/common/BlackboxTestsDiscovery.cpp b/test/blackbox/common/BlackboxTestsDiscovery.cpp index aac78565637..28fe6e54f33 100644 --- a/test/blackbox/common/BlackboxTestsDiscovery.cpp +++ b/test/blackbox/common/BlackboxTestsDiscovery.cpp @@ -1687,9 +1687,9 @@ TEST_P(Discovery, CdrWriteDataLength) if (info.guid == writer.datawriter_guid()) { std::cout << "Received USER_DATA size from the writer program: " - << info.user_data.size() << std::endl; + << info.user_data.size() << std::endl; std::cout << "Received GROUP_DATA size from the writer program: " - << info.group_data.size() << std::endl; + << info.group_data.size() << std::endl; return info.user_data.size() == user_size && info.group_data.size() == group_size; }