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

[19870] PubSubAsReliable test fix #3994

Merged
merged 4 commits into from
Nov 13, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
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
12 changes: 6 additions & 6 deletions include/fastdds/rtps/transport/test_UDPv4TransportDescriptor.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ struct test_UDPv4TransportDescriptor : public SocketTransportDescriptor

//! Test shim parameters
//! Percentage of data messages being dropped
uint8_t dropDataMessagesPercentage;
mutable std::atomic<uint8_t> dropDataMessagesPercentage;
JesusPoderoso marked this conversation as resolved.
Show resolved Hide resolved
//! Filtering function for dropping data messages
filter drop_data_messages_filter_;
//! Flag to enable dropping of discovery Participant DATA(P) messages
Expand All @@ -48,24 +48,24 @@ struct test_UDPv4TransportDescriptor : public SocketTransportDescriptor
//! Flag to enable dropping of discovery Reader DATA(R) messages
bool dropSubscriptionBuiltinTopicData;
//! Percentage of data fragments being dropped
uint8_t dropDataFragMessagesPercentage;
mutable std::atomic<uint8_t> dropDataFragMessagesPercentage;
//! Filtering function for dropping data fragments messages
filter drop_data_frag_messages_filter_;
//! Percentage of heartbeats being dropped
uint8_t dropHeartbeatMessagesPercentage;
mutable std::atomic<uint8_t> dropHeartbeatMessagesPercentage;
//! Filtering function for dropping heartbeat messages
filter drop_heartbeat_messages_filter_;
//! Percentage of AckNacks being dropped
uint8_t dropAckNackMessagesPercentage;
mutable std::atomic<uint8_t> dropAckNackMessagesPercentage;
//! Filtering function for dropping AckNacks
filter drop_ack_nack_messages_filter_;
//! Percentage of gap messages being dropped
uint8_t dropGapMessagesPercentage;
mutable std::atomic<uint8_t> dropGapMessagesPercentage;
//! Filtering function for dropping gap messages
filter drop_gap_messages_filter_;

// General drop percentage (indiscriminate)
uint8_t percentageOfMessagesToDrop;
mutable std::atomic<uint8_t> percentageOfMessagesToDrop;
// General filtering function for all kind of messages (indiscriminate)
filter messages_filter_;

Expand Down
2 changes: 1 addition & 1 deletion src/cpp/rtps/transport/test_UDPv4Transport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ bool test_UDPv4Transport::log_drop(
bool test_UDPv4Transport::should_be_dropped(
PercentageData* percent)
{
percent->accumulator += percent->percentage;
percent->accumulator += percent->percentage.load();
if (percent->accumulator >= 100u)
{
percent->accumulator -= 100u;
Expand Down
4 changes: 2 additions & 2 deletions src/cpp/rtps/transport/test_UDPv4Transport.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,13 @@ class test_UDPv4Transport : public UDPv4Transport
struct PercentageData
{
PercentageData(
uint8_t percent)
std::atomic<uint8_t>& percent)
: percentage(percent)
, accumulator(0)
{
}

uint8_t percentage;
std::atomic<uint8_t>& percentage;
uint8_t accumulator;
};

Expand Down
5 changes: 5 additions & 0 deletions test/blackbox/common/BlackboxTestsPubSubHistory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -992,6 +992,11 @@ TEST_P(PubSubHistory, PubSubAsReliableKeepLastWithKeyUnorderedReception)
writer.send(data);
ASSERT_TRUE(data.empty());

reader.block_for_at_least(static_cast<size_t>(keys * depth * 0.1));

//! Avoid dropping determiniscally the same re-sent samples
JesusPoderoso marked this conversation as resolved.
Show resolved Hide resolved
testTransport->dropDataMessagesPercentage.store(10);

reader.block_for_all();
reader.stopReception();
}
Expand Down
Loading