Skip to content

Commit de224a3

Browse files
Fix tests
Signed-off-by: Eugenio Collado <eugeniocollado@eprosima.com>
1 parent 41865e1 commit de224a3

File tree

7 files changed

+40
-37
lines changed

7 files changed

+40
-37
lines changed

src/cpp/fastdds/domain/DomainParticipantImpl.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2035,7 +2035,7 @@ ReturnCode_t DomainParticipantImpl::check_qos(
20352035
return RETCODE_INCONSISTENT_POLICY;
20362036
}
20372037
}
2038-
2038+
20392039
// Check participant's wire protocol (builtin flow controller) configuration
20402040
if (RETCODE_OK == ret_val)
20412041
{
@@ -2048,10 +2048,11 @@ ReturnCode_t DomainParticipantImpl::check_qos(
20482048

20492049
// Check if any flow controller matches the builtin flow controller name
20502050
bool found = std::any_of(flow_controllers.begin(), flow_controllers.end(),
2051-
[&builtin_flow_controller_name](const std::shared_ptr<fastdds::rtps::FlowControllerDescriptor>& fc)
2052-
{
2053-
return fc && fc->name == builtin_flow_controller_name;
2054-
});
2051+
[&builtin_flow_controller_name](const std::shared_ptr<fastdds::rtps::
2052+
FlowControllerDescriptor>& fc)
2053+
{
2054+
return fc && fc->name == builtin_flow_controller_name;
2055+
});
20552056

20562057
if (!found)
20572058
{
@@ -2117,7 +2118,8 @@ bool DomainParticipantImpl::can_qos_be_updated(
21172118
from.wire_protocol().builtin.writerHistoryMemoryPolicy) ||
21182119
!(to.wire_protocol().builtin.writerPayloadSize == from.wire_protocol().builtin.writerPayloadSize) ||
21192120
!(to.wire_protocol().builtin.mutation_tries == from.wire_protocol().builtin.mutation_tries) ||
2120-
!(to.wire_protocol().builtin.flow_controller_name == from.wire_protocol().builtin.flow_controller_name) ||
2121+
!(to.wire_protocol().builtin.flow_controller_name ==
2122+
from.wire_protocol().builtin.flow_controller_name) ||
21212123
!(to.wire_protocol().builtin.avoid_builtin_multicast ==
21222124
from.wire_protocol().builtin.avoid_builtin_multicast) ||
21232125
!(to.wire_protocol().builtin.discovery_config.discoveryProtocol ==

src/cpp/rtps/builtin/discovery/participant/PDP.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1701,7 +1701,8 @@ WriterAttributes PDP::static_create_builtin_writer_attributes(
17011701
if (!pattr.flow_controllers.empty())
17021702
{
17031703
attributes.mode = ASYNCHRONOUS_WRITER;
1704-
attributes.flow_controller_name = (pattr.builtin.flow_controller_name != "") ? pattr.builtin.flow_controller_name : fastdds::rtps::async_flow_controller_name;
1704+
attributes.flow_controller_name = (pattr.builtin.flow_controller_name !=
1705+
"") ? pattr.builtin.flow_controller_name : fastdds::rtps::async_flow_controller_name;
17051706
}
17061707

17071708
attributes.times.heartbeat_period = pdp_heartbeat_period;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1005,7 +1005,7 @@ class PubSubWriter
10051005
new_flow_controller->period_ms = static_cast<uint64_t>(periodInMs);
10061006
participant_qos_.flow_controllers().push_back(new_flow_controller);
10071007
participant_qos_.wire_protocol().builtin.flow_controller_name = new_flow_controller->name;
1008-
1008+
10091009
return *this;
10101010
}
10111011

test/blackbox/common/BlackboxTestsDiscovery.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1717,7 +1717,7 @@ TEST_P(Discovery, single_unicast_pdp_response_flowcontroller_limited)
17171717

17181718
std::this_thread::sleep_for(std::chrono::milliseconds(100));
17191719
// No more messages have been sent sin the limit was reached
1720-
EXPECT_EQ(num_unicast_sends.load(std::memory_order::memory_order_seq_cst),num_unicast_sends_limit);
1720+
EXPECT_EQ(num_unicast_sends.load(std::memory_order::memory_order_seq_cst), num_unicast_sends_limit);
17211721

17221722
// Clean up
17231723
participants.clear();

test/blackbox/common/BlackboxTestsPubSubFlowControllers.cpp

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ TEST_P(PubSubFlowControllers, BuiltinFlowControllerPubSub)
324324
reader.block_for_all();
325325
}
326326

327-
// This test checks that the PDP discovery process is not successful when the builtin
327+
// This test checks that the PDP discovery process is not successful when the builtin
328328
// flow controller is set with not enough size to send the PDP
329329
TEST_P(PubSubFlowControllers, BuiltinFlowControllerFailDiscovery)
330330
{
@@ -344,7 +344,7 @@ TEST_P(PubSubFlowControllers, BuiltinFlowControllerFailDiscovery)
344344
ASSERT_TRUE(writer.isInitialized());
345345

346346
// Reader discovery should fail
347-
ASSERT_FALSE(reader.wait_participant_discovery(1,std::chrono::seconds(1)));
347+
ASSERT_FALSE(reader.wait_participant_discovery(1, std::chrono::seconds(1)));
348348
}
349349

350350
// This test checks that the WLP service is not able to send non stop liveliness messages when the builtin
@@ -357,14 +357,13 @@ TEST_P(PubSubFlowControllers, BuiltinFlowControllerWLPLimited)
357357

358358
unsigned int lease_duration_ms = 501;
359359
unsigned int announcement_period_ms = 200;
360-
360+
361361
PubSubReader<Data64kbPubSubType> reader(TEST_TOPIC_NAME);
362362
PubSubWriter<Data64kbPubSubType> writer(TEST_TOPIC_NAME);
363363

364364
reader.reliability(eprosima::fastdds::dds::RELIABLE_RELIABILITY_QOS)
365365
.liveliness_kind(eprosima::fastdds::dds::AUTOMATIC_LIVELINESS_QOS)
366366
.liveliness_lease_duration(lease_duration_ms * 1e-3).init();
367-
// .liveliness_announcement_period(announcement_period_ms * 1e-3)
368367

369368
ASSERT_TRUE(reader.isInitialized());
370369

@@ -382,19 +381,18 @@ TEST_P(PubSubFlowControllers, BuiltinFlowControllerWLPLimited)
382381
// Wait for discovery.
383382
writer.wait_discovery();
384383
reader.wait_discovery();
385-
384+
386385
// Once asserted that the writer is matched, it should eventually be declared as not alive because the
387386
// flow controller will not allow the wlp writer to send more liveliness messages
388-
389387
std::atomic<bool> stop(false);
390-
auto assert_liveliness_func = [&writer, &reader, lease_duration_ms, &stop]()
391-
{
392-
while (!stop)
393-
{
394-
writer.assert_liveliness();
395-
std::this_thread::sleep_for(std::chrono::milliseconds(lease_duration_ms / 10));
396-
}
397-
};
388+
auto assert_liveliness_func = [&writer, lease_duration_ms, &stop]()
389+
{
390+
while (!stop)
391+
{
392+
writer.assert_liveliness();
393+
std::this_thread::sleep_for(std::chrono::milliseconds(lease_duration_ms / 10));
394+
}
395+
};
398396
std::thread liveliness_thread(assert_liveliness_func);
399397

400398
reader.wait_liveliness_lost(1);

test/dds/xtypes/TypeLookupServiceSubscriber.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,8 @@ void TypeLookupServiceSubscriber::on_participant_discovery(
488488
static_cast<void>(should_be_ignored);
489489
if (status == ParticipantDiscoveryStatus::DISCOVERED_PARTICIPANT)
490490
{
491-
std::cout << "Participant " << participant->guid() << " discovered participant " << info.guid << ": " << ++participant_matched_ << std::endl;
491+
std::cout << "Participant " << participant->guid() << " discovered participant " << info.guid << ": " <<
492+
++participant_matched_ << std::endl;
492493
}
493494
else if (status == ParticipantDiscoveryStatus::CHANGED_QOS_PARTICIPANT)
494495
{
@@ -498,7 +499,8 @@ void TypeLookupServiceSubscriber::on_participant_discovery(
498499
else if (status == ParticipantDiscoveryStatus::REMOVED_PARTICIPANT ||
499500
status == ParticipantDiscoveryStatus::DROPPED_PARTICIPANT)
500501
{
501-
std::cout << "Participant " << participant->guid() << " undiscovered participant " << info.guid << ": " << --participant_matched_ << std::endl;
502+
std::cout << "Participant " << participant->guid() << " undiscovered participant " << info.guid << ": " <<
503+
--participant_matched_ << std::endl;
502504
}
503505
cv_.notify_all();
504506
}

test/dds/xtypes/TypeLookupService_main.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -118,34 +118,34 @@ int main(
118118
// This case checks that the TypeLookUpService is controller by builtin flow controller, so it will
119119
// not be able to send the type object because the builtin flow controller is too small, thus there will
120120
// be no data writer to discover.
121-
if (args.builtin_flow_controller_bytes <= 3000)
121+
if (args.builtin_flow_controller_bytes > 0 && args.builtin_flow_controller_bytes <= 3000)
122122
{
123123
return (pub.init(args.seed % 230, args.known_types, args.builtin_flow_controller_bytes) &&
124-
!pub.wait_discovery(args.expected_matches, args.timeout)) ? 0 : -1;
124+
!pub.wait_discovery(args.expected_matches, args.timeout)) ? 0 : -1;
125125
}
126126
else
127127
{
128128
return (pub.init(args.seed % 230, args.known_types, args.builtin_flow_controller_bytes) &&
129-
pub.wait_discovery(args.expected_matches, args.timeout) &&
130-
pub.run(args.samples, args.timeout) &&
131-
pub.wait_discovery(0, args.timeout)) ? 0 : -1;
129+
pub.wait_discovery(args.expected_matches, args.timeout) &&
130+
pub.run(args.samples, args.timeout) &&
131+
pub.wait_discovery(0, args.timeout)) ? 0 : -1;
132132
}
133133
}
134134
case 2: {
135135
eprosima::fastdds::dds::TypeLookupServiceSubscriber sub;
136-
if (args.builtin_flow_controller_bytes <= 3000)
136+
if (args.builtin_flow_controller_bytes > 0 && args.builtin_flow_controller_bytes <= 3000)
137137
{
138138
return (sub.init(args.seed % 230, args.known_types, 0) &&
139-
sub.wait_participant_discovery(args.expected_matches, args.timeout) &&
140-
// Once asserted that the participant is discovered, we assert that no type is discovered thus
141-
// not creating a data reader to match with the data writer.
142-
!sub.wait_discovery(args.expected_matches, args.timeout)) ? 0 : -1;
139+
sub.wait_participant_discovery(args.expected_matches, args.timeout) &&
140+
// Once asserted that the participant is discovered, we assert that no type is discovered thus
141+
// not creating a data reader to match with the data writer.
142+
!sub.wait_discovery(args.expected_matches, args.timeout)) ? 0 : -1;
143143
}
144144
else
145145
{
146146
return (sub.init(args.seed % 230, args.known_types, args.builtin_flow_controller_bytes) &&
147-
sub.wait_discovery(args.expected_matches, args.timeout) &&
148-
sub.run(args.samples, args.timeout)) ? 0 : -1;
147+
sub.wait_discovery(args.expected_matches, args.timeout) &&
148+
sub.run(args.samples, args.timeout)) ? 0 : -1;
149149
}
150150
}
151151
default:

0 commit comments

Comments
 (0)