Skip to content

Commit ce6134a

Browse files
author
huangjialu
committed
Add regression testing
Signed-off-by: huangjialu <[email protected]>
1 parent 4dc8d8a commit ce6134a

File tree

2 files changed

+55
-0
lines changed

2 files changed

+55
-0
lines changed

test/blackbox/api/dds-pim/PubSubWriter.hpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1418,6 +1418,13 @@ class PubSubWriter
14181418
return *this;
14191419
}
14201420

1421+
PubSubWriter& publisher_groupData(
1422+
std::vector<eprosima::fastdds::rtps::octet> group_data)
1423+
{
1424+
publisher_qos_.group_data() = group_data;
1425+
return *this;
1426+
}
1427+
14211428
PubSubWriter& user_data_max_size(
14221429
uint32_t max_user_data)
14231430
{

test/blackbox/common/BlackboxTestsDiscovery.cpp

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1661,3 +1661,51 @@ TEST(Discovery, discovery_cyclone_participant_with_custom_pid)
16611661
/* Clean up */
16621662
factory->delete_participant(participant);
16631663
}
1664+
1665+
//! Using the service to discover that the total sum of USER_DATA and GROUP DATA
1666+
//! data exceeds uint16ut byte CDR regression testing
1667+
//! Regression test for support case #5154
1668+
TEST_P(Discovery, CdrWriteDataLength)
1669+
{
1670+
PubSubReader<HelloWorldPubSubType> reader(TEST_TOPIC_NAME);
1671+
PubSubWriter<HelloWorldPubSubType> writer(TEST_TOPIC_NAME);
1672+
1673+
std::size_t user_size = 65500;
1674+
std::vector<eprosima::fastdds::rtps::octet> user_data;
1675+
user_data.resize(user_size);
1676+
std::size_t group_size = 65000;
1677+
std::vector<eprosima::fastdds::rtps::octet> group_data;
1678+
group_data.resize(group_size);
1679+
writer.history_depth(100).
1680+
endpoint_userData(user_data).publisher_groupData(group_data).init();
1681+
1682+
ASSERT_TRUE(writer.isInitialized());
1683+
1684+
reader.setOnEndpointDiscoveryFunction([&writer, &user_size, &group_size](WriterDiscoveryStatus /*reason*/,
1685+
const PublicationBuiltinTopicData& info) -> bool
1686+
{
1687+
if (info.guid == writer.datawriter_guid())
1688+
{
1689+
std::cout << "Received USER_DATA size from the writer program: "
1690+
<< info.user_data.size() << std::endl;
1691+
std::cout << "Received GROUP_DATA size from the writer program: "
1692+
<< info.group_data.size() << std::endl;
1693+
1694+
return info.user_data.size() == user_size && info.group_data.size() == group_size;
1695+
}
1696+
1697+
return false;
1698+
});
1699+
1700+
reader.history_depth(100).
1701+
reliability(eprosima::fastdds::dds::RELIABLE_RELIABILITY_QOS).init();
1702+
1703+
ASSERT_TRUE(reader.isInitialized());
1704+
1705+
1706+
reader.wait_discovery();
1707+
writer.wait_discovery();
1708+
1709+
reader.wait_discovery_result();
1710+
1711+
}

0 commit comments

Comments
 (0)