From 69ef2f52349af817334261d51dfecea46e254b34 Mon Sep 17 00:00:00 2001 From: Eduardo Ponz Segrelles Date: Mon, 27 Nov 2023 06:51:23 +0100 Subject: [PATCH] Add missing thread include (#4045) * Refs #19887: Add missing thread include Signed-off-by: EduPonz * Refs #19887. Update `ReturnCode_t` comparison operators. Signed-off-by: Miguel Company * Refs #19887: Uncrustify Signed-off-by: EduPonz --------- Signed-off-by: EduPonz Signed-off-by: Miguel Company Co-authored-by: Miguel Company (cherry picked from commit 6390715a1df8eb487fd20ad501893870da281117) # Conflicts: # test/unittest/dds/publisher/DataWriterTests.cpp # test/unittest/rtps/flowcontrol/FlowControllerPublishModesOnAsyncTests.cpp # test/unittest/rtps/flowcontrol/FlowControllerPublishModesOnLimitedAsyncTests.cpp # test/unittest/rtps/flowcontrol/FlowControllerPublishModesOnPureSyncTests.cpp # test/unittest/rtps/flowcontrol/FlowControllerPublishModesOnSyncTests.cpp # test/unittest/rtps/flowcontrol/FlowControllerSchedulersTests.cpp --- include/fastrtps/types/TypesBase.h | 28 +++- .../common/BlackboxTestsDeadlineQos.cpp | 13 +- .../BlackboxTestsPubSubFlowControllers.cpp | 10 +- .../common/BlackboxTestsPubSubFragments.cpp | 9 +- .../common/BlackboxTestsPubSubHistory.cpp | 9 +- .../common/BlackboxTestsReliability.cpp | 9 +- .../common/DDSBlackboxTestsContentFilter.cpp | 13 +- .../common/DDSBlackboxTestsDataReader.cpp | 10 +- .../common/DDSBlackboxTestsDataSharing.cpp | 15 +- .../common/DDSBlackboxTestsListeners.cpp | 1 + .../common/DDSBlackboxTestsOwnershipQos.cpp | 11 +- .../common/DDSBlackboxTestsPersistence.cpp | 14 +- test/performance/video/VideoTestPublisher.cpp | 134 ++++++++++------ .../performance/video/VideoTestSubscriber.cpp | 13 +- test/performance/video/main_VideoTest.cpp | 20 +-- test/profiling/MemoryTestPublisher.cpp | 150 +++++++++++------- test/profiling/MemoryTestSubscriber.cpp | 125 +++++++++------ .../allocations/AllocTestPublisher.cpp | 10 +- .../allocations/AllocTestSubscriber.cpp | 10 +- test/profiling/main_MemoryTest.cpp | 19 +-- .../dds/core/condition/ConditionTests.cpp | 10 +- test/unittest/dds/core/entity/EntityTests.cpp | 9 +- .../dds/publisher/DataWriterTests.cpp | 25 ++- .../unittest/logging/log_macros/LogMacros.hpp | 6 +- ...FlowControllerPublishModesOnAsyncTests.cpp | 21 +++ ...trollerPublishModesOnLimitedAsyncTests.cpp | 21 +++ ...wControllerPublishModesOnPureSyncTests.cpp | 21 +++ .../FlowControllerPublishModesOnSyncTests.cpp | 21 +++ .../FlowControllerSchedulersTests.cpp | 22 +++ .../security/logging/LoggingPluginTests.hpp | 122 +++++++------- .../statistics/rtps/RTPSStatisticsTests.cpp | 8 +- 31 files changed, 587 insertions(+), 322 deletions(-) diff --git a/include/fastrtps/types/TypesBase.h b/include/fastrtps/types/TypesBase.h index e9f346b8ef1..be281047aa5 100644 --- a/include/fastrtps/types/TypesBase.h +++ b/include/fastrtps/types/TypesBase.h @@ -246,20 +246,32 @@ class RTPS_DllAPI ReturnCode_t }; -template -typename std::enable_if::value || std::is_enum::value, bool>::type -operator ==( - T a, +RTPS_DllAPI inline bool operator ==( + ReturnCode_t::ReturnCodeValue a, const ReturnCode_t& b) { return b.operator ==( a); } -template -typename std::enable_if::value || std::is_enum::value, bool>::type -operator !=( - T a, +RTPS_DllAPI inline bool operator !=( + ReturnCode_t::ReturnCodeValue a, + const ReturnCode_t& b) +{ + return b.operator !=( + a); +} + +RTPS_DllAPI inline bool operator ==( + uint32_t a, + const ReturnCode_t& b) +{ + return b.operator ==( + a); +} + +RTPS_DllAPI inline bool operator !=( + uint32_t a, const ReturnCode_t& b) { return b.operator !=( diff --git a/test/blackbox/common/BlackboxTestsDeadlineQos.cpp b/test/blackbox/common/BlackboxTestsDeadlineQos.cpp index 3be213bced2..b97bd366859 100644 --- a/test/blackbox/common/BlackboxTestsDeadlineQos.cpp +++ b/test/blackbox/common/BlackboxTestsDeadlineQos.cpp @@ -12,18 +12,19 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "BlackboxTests.hpp" - -#include "PubSubReader.hpp" -#include "PubSubWriter.hpp" -#include "ReqRepAsReliableHelloWorldRequester.hpp" -#include "ReqRepAsReliableHelloWorldReplier.hpp" +#include #include #include #include +#include "BlackboxTests.hpp" +#include "PubSubReader.hpp" +#include "PubSubWriter.hpp" +#include "ReqRepAsReliableHelloWorldReplier.hpp" +#include "ReqRepAsReliableHelloWorldRequester.hpp" + using namespace eprosima::fastrtps; using namespace eprosima::fastrtps::rtps; diff --git a/test/blackbox/common/BlackboxTestsPubSubFlowControllers.cpp b/test/blackbox/common/BlackboxTestsPubSubFlowControllers.cpp index bde2389b62e..439ad1c548e 100644 --- a/test/blackbox/common/BlackboxTestsPubSubFlowControllers.cpp +++ b/test/blackbox/common/BlackboxTestsPubSubFlowControllers.cpp @@ -12,14 +12,16 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "BlackboxTests.hpp" +#include + +#include + +#include +#include "BlackboxTests.hpp" #include "PubSubReader.hpp" #include "PubSubWriter.hpp" #include "PubSubWriterReader.hpp" -#include - -#include using namespace eprosima::fastrtps; using namespace eprosima::fastrtps::rtps; diff --git a/test/blackbox/common/BlackboxTestsPubSubFragments.cpp b/test/blackbox/common/BlackboxTestsPubSubFragments.cpp index 122fd61ff82..9df48268914 100644 --- a/test/blackbox/common/BlackboxTestsPubSubFragments.cpp +++ b/test/blackbox/common/BlackboxTestsPubSubFragments.cpp @@ -12,13 +12,14 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "BlackboxTests.hpp" - -#include "PubSubReader.hpp" -#include "PubSubWriter.hpp" +#include #include #include + +#include "BlackboxTests.hpp" +#include "PubSubReader.hpp" +#include "PubSubWriter.hpp" #include using namespace eprosima::fastrtps; diff --git a/test/blackbox/common/BlackboxTestsPubSubHistory.cpp b/test/blackbox/common/BlackboxTestsPubSubHistory.cpp index a7a26d77b94..e7f7b560351 100644 --- a/test/blackbox/common/BlackboxTestsPubSubHistory.cpp +++ b/test/blackbox/common/BlackboxTestsPubSubHistory.cpp @@ -13,16 +13,17 @@ // limitations under the License. #include +#include #include -#include "BlackboxTests.hpp" +#include + +#include +#include "BlackboxTests.hpp" #include "PubSubReader.hpp" #include "PubSubWriter.hpp" - -#include #include -#include using namespace eprosima::fastrtps; using namespace eprosima::fastdds::rtps; diff --git a/test/blackbox/common/BlackboxTestsReliability.cpp b/test/blackbox/common/BlackboxTestsReliability.cpp index ed910e7b8b3..50e37c33f42 100644 --- a/test/blackbox/common/BlackboxTestsReliability.cpp +++ b/test/blackbox/common/BlackboxTestsReliability.cpp @@ -12,14 +12,15 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "BlackboxTests.hpp" - -#include "PubSubReader.hpp" -#include "PubSubWriter.hpp" +#include #include #include + +#include "BlackboxTests.hpp" +#include "PubSubReader.hpp" +#include "PubSubWriter.hpp" #include using namespace eprosima::fastrtps; diff --git a/test/blackbox/common/DDSBlackboxTestsContentFilter.cpp b/test/blackbox/common/DDSBlackboxTestsContentFilter.cpp index 77cc5813631..e18f9f24e8d 100644 --- a/test/blackbox/common/DDSBlackboxTestsContentFilter.cpp +++ b/test/blackbox/common/DDSBlackboxTestsContentFilter.cpp @@ -13,26 +13,23 @@ // limitations under the License. #include +#include #include #include -#include #include - +#include #include - #include #include -#include "BlackboxTests.hpp" - -#include "PubSubReader.hpp" -#include "PubSubWriter.hpp" - #include "../types/HelloWorldTypeObject.h" #include "../types/TestRegression3361PubSubTypes.h" #include "../types/TestRegression3361TypeObject.h" +#include "BlackboxTests.hpp" +#include "PubSubReader.hpp" +#include "PubSubWriter.hpp" namespace eprosima { namespace fastdds { diff --git a/test/blackbox/common/DDSBlackboxTestsDataReader.cpp b/test/blackbox/common/DDSBlackboxTestsDataReader.cpp index ab4ce661d3f..46778700c49 100644 --- a/test/blackbox/common/DDSBlackboxTestsDataReader.cpp +++ b/test/blackbox/common/DDSBlackboxTestsDataReader.cpp @@ -12,14 +12,16 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "BlackboxTests.hpp" +#include + +#include + +#include +#include "BlackboxTests.hpp" #include "PubSubParticipant.hpp" #include "PubSubReader.hpp" #include "PubSubWriter.hpp" -#include - -#include using namespace eprosima::fastrtps; using namespace eprosima::fastrtps::rtps; diff --git a/test/blackbox/common/DDSBlackboxTestsDataSharing.cpp b/test/blackbox/common/DDSBlackboxTestsDataSharing.cpp index 5a07c6daf53..919954d8648 100644 --- a/test/blackbox/common/DDSBlackboxTestsDataSharing.cpp +++ b/test/blackbox/common/DDSBlackboxTestsDataSharing.cpp @@ -12,18 +12,19 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "BlackboxTests.hpp" +#include +#include +#include -#include +#include -#include "PubSubReader.hpp" -#include "PubSubWriter.hpp" +#include #include #include -#include -#include -#include +#include "BlackboxTests.hpp" +#include "PubSubReader.hpp" +#include "PubSubWriter.hpp" using namespace eprosima::fastrtps; using namespace eprosima::fastrtps::rtps; diff --git a/test/blackbox/common/DDSBlackboxTestsListeners.cpp b/test/blackbox/common/DDSBlackboxTestsListeners.cpp index 1b7e05f0678..5a9acdf4f02 100644 --- a/test/blackbox/common/DDSBlackboxTestsListeners.cpp +++ b/test/blackbox/common/DDSBlackboxTestsListeners.cpp @@ -13,6 +13,7 @@ // limitations under the License. #include +#include #include #include diff --git a/test/blackbox/common/DDSBlackboxTestsOwnershipQos.cpp b/test/blackbox/common/DDSBlackboxTestsOwnershipQos.cpp index 3152124c327..dc2b92d9ac7 100644 --- a/test/blackbox/common/DDSBlackboxTestsOwnershipQos.cpp +++ b/test/blackbox/common/DDSBlackboxTestsOwnershipQos.cpp @@ -12,15 +12,16 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "BlackboxTests.hpp" - -#include "PubSubReader.hpp" -#include "PubSubWriter.hpp" +#include #include -#include #include +#include + +#include "BlackboxTests.hpp" +#include "PubSubReader.hpp" +#include "PubSubWriter.hpp" using namespace eprosima::fastrtps; using namespace eprosima::fastrtps::rtps; diff --git a/test/blackbox/common/DDSBlackboxTestsPersistence.cpp b/test/blackbox/common/DDSBlackboxTestsPersistence.cpp index 237f30be9fa..ba702e05d3b 100644 --- a/test/blackbox/common/DDSBlackboxTestsPersistence.cpp +++ b/test/blackbox/common/DDSBlackboxTestsPersistence.cpp @@ -12,16 +12,18 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "BlackboxTests.hpp" +#include + +#include -#include "PubSubReader.hpp" -#include "PubSubWriter.hpp" -#include "ReqRepAsReliableHelloWorldRequester.hpp" -#include "ReqRepAsReliableHelloWorldReplier.hpp" #include #include -#include +#include "BlackboxTests.hpp" +#include "PubSubReader.hpp" +#include "PubSubWriter.hpp" +#include "ReqRepAsReliableHelloWorldReplier.hpp" +#include "ReqRepAsReliableHelloWorldRequester.hpp" using namespace eprosima::fastrtps; using namespace eprosima::fastrtps::rtps; diff --git a/test/performance/video/VideoTestPublisher.cpp b/test/performance/video/VideoTestPublisher.cpp index 48eb52bf576..52eadbcecb5 100644 --- a/test/performance/video/VideoTestPublisher.cpp +++ b/test/performance/video/VideoTestPublisher.cpp @@ -18,12 +18,14 @@ */ #include "VideoTestPublisher.hpp" -#include -#include "fastrtps/log/Colors.h" -#include +#include #include -#include +#include + +#include +#include +#include #define TIME_LIMIT_US 10000 @@ -91,11 +93,23 @@ VideoTestPublisher::~VideoTestPublisher() Domain::removeParticipant(mp_participant); } - -bool VideoTestPublisher::init(int n_sub, int n_sam, bool reliable, uint32_t pid, bool hostname, - const PropertyPolicy& part_property_policy, const PropertyPolicy& property_policy, bool large_data, - const std::string& sXMLConfigFile, int test_time, int drop_rate, int max_sleep_time, - int forced_domain, int videoWidth, int videoHeight, int videoFrameRate) +bool VideoTestPublisher::init( + int n_sub, + int n_sam, + bool reliable, + uint32_t pid, + bool hostname, + const PropertyPolicy& part_property_policy, + const PropertyPolicy& property_policy, + bool large_data, + const std::string& sXMLConfigFile, + int test_time, + int drop_rate, + int max_sleep_time, + int forced_domain, + int videoWidth, + int videoHeight, + int videoFrameRate) { large_data = true; m_testTime = test_time; @@ -127,13 +141,13 @@ bool VideoTestPublisher::init(int n_sub, int n_sam, bool reliable, uint32_t pid, PParam.rtps.properties = part_property_policy; PParam.rtps.setName("video_test_publisher"); - if(m_sXMLConfigFile.length() > 0) + if (m_sXMLConfigFile.length() > 0) { if (m_forcedDomain >= 0) { ParticipantAttributes participant_att; if (eprosima::fastrtps::xmlparser::XMLP_ret::XML_OK == - eprosima::fastrtps::xmlparser::XMLProfileManager::fillParticipantAttributes(participant_profile_name, + eprosima::fastrtps::xmlparser::XMLProfileManager::fillParticipantAttributes(participant_profile_name, participant_att)) { participant_att.domainId = m_forcedDomain; @@ -150,7 +164,7 @@ bool VideoTestPublisher::init(int n_sub, int n_sam, bool reliable, uint32_t pid, mp_participant = Domain::createParticipant(PParam); } - if(mp_participant == nullptr) + if (mp_participant == nullptr) { return false; } @@ -175,7 +189,7 @@ bool VideoTestPublisher::init(int n_sub, int n_sam, bool reliable, uint32_t pid, PubDataparam.qos.m_publishMode.kind = eprosima::fastrtps::ASYNCHRONOUS_PUBLISH_MODE; } - if(m_sXMLConfigFile.length() > 0) + if (m_sXMLConfigFile.length() > 0) { eprosima::fastrtps::xmlparser::XMLProfileManager::fillPublisherAttributes(profile_name, PubDataparam); } @@ -246,16 +260,18 @@ bool VideoTestPublisher::init(int n_sub, int n_sam, bool reliable, uint32_t pid, return true; } -void VideoTestPublisher::DataPubListener::onPublicationMatched(Publisher* /*pub*/, MatchingInfo& info) +void VideoTestPublisher::DataPubListener::onPublicationMatched( + Publisher* /*pub*/, + MatchingInfo& info) { std::unique_lock lock(mp_up->mutex_); - if(info.status == MATCHED_MATCHING) + if (info.status == MATCHED_MATCHING) { - cout << C_MAGENTA << "Data Pub Matched "< mp_up->n_subscribers) + if (n_matched > mp_up->n_subscribers) { std::cout << "More matched subscribers than expected" << std::endl; mp_up->m_status = -1; @@ -272,16 +288,18 @@ void VideoTestPublisher::DataPubListener::onPublicationMatched(Publisher* /*pub* mp_up->disc_cond_.notify_one(); } -void VideoTestPublisher::CommandPubListener::onPublicationMatched(Publisher* /*pub*/, MatchingInfo& info) +void VideoTestPublisher::CommandPubListener::onPublicationMatched( + Publisher* /*pub*/, + MatchingInfo& info) { std::unique_lock lock(mp_up->mutex_); - if(info.status == MATCHED_MATCHING) + if (info.status == MATCHED_MATCHING) { - cout << C_MAGENTA << "Command Pub Matched "< mp_up->n_subscribers) + if (n_matched > mp_up->n_subscribers) { std::cout << "More matched subscribers than expected" << std::endl; mp_up->m_status = -1; @@ -298,15 +316,17 @@ void VideoTestPublisher::CommandPubListener::onPublicationMatched(Publisher* /*p mp_up->disc_cond_.notify_one(); } -void VideoTestPublisher::CommandSubListener::onSubscriptionMatched(Subscriber* /*sub*/,MatchingInfo& info) +void VideoTestPublisher::CommandSubListener::onSubscriptionMatched( + Subscriber* /*sub*/, + MatchingInfo& info) { std::unique_lock lock(mp_up->mutex_); - if(info.status == MATCHED_MATCHING) + if (info.status == MATCHED_MATCHING) { - cout << C_MAGENTA << "Command Sub Matched "< mp_up->n_subscribers) + if (n_matched > mp_up->n_subscribers) { std::cout << "More matched subscribers than expected" << std::endl; mp_up->m_status = -1; @@ -323,17 +343,18 @@ void VideoTestPublisher::CommandSubListener::onSubscriptionMatched(Subscriber* / mp_up->disc_cond_.notify_one(); } -void VideoTestPublisher::CommandSubListener::onNewDataMessage(Subscriber* subscriber) +void VideoTestPublisher::CommandSubListener::onNewDataMessage( + Subscriber* subscriber) { TestCommandType command; SampleInfo_t info; // cout << "COMMAND RECEIVED"<takeNextData((void*)&command,&info)) + if (subscriber->takeNextData((void*)&command, &info)) { - if(info.sampleKind == ALIVE) + if (info.sampleKind == ALIVE) { //cout << "ALIVE "<mutex_.lock(); @@ -344,7 +365,9 @@ void VideoTestPublisher::CommandSubListener::onNewDataMessage(Subscriber* subscr } } else - cout<< "Problem reading"< disc_lock(mutex_); - disc_cond_.wait(disc_lock, [&]() { return disc_count_ >= (n_subscribers * 3); }); + disc_cond_.wait(disc_lock, [&]() + { + return disc_count_ >= (n_subscribers * 3); + }); disc_lock.unlock(); - cout << C_B_MAGENTA << "DISCOVERY COMPLETE "<test(0); - cout << "REMOVING PUBLISHER"<mp_commandpub); - cout << "REMOVING SUBSCRIBER"< lock(mutex_); // Wait for all the subscribers - comm_cond_.wait(lock, [&]() { - return comm_count_ >= n_subscribers; - }); + comm_cond_.wait(lock, [&]() + { + return comm_count_ >= n_subscribers; + }); --comm_count_; // BEGIN THE TEST @@ -400,9 +428,10 @@ bool VideoTestPublisher::test(uint32_t datasize) // Get start time send_start_ = std::chrono::steady_clock::now(); // Wait until timer returns "finished" - timer_cond_.wait(lock, [&]() { - return timer_on_; - }); + timer_cond_.wait(lock, [&]() + { + return timer_on_; + }); // Paused the sending gst_element_set_state(pipeline, GST_STATE_PAUSED); @@ -412,13 +441,14 @@ bool VideoTestPublisher::test(uint32_t datasize) mp_commandpub->write(&command); // Wait until all subscribers unmatch - disc_cond_.wait(lock, [&]() { - return disc_count_ == 0; - }); + disc_cond_.wait(lock, [&]() + { + return disc_count_ == 0; + }); - if(m_status !=0) + if (m_status != 0) { - cout << "Error in test "<mp_video_out != nullptr) @@ -541,7 +573,7 @@ GstFlowReturn VideoTestPublisher::new_sample(GstElement *sink, VideoTestPublishe std::chrono::steady_clock::time_point send_end = std::chrono::steady_clock::now(); std::unique_lock lock(sub->mutex_); - if(std::chrono::duration>(send_end - sub->send_start_).count() >= sub->m_testTime) + if (std::chrono::duration>(send_end - sub->send_start_).count() >= sub->m_testTime) { sub->timer_on_ = true; sub->timer_cond_.notify_one(); diff --git a/test/performance/video/VideoTestSubscriber.cpp b/test/performance/video/VideoTestSubscriber.cpp index 025f10549ed..c2ef229abec 100644 --- a/test/performance/video/VideoTestSubscriber.cpp +++ b/test/performance/video/VideoTestSubscriber.cpp @@ -17,13 +17,16 @@ * */ -#include "VideoTestSubscriber.hpp" -#include -#include "fastrtps/log/Colors.h" -#include -#include #include #include +#include +#include + +#include +#include +#include + +#include "VideoTestSubscriber.hpp" using namespace eprosima; using namespace eprosima::fastrtps; diff --git a/test/performance/video/main_VideoTest.cpp b/test/performance/video/main_VideoTest.cpp index 4f518cbd2a0..45726a6c023 100644 --- a/test/performance/video/main_VideoTest.cpp +++ b/test/performance/video/main_VideoTest.cpp @@ -12,24 +12,26 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "VideoTestPublisher.hpp" -#include "VideoTestSubscriber.hpp" - -#include - -#include -#include -#include -#include #include #include +#include +#include +#include +#include +#include + #include +#include + #include #include #include #include +#include "VideoTestPublisher.hpp" +#include "VideoTestSubscriber.hpp" + #if defined(_MSC_VER) #pragma warning (push) #pragma warning (disable:4512) diff --git a/test/profiling/MemoryTestPublisher.cpp b/test/profiling/MemoryTestPublisher.cpp index af368bb196f..91b04e6dc60 100644 --- a/test/profiling/MemoryTestPublisher.cpp +++ b/test/profiling/MemoryTestPublisher.cpp @@ -18,19 +18,20 @@ */ #include "MemoryTestPublisher.h" -#include -#include "fastrtps/log/Colors.h" - -#include -#include #include +#include #include -#include +#include +#include + +#include +#include +#include #ifndef _WIN32 #define localtime_s(X, Y) localtime_r(Y, X) -#endif +#endif // ifndef _WIN32 #define TIME_LIMIT_US 10000 @@ -72,11 +73,19 @@ MemoryTestPublisher::~MemoryTestPublisher() Domain::removeParticipant(mp_participant); } - -bool MemoryTestPublisher::init(int n_sub, int n_sam, bool reliable, uint32_t pid, bool hostname, bool export_csv, - const std::string& export_prefix, const PropertyPolicy& part_property_policy, - const PropertyPolicy& property_policy, const std::string& sXMLConfigFile, - uint32_t data_size, bool dynamic_types) +bool MemoryTestPublisher::init( + int n_sub, + int n_sam, + bool reliable, + uint32_t pid, + bool hostname, + bool export_csv, + const std::string& export_prefix, + const PropertyPolicy& part_property_policy, + const PropertyPolicy& property_policy, + const std::string& sXMLConfigFile, + uint32_t data_size, + bool dynamic_types) { m_sXMLConfigFile = sXMLConfigFile; n_samples = n_sam; @@ -95,9 +104,9 @@ bool MemoryTestPublisher::init(int n_sub, int n_sam, bool reliable, uint32_t pid // Add members to the struct. struct_type_builder->add_member(0, "seqnum", DynamicTypeBuilderFactory::get_instance()->create_uint32_type()); struct_type_builder->add_member(1, "data", - DynamicTypeBuilderFactory::get_instance()->create_sequence_builder( - DynamicTypeBuilderFactory::get_instance()->create_byte_type(), ::dds::core::LENGTH_UNLIMITED - )); + DynamicTypeBuilderFactory::get_instance()->create_sequence_builder( + DynamicTypeBuilderFactory::get_instance()->create_byte_type(), ::dds::core::LENGTH_UNLIMITED + )); struct_type_builder->set_name("MemoryType"); m_pDynType = struct_type_builder->build(); @@ -144,7 +153,9 @@ bool MemoryTestPublisher::init(int n_sub, int n_sam, bool reliable, uint32_t pid std::ostringstream pt; pt << "MemoryTest_"; if (hostname) + { pt << asio::ip::host_name() << "_"; + } pt << pid << "_PUB2SUB"; PubDataparam.topic.topicName = pt.str(); if (!reliable) @@ -160,11 +171,13 @@ bool MemoryTestPublisher::init(int n_sub, int n_sam, bool reliable, uint32_t pid if (m_sXMLConfigFile.length() > 0) { - mp_datapub = Domain::createPublisher(mp_participant, profile_name, (PublisherListener*)&this->m_datapublistener); + mp_datapub = + Domain::createPublisher(mp_participant, profile_name, (PublisherListener*)&this->m_datapublistener); } else { - mp_datapub = Domain::createPublisher(mp_participant, PubDataparam, (PublisherListener*)&this->m_datapublistener); + mp_datapub = + Domain::createPublisher(mp_participant, PubDataparam, (PublisherListener*)&this->m_datapublistener); } if (mp_datapub == nullptr) @@ -180,7 +193,9 @@ bool MemoryTestPublisher::init(int n_sub, int n_sam, bool reliable, uint32_t pid std::ostringstream pct; pct << "MemoryTest_Command_"; if (hostname) + { pct << asio::ip::host_name() << "_"; + } pct << pid << "_PUB2SUB"; PubCommandParam.topic.topicName = pct.str(); PubCommandParam.topic.historyQos.kind = KEEP_ALL_HISTORY_QOS; @@ -201,7 +216,9 @@ bool MemoryTestPublisher::init(int n_sub, int n_sam, bool reliable, uint32_t pid std::ostringstream sct; sct << "MemoryTest_Command_"; if (hostname) + { sct << asio::ip::host_name() << "_"; + } sct << pid << "_SUB2PUB"; SubCommandParam.topic.topicName = sct.str(); SubCommandParam.topic.historyQos.kind = KEEP_ALL_HISTORY_QOS; @@ -226,16 +243,18 @@ bool MemoryTestPublisher::init(int n_sub, int n_sam, bool reliable, uint32_t pid return true; } -void MemoryTestPublisher::DataPubListener::onPublicationMatched(Publisher* /*pub*/, MatchingInfo& info) +void MemoryTestPublisher::DataPubListener::onPublicationMatched( + Publisher* /*pub*/, + MatchingInfo& info) { std::unique_lock lock(mp_up->mutex_); - if(info.status == MATCHED_MATCHING) + if (info.status == MATCHED_MATCHING) { - cout << C_MAGENTA << "Data Pub Matched "< mp_up->n_subscribers) + if (n_matched > mp_up->n_subscribers) { std::cout << "More matched subscribers than expected" << std::endl; mp_up->m_status = -1; @@ -245,7 +264,7 @@ void MemoryTestPublisher::DataPubListener::onPublicationMatched(Publisher* /*pub } else { - cout << C_MAGENTA << "Data Pub Unmatched "<disc_count_; } @@ -253,16 +272,18 @@ void MemoryTestPublisher::DataPubListener::onPublicationMatched(Publisher* /*pub mp_up->disc_cond_.notify_one(); } -void MemoryTestPublisher::CommandPubListener::onPublicationMatched(Publisher* /*pub*/, MatchingInfo& info) +void MemoryTestPublisher::CommandPubListener::onPublicationMatched( + Publisher* /*pub*/, + MatchingInfo& info) { std::unique_lock lock(mp_up->mutex_); - if(info.status == MATCHED_MATCHING) + if (info.status == MATCHED_MATCHING) { - cout << C_MAGENTA << "Command Pub Matched "< mp_up->n_subscribers) + if (n_matched > mp_up->n_subscribers) { std::cout << "More matched subscribers than expected" << std::endl; mp_up->m_status = -1; @@ -272,7 +293,7 @@ void MemoryTestPublisher::CommandPubListener::onPublicationMatched(Publisher* /* } else { - cout << C_MAGENTA << "Command Pub unmatched "<disc_count_; } @@ -280,16 +301,18 @@ void MemoryTestPublisher::CommandPubListener::onPublicationMatched(Publisher* /* mp_up->disc_cond_.notify_one(); } -void MemoryTestPublisher::CommandSubListener::onSubscriptionMatched(Subscriber* /*sub*/,MatchingInfo& info) +void MemoryTestPublisher::CommandSubListener::onSubscriptionMatched( + Subscriber* /*sub*/, + MatchingInfo& info) { std::unique_lock lock(mp_up->mutex_); - if(info.status == MATCHED_MATCHING) + if (info.status == MATCHED_MATCHING) { - cout << C_MAGENTA << "Command Sub Matched "< mp_up->n_subscribers) + if (n_matched > mp_up->n_subscribers) { std::cout << "More matched subscribers than expected" << std::endl; mp_up->m_status = -1; @@ -299,7 +322,7 @@ void MemoryTestPublisher::CommandSubListener::onSubscriptionMatched(Subscriber* } else { - cout << C_MAGENTA << "Command Sub unmatched "<disc_count_; } @@ -307,17 +330,18 @@ void MemoryTestPublisher::CommandSubListener::onSubscriptionMatched(Subscriber* mp_up->disc_cond_.notify_one(); } -void MemoryTestPublisher::CommandSubListener::onNewDataMessage(Subscriber* subscriber) +void MemoryTestPublisher::CommandSubListener::onNewDataMessage( + Subscriber* subscriber) { TestCommandType command; SampleInfo_t info; // cout << "COMMAND RECEIVED"<takeNextData((void*)&command,&info)) + if (subscriber->takeNextData((void*)&command, &info)) { - if(info.sampleKind == ALIVE) + if (info.sampleKind == ALIVE) { //cout << "ALIVE "<mutex_.lock(); @@ -328,29 +352,35 @@ void MemoryTestPublisher::CommandSubListener::onNewDataMessage(Subscriber* subsc } } else - cout<< "Problem reading"< disc_lock(mutex_); - disc_cond_.wait(disc_lock, [&](){ - return disc_count_ >= (n_subscribers * 3); - }); + disc_cond_.wait(disc_lock, [&]() + { + return disc_count_ >= (n_subscribers * 3); + }); disc_lock.unlock(); test(test_time, m_data_size); std::this_thread::sleep_for(std::chrono::milliseconds(100)); - cout << "REMOVING PUBLISHER"<mp_commandpub); - cout << "REMOVING SUBSCRIBER"<add_member(0, "seqnum", DynamicTypeBuilderFactory::get_instance()->create_uint32_type()); struct_type_builder->add_member(1, "data", - DynamicTypeBuilderFactory::get_instance()->create_sequence_builder( - DynamicTypeBuilderFactory::get_instance()->create_byte_type(), datasize - )); + DynamicTypeBuilderFactory::get_instance()->create_sequence_builder( + DynamicTypeBuilderFactory::get_instance()->create_byte_type(), datasize + )); struct_type_builder->set_name("MemoryType"); m_pDynType = struct_type_builder->build(); @@ -380,7 +410,7 @@ bool MemoryTestPublisher::test(uint32_t test_time, uint32_t datasize) m_DynData = DynamicDataFactory::get_instance()->create_data(m_pDynType); MemberId id; - DynamicData *my_data = m_DynData->loan_value(m_DynData->get_member_id_at_index(1)); + DynamicData* my_data = m_DynData->loan_value(m_DynData->get_member_id_at_index(1)); for (uint32_t i = 0; i < datasize; ++i) { my_data->insert_sequence_data(id); @@ -397,11 +427,12 @@ bool MemoryTestPublisher::test(uint32_t test_time, uint32_t datasize) // Finally Data matching std::unique_lock disc_lock(mutex_); - disc_cond_.wait(disc_lock, [&](){ - return disc_count_ >= (n_subscribers * 3); - }); + disc_cond_.wait(disc_lock, [&]() + { + return disc_count_ >= (n_subscribers * 3); + }); disc_lock.unlock(); - cout << C_B_MAGENTA << "DISCOVERY COMPLETE "< lock(mutex_); - comm_cond_.wait(lock, [&](){ - return comm_count_ == n_subscribers; - }); + comm_cond_.wait(lock, [&]() + { + return comm_count_ == n_subscribers; + }); --comm_count_; lock.unlock(); //cout << endl; @@ -421,7 +453,7 @@ bool MemoryTestPublisher::test(uint32_t test_time, uint32_t datasize) while (std::chrono::duration(t_end_ - t_start_) < test_time_us) { - for(unsigned int count = 1; count <= n_samples; ++count) + for (unsigned int count = 1; count <= n_samples; ++count) { if (dynamic_data) { @@ -440,13 +472,13 @@ bool MemoryTestPublisher::test(uint32_t test_time, uint32_t datasize) command.m_command = STOP; mp_commandpub->write(&command); - if(m_status !=0) + if (m_status != 0) { - cout << "Error in test "<removeAllChange(&removed); //cout << " REMOVED: "<< removed< -#include "fastrtps/log/Colors.h" + +#include #include +#include +#include using namespace eprosima::fastrtps; using namespace eprosima::fastrtps::rtps; @@ -60,9 +62,17 @@ MemoryTestSubscriber::~MemoryTestSubscriber() Domain::removeParticipant(mp_participant); } -bool MemoryTestSubscriber::init(bool echo, int nsam, bool reliable, uint32_t pid, bool hostname, - const PropertyPolicy& part_property_policy, const PropertyPolicy& property_policy, - const std::string& sXMLConfigFile, uint32_t data_size, bool dynamic_types) +bool MemoryTestSubscriber::init( + bool echo, + int nsam, + bool reliable, + uint32_t pid, + bool hostname, + const PropertyPolicy& part_property_policy, + const PropertyPolicy& property_policy, + const std::string& sXMLConfigFile, + uint32_t data_size, + bool dynamic_types) { m_sXMLConfigFile = sXMLConfigFile; m_echo = echo; @@ -78,9 +88,9 @@ bool MemoryTestSubscriber::init(bool echo, int nsam, bool reliable, uint32_t pid // Add members to the struct. struct_type_builder->add_member(0, "seqnum", DynamicTypeBuilderFactory::get_instance()->create_uint32_type()); struct_type_builder->add_member(1, "data", - DynamicTypeBuilderFactory::get_instance()->create_sequence_builder( - DynamicTypeBuilderFactory::get_instance()->create_byte_type(), ::dds::core::LENGTH_UNLIMITED - )); + DynamicTypeBuilderFactory::get_instance()->create_sequence_builder( + DynamicTypeBuilderFactory::get_instance()->create_byte_type(), ::dds::core::LENGTH_UNLIMITED + )); struct_type_builder->set_name("MemoryType"); m_pDynType = struct_type_builder->build(); @@ -126,7 +136,9 @@ bool MemoryTestSubscriber::init(bool echo, int nsam, bool reliable, uint32_t pid std::ostringstream st; st << "MemoryTest_"; if (hostname) + { st << asio::ip::host_name() << "_"; + } st << pid << "_PUB2SUB"; SubDataparam.topic.topicName = st.str(); if (reliable) @@ -160,7 +172,9 @@ bool MemoryTestSubscriber::init(bool echo, int nsam, bool reliable, uint32_t pid std::ostringstream pct; pct << "MemoryTest_Command_"; if (hostname) + { pct << asio::ip::host_name() << "_"; + } pct << pid << "_SUB2PUB"; PubCommandParam.topic.topicName = pct.str(); PubCommandParam.topic.historyQos.kind = KEEP_ALL_HISTORY_QOS; @@ -181,7 +195,9 @@ bool MemoryTestSubscriber::init(bool echo, int nsam, bool reliable, uint32_t pid std::ostringstream sct; sct << "MemoryTest_Command_"; if (hostname) + { sct << asio::ip::host_name() << "_"; + } sct << pid << "_PUB2SUB"; SubCommandParam.topic.topicName = sct.str(); SubCommandParam.topic.historyQos.kind = KEEP_ALL_HISTORY_QOS; @@ -206,18 +222,20 @@ bool MemoryTestSubscriber::init(bool echo, int nsam, bool reliable, uint32_t pid return true; } -void MemoryTestSubscriber::DataSubListener::onSubscriptionMatched(Subscriber* /*sub*/,MatchingInfo& info) +void MemoryTestSubscriber::DataSubListener::onSubscriptionMatched( + Subscriber* /*sub*/, + MatchingInfo& info) { std::unique_lock lock(mp_up->mutex_); - if(info.status == MATCHED_MATCHING) + if (info.status == MATCHED_MATCHING) { - cout << C_MAGENTA << "Data Sub Matched "<disc_count_; } else { - cout << C_MAGENTA << "Data Sub unmatched "<disc_count_; } @@ -225,18 +243,20 @@ void MemoryTestSubscriber::DataSubListener::onSubscriptionMatched(Subscriber* /* mp_up->disc_cond_.notify_one(); } -void MemoryTestSubscriber::CommandPubListener::onPublicationMatched(Publisher* /*pub*/,MatchingInfo& info) +void MemoryTestSubscriber::CommandPubListener::onPublicationMatched( + Publisher* /*pub*/, + MatchingInfo& info) { std::unique_lock lock(mp_up->mutex_); - if(info.status == MATCHED_MATCHING) + if (info.status == MATCHED_MATCHING) { - cout << C_MAGENTA << "Command Pub Matched "<disc_count_; } else { - cout << C_MAGENTA << "Command Pub unmatched "<disc_count_; } @@ -244,18 +264,20 @@ void MemoryTestSubscriber::CommandPubListener::onPublicationMatched(Publisher* / mp_up->disc_cond_.notify_one(); } -void MemoryTestSubscriber::CommandSubListener::onSubscriptionMatched(Subscriber* /*sub*/,MatchingInfo& info) +void MemoryTestSubscriber::CommandSubListener::onSubscriptionMatched( + Subscriber* /*sub*/, + MatchingInfo& info) { std::unique_lock lock(mp_up->mutex_); - if(info.status == MATCHED_MATCHING) + if (info.status == MATCHED_MATCHING) { - cout << C_MAGENTA << "Command Sub Matched "<disc_count_; } else { - cout << C_MAGENTA << "Command Sub unmatched "<disc_count_; } @@ -263,21 +285,22 @@ void MemoryTestSubscriber::CommandSubListener::onSubscriptionMatched(Subscriber* mp_up->disc_cond_.notify_one(); } -void MemoryTestSubscriber::CommandSubListener::onNewDataMessage(Subscriber* subscriber) +void MemoryTestSubscriber::CommandSubListener::onNewDataMessage( + Subscriber* subscriber) { TestCommandType command; - if(subscriber->takeNextData(&command,&mp_up->m_sampleinfo)) + if (subscriber->takeNextData(&command, &mp_up->m_sampleinfo)) { - cout << "RCOMMAND: "<< command.m_command << endl; - if(command.m_command == READY) + cout << "RCOMMAND: " << command.m_command << endl; + if (command.m_command == READY) { - cout << "Publisher has new test ready..."<mutex_.lock(); ++mp_up->comm_count_; mp_up->mutex_.unlock(); mp_up->comm_cond_.notify_one(); } - else if(command.m_command == STOP) + else if (command.m_command == STOP) { cout << "Publisher has stopped the test" << endl; mp_up->mutex_.lock(); @@ -285,7 +308,7 @@ void MemoryTestSubscriber::CommandSubListener::onNewDataMessage(Subscriber* subs mp_up->mutex_.unlock(); mp_up->data_cond_.notify_one(); } - else if(command.m_command == STOP_ERROR) + else if (command.m_command == STOP_ERROR) { cout << "Publisher has canceled the test" << endl; mp_up->m_status = -1; @@ -294,14 +317,15 @@ void MemoryTestSubscriber::CommandSubListener::onNewDataMessage(Subscriber* subs mp_up->mutex_.unlock(); mp_up->data_cond_.notify_one(); } - else if(command.m_command == DEFAULT) + else if (command.m_command == DEFAULT) { std::cout << "Something is wrong" << std::endl; } } } -void MemoryTestSubscriber::DataSubListener::onNewDataMessage(Subscriber* subscriber) +void MemoryTestSubscriber::DataSubListener::onNewDataMessage( + Subscriber* subscriber) { if (mp_up->dynamic_data) { @@ -310,12 +334,12 @@ void MemoryTestSubscriber::DataSubListener::onNewDataMessage(Subscriber* subscri if (mp_up->m_echo) { std::cout << "Received data: " << mp_up->m_DynData->get_uint32_value(0) - << "(" << mp_up->n_received << ")" << std::endl; + << "(" << mp_up->n_received << ")" << std::endl; } } else { - subscriber->takeNextData((void*)mp_up->mp_memory,&mp_up->m_sampleinfo); + subscriber->takeNextData((void*)mp_up->mp_memory, &mp_up->m_sampleinfo); ++mp_up->n_received; if (mp_up->m_echo) { @@ -324,21 +348,22 @@ void MemoryTestSubscriber::DataSubListener::onNewDataMessage(Subscriber* subscri } } - void MemoryTestSubscriber::run() { //WAIT FOR THE DISCOVERY PROCESS FO FINISH: //EACH SUBSCRIBER NEEDS 3 Matchings (Comd Pub+Sub and publisher or subscriber) std::unique_lock disc_lock(mutex_); - disc_cond_.wait(disc_lock, [&](){ - return disc_count_ >= 3; - }); + disc_cond_.wait(disc_lock, [&]() + { + return disc_count_ >= 3; + }); disc_lock.unlock(); test(m_data_size); } -bool MemoryTestSubscriber::test(uint32_t datasize) +bool MemoryTestSubscriber::test( + uint32_t datasize) { cout << "Preparing test with data size: " << datasize + 4 << endl; @@ -351,11 +376,11 @@ bool MemoryTestSubscriber::test(uint32_t datasize) // Add members to the struct. struct_type_builder->add_member(0, "seqnum", - DynamicTypeBuilderFactory::get_instance()->create_uint32_type()); + DynamicTypeBuilderFactory::get_instance()->create_uint32_type()); struct_type_builder->add_member(1, "data", - DynamicTypeBuilderFactory::get_instance()->create_sequence_builder( - DynamicTypeBuilderFactory::get_instance()->create_byte_type(), datasize - )); + DynamicTypeBuilderFactory::get_instance()->create_sequence_builder( + DynamicTypeBuilderFactory::get_instance()->create_byte_type(), datasize + )); struct_type_builder->set_name("MemoryType"); m_pDynType = struct_type_builder->build(); @@ -375,15 +400,19 @@ bool MemoryTestSubscriber::test(uint32_t datasize) // Finally data matching std::unique_lock disc_lock(mutex_); - disc_cond_.wait(disc_lock, [&](){ - return disc_count_ >= 3; - }); + disc_cond_.wait(disc_lock, [&]() + { + return disc_count_ >= 3; + }); disc_lock.unlock(); - cout << C_B_MAGENTA << "DISCOVERY COMPLETE "< lock(mutex_); - if (comm_count_ == 0) comm_cond_.wait(lock); + if (comm_count_ == 0) + { + comm_cond_.wait(lock); + } --comm_count_; lock.unlock(); @@ -396,9 +425,9 @@ bool MemoryTestSubscriber::test(uint32_t datasize) lock.lock(); data_cond_.wait(lock, [&]() - { - return data_count_ > 0; - }); + { + return data_count_ > 0; + }); --data_count_; lock.unlock(); diff --git a/test/profiling/allocations/AllocTestPublisher.cpp b/test/profiling/allocations/AllocTestPublisher.cpp index 1b9b49c5f18..21658794645 100644 --- a/test/profiling/allocations/AllocTestPublisher.cpp +++ b/test/profiling/allocations/AllocTestPublisher.cpp @@ -18,14 +18,18 @@ */ #include "AllocTestPublisher.h" -#include "AllocTestCommon.h" -#include + +#include + #include #include -#include #include +#include +#include #include +#include "AllocTestCommon.h" + using namespace eprosima::fastrtps; using namespace eprosima::fastrtps::rtps; diff --git a/test/profiling/allocations/AllocTestSubscriber.cpp b/test/profiling/allocations/AllocTestSubscriber.cpp index 6205a434280..f535dab9dc6 100644 --- a/test/profiling/allocations/AllocTestSubscriber.cpp +++ b/test/profiling/allocations/AllocTestSubscriber.cpp @@ -18,14 +18,18 @@ */ #include "AllocTestSubscriber.h" -#include "AllocTestCommon.h" -#include + +#include + #include #include -#include #include +#include +#include #include +#include "AllocTestCommon.h" + using namespace eprosima::fastrtps; using namespace eprosima::fastrtps::rtps; diff --git a/test/profiling/main_MemoryTest.cpp b/test/profiling/main_MemoryTest.cpp index b22646f6045..cfdd6f75b11 100644 --- a/test/profiling/main_MemoryTest.cpp +++ b/test/profiling/main_MemoryTest.cpp @@ -12,23 +12,24 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "MemoryTestPublisher.h" -#include "MemoryTestSubscriber.h" - -#include - -#include -#include -#include -#include #include #include +#include +#include +#include +#include +#include + +#include #include #include #include #include +#include "MemoryTestPublisher.h" +#include "MemoryTestSubscriber.h" + #if defined(_MSC_VER) #pragma warning (push) #pragma warning (disable:4512) diff --git a/test/unittest/dds/core/condition/ConditionTests.cpp b/test/unittest/dds/core/condition/ConditionTests.cpp index 31a58e7ff37..61bae7efaad 100644 --- a/test/unittest/dds/core/condition/ConditionTests.cpp +++ b/test/unittest/dds/core/condition/ConditionTests.cpp @@ -12,19 +12,21 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "../../../logging/mock/MockConsumer.h" -#include +#include + #include -#include +#include #include #include #include #include +#include +#include #include #include -#include +#include "../../../logging/mock/MockConsumer.h" using eprosima::fastrtps::types::ReturnCode_t; diff --git a/test/unittest/dds/core/entity/EntityTests.cpp b/test/unittest/dds/core/entity/EntityTests.cpp index a708907629d..79a425dcaf8 100644 --- a/test/unittest/dds/core/entity/EntityTests.cpp +++ b/test/unittest/dds/core/entity/EntityTests.cpp @@ -12,18 +12,21 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "../../../logging/mock/MockConsumer.h" -#include "mock/MockEntity.hpp" -#include +#include + #include #include #include #include #include +#include #include #include +#include "../../../logging/mock/MockConsumer.h" +#include "mock/MockEntity.hpp" + using namespace eprosima::fastdds::dds; using namespace std; diff --git a/test/unittest/dds/publisher/DataWriterTests.cpp b/test/unittest/dds/publisher/DataWriterTests.cpp index b19e70dec87..a75b42cf52c 100644 --- a/test/unittest/dds/publisher/DataWriterTests.cpp +++ b/test/unittest/dds/publisher/DataWriterTests.cpp @@ -12,9 +12,17 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include +#include +#include + #include #include +#include +#include +#include +#include #include #include #include @@ -24,20 +32,27 @@ #include #include #include +<<<<<<< HEAD +======= +#include +#include +#include +#include +#include +>>>>>>> 6390715a1 (Add missing thread include (#4045)) #include #include -#include -#include -#include -#include - #include "../../logging/mock/MockConsumer.h" +<<<<<<< HEAD #include #include #include +======= +#include "../../common/CustomPayloadPool.hpp" +>>>>>>> 6390715a1 (Add missing thread include (#4045)) namespace eprosima { namespace fastdds { diff --git a/test/unittest/logging/log_macros/LogMacros.hpp b/test/unittest/logging/log_macros/LogMacros.hpp index fe887688718..1c6e54046cc 100644 --- a/test/unittest/logging/log_macros/LogMacros.hpp +++ b/test/unittest/logging/log_macros/LogMacros.hpp @@ -15,12 +15,16 @@ #ifndef LOG_MACROS_HPP #define LOG_MACROS_HPP +#include + +#include + #include #include #include #include + #include "../mock/MockConsumer.h" -#include using namespace eprosima::fastdds::dds; using namespace std; diff --git a/test/unittest/rtps/flowcontrol/FlowControllerPublishModesOnAsyncTests.cpp b/test/unittest/rtps/flowcontrol/FlowControllerPublishModesOnAsyncTests.cpp index 4050360c81c..d9054299e0d 100644 --- a/test/unittest/rtps/flowcontrol/FlowControllerPublishModesOnAsyncTests.cpp +++ b/test/unittest/rtps/flowcontrol/FlowControllerPublishModesOnAsyncTests.cpp @@ -1,5 +1,26 @@ +<<<<<<< HEAD +======= +// Copyright 2023 Proyectos y Sistemas de Mantenimiento SL (eProsima). +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +>>>>>>> 6390715a1 (Add missing thread include (#4045)) #include "FlowControllerPublishModesTests.hpp" +#include + +#include + using namespace eprosima::fastdds::rtps; using namespace testing; diff --git a/test/unittest/rtps/flowcontrol/FlowControllerPublishModesOnLimitedAsyncTests.cpp b/test/unittest/rtps/flowcontrol/FlowControllerPublishModesOnLimitedAsyncTests.cpp index 8508d952d84..8c883eb593e 100644 --- a/test/unittest/rtps/flowcontrol/FlowControllerPublishModesOnLimitedAsyncTests.cpp +++ b/test/unittest/rtps/flowcontrol/FlowControllerPublishModesOnLimitedAsyncTests.cpp @@ -1,5 +1,26 @@ +<<<<<<< HEAD +======= +// Copyright 2023 Proyectos y Sistemas de Mantenimiento SL (eProsima). +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +>>>>>>> 6390715a1 (Add missing thread include (#4045)) #include "FlowControllerPublishModesTests.hpp" +#include + +#include + using namespace eprosima::fastdds::rtps; using namespace testing; diff --git a/test/unittest/rtps/flowcontrol/FlowControllerPublishModesOnPureSyncTests.cpp b/test/unittest/rtps/flowcontrol/FlowControllerPublishModesOnPureSyncTests.cpp index 73a08987d95..60478011899 100644 --- a/test/unittest/rtps/flowcontrol/FlowControllerPublishModesOnPureSyncTests.cpp +++ b/test/unittest/rtps/flowcontrol/FlowControllerPublishModesOnPureSyncTests.cpp @@ -1,5 +1,26 @@ +<<<<<<< HEAD +======= +// Copyright 2023 Proyectos y Sistemas de Mantenimiento SL (eProsima). +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +>>>>>>> 6390715a1 (Add missing thread include (#4045)) #include "FlowControllerPublishModesTests.hpp" +#include + +#include + using namespace eprosima::fastdds::rtps; using namespace testing; diff --git a/test/unittest/rtps/flowcontrol/FlowControllerPublishModesOnSyncTests.cpp b/test/unittest/rtps/flowcontrol/FlowControllerPublishModesOnSyncTests.cpp index d8438a25ae6..c81d993b834 100644 --- a/test/unittest/rtps/flowcontrol/FlowControllerPublishModesOnSyncTests.cpp +++ b/test/unittest/rtps/flowcontrol/FlowControllerPublishModesOnSyncTests.cpp @@ -1,5 +1,26 @@ +<<<<<<< HEAD +======= +// Copyright 2023 Proyectos y Sistemas de Mantenimiento SL (eProsima). +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +>>>>>>> 6390715a1 (Add missing thread include (#4045)) #include "FlowControllerPublishModesTests.hpp" +#include + +#include + using namespace eprosima::fastdds::rtps; using namespace testing; diff --git a/test/unittest/rtps/flowcontrol/FlowControllerSchedulersTests.cpp b/test/unittest/rtps/flowcontrol/FlowControllerSchedulersTests.cpp index 7ffe0ba2bab..add2ccf862e 100644 --- a/test/unittest/rtps/flowcontrol/FlowControllerSchedulersTests.cpp +++ b/test/unittest/rtps/flowcontrol/FlowControllerSchedulersTests.cpp @@ -1,4 +1,26 @@ +<<<<<<< HEAD #include +======= +// Copyright 2023 Proyectos y Sistemas de Mantenimiento SL (eProsima). +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include + +#include + +#include +>>>>>>> 6390715a1 (Add missing thread include (#4045)) #include #include diff --git a/test/unittest/security/logging/LoggingPluginTests.hpp b/test/unittest/security/logging/LoggingPluginTests.hpp index f648296e6f8..d7ddb44a8ee 100644 --- a/test/unittest/security/logging/LoggingPluginTests.hpp +++ b/test/unittest/security/logging/LoggingPluginTests.hpp @@ -15,11 +15,14 @@ #ifndef _UNITTEST_SECURITY_LOGGING_LOGGINGPLUGINTESTS_HPP_ #define _UNITTEST_SECURITY_LOGGING_LOGGINGPLUGINTESTS_HPP_ -#include -#include +#include #include +#include + +#include + class LoggingPluginTest : public ::testing::Test { protected: @@ -89,82 +92,85 @@ TEST_F(LoggingPluginTest, DefaultBehavior) TEST_F(LoggingPluginTest, AsyncFileLogging) { - // First remove previous executions file - std::remove(security_log_filename.c_str()); + // First remove previous executions file + std::remove(security_log_filename.c_str()); - eprosima::fastrtps::rtps::security::LogOptions log_options; + eprosima::fastrtps::rtps::security::LogOptions log_options; - log_options.distribute = false; - log_options.log_file = security_log_filename; - log_options.log_level = eprosima::fastrtps::rtps::security::LoggingLevel::DEBUG_LEVEL; + log_options.distribute = false; + log_options.log_file = security_log_filename; + log_options.log_level = eprosima::fastrtps::rtps::security::LoggingLevel::DEBUG_LEVEL; - eprosima::fastrtps::rtps::security::SecurityException exception; + eprosima::fastrtps::rtps::security::SecurityException exception; -// plugin->set_domain_id(); -// plugin->set_guid(); + // plugin->set_domain_id(); + // plugin->set_guid(); - EXPECT_TRUE(plugin->set_log_options(log_options, exception)); - EXPECT_TRUE(plugin->options_set()); - EXPECT_TRUE(plugin->enable_logging(exception)) << exception.what(); - EXPECT_TRUE(plugin->enabled()); + EXPECT_TRUE(plugin->set_log_options(log_options, exception)); + EXPECT_TRUE(plugin->options_set()); + EXPECT_TRUE(plugin->enable_logging(exception)) << exception.what(); + EXPECT_TRUE(plugin->enabled()); - std::vector> threads; - for (long i = 0; i < NUM_LOG_LEVELS; ++i) { - threads.emplace_back(new std::thread([this, i, &exception]{ - plugin->log( - static_cast(i), - std::string("Report from thread ") + std::to_string(i), - "Logging,fileloggingtest", - exception); - })); - } + std::vector> threads; + for (long i = 0; i < NUM_LOG_LEVELS; ++i) + { + threads.emplace_back(new std::thread([this, i, &exception] + { + plugin->log( + static_cast(i), + std::string("Report from thread ") + std::to_string(i), + "Logging,fileloggingtest", + exception); + })); + } - for (auto& thread: threads) { - thread->join(); - } + for (auto& thread: threads) + { + thread->join(); + } - // give a chance to the logger to log all messages - std::this_thread::sleep_for(std::chrono::milliseconds(100)); + // give a chance to the logger to log all messages + std::this_thread::sleep_for(std::chrono::milliseconds(100)); - std::ifstream ifs(security_log_filename); + std::ifstream ifs(security_log_filename); - if (!ifs.is_open()) - { - GTEST_FAIL(); - } + if (!ifs.is_open()) + { + GTEST_FAIL(); + } - std::string line; - long count = 0; + std::string line; + long count = 0; - // log format is: - // [] [] message - while (std::getline(ifs, line)) - { - // check stamp - std::regex regex("\\[[0-9]+.[0-9]+\\]"); - EXPECT_TRUE(std::regex_search(line, regex)) << line; + // log format is: + // [] [] message + while (std::getline(ifs, line)) + { + // check stamp + std::regex regex("\\[[0-9]+.[0-9]+\\]"); + EXPECT_TRUE(std::regex_search(line, regex)) << line; - // check verbosity - regex = std::regex("[EMERGENCY|ALERT|CRITICAL|ERROR|WARNING|NOTICE|INFORMATIONAL|DEBUG]"); - EXPECT_TRUE(std::regex_search(line, regex)) << line; + // check verbosity + regex = std::regex("[EMERGENCY|ALERT|CRITICAL|ERROR|WARNING|NOTICE|INFORMATIONAL|DEBUG]"); + EXPECT_TRUE(std::regex_search(line, regex)) << line; - //@TODO(artivis) check guid + //@TODO(artivis) check guid - //@TODO(artivis) check domain_id + //@TODO(artivis) check domain_id - // check call site - regex = std::regex("Logging::fileloggingtest : "); - EXPECT_TRUE(std::regex_search(line, regex)) << line; + // check call site + regex = std::regex("Logging::fileloggingtest : "); + EXPECT_TRUE(std::regex_search(line, regex)) << line; - // check message - regex = std::regex("Report from thread [0-9]{1}"); - EXPECT_TRUE(std::regex_search(line, regex)) << line; + // check message + regex = std::regex("Report from thread [0-9]{1}"); + EXPECT_TRUE(std::regex_search(line, regex)) << line; - ++count; - } + ++count; + } - EXPECT_EQ(NUM_LOG_LEVELS, count); + EXPECT_EQ(NUM_LOG_LEVELS, count); } #endif // _UNITTEST_SECURITY_LOGGING_LOGGINGPLUGINTESTS_HPP_ diff --git a/test/unittest/statistics/rtps/RTPSStatisticsTests.cpp b/test/unittest/statistics/rtps/RTPSStatisticsTests.cpp index 67f802b4426..605fd79e1db 100644 --- a/test/unittest/statistics/rtps/RTPSStatisticsTests.cpp +++ b/test/unittest/statistics/rtps/RTPSStatisticsTests.cpp @@ -13,6 +13,7 @@ // limitations under the License. #include +#include #if defined(_WIN32) #include #else @@ -25,16 +26,16 @@ #include #include #include -#include #include -#include #include +#include #include #include #include #include #include #include +#include #include #include #include @@ -45,9 +46,8 @@ #include #include -#include - #include +#include #include namespace eprosima {