From 2b7c0f6b1c5260bc09cf3659bf779ac8c16cb8a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Ferreira=20Gonz=C3=A1lez?= Date: Fri, 31 May 2024 12:17:50 +0200 Subject: [PATCH] Fix profiling allocations test build (#4843) * Refs #21081: Make Alloc Tests compatible with 3.x Signed-off-by: cferreiragonz * Refs #21081: Use a separate listener in pub/sub Signed-off-by: cferreiragonz * Refs #21081: Disable Data_sharing Signed-off-by: cferreiragonz * Revert "Refs #21081: Use a separate listener in pub/sub" This reverts commit ac21b65a06ee8aabf85bc580261db8a685c28a73. Signed-off-by: cferreiragonz --------- Signed-off-by: cferreiragonz --- .../allocations/AllocTestPublisher.cpp | 9 ++++--- .../allocations/AllocTestPublisher.hpp | 2 +- .../allocations/AllocTestSubscriber.cpp | 11 ++++----- .../allocations/AllocTestSubscriber.hpp | 2 +- .../allocations/test_xml_profile.xml | 24 +++++++++++++++++++ 5 files changed, 35 insertions(+), 13 deletions(-) diff --git a/test/profiling/allocations/AllocTestPublisher.cpp b/test/profiling/allocations/AllocTestPublisher.cpp index 0bc00fc4340..336cd211098 100644 --- a/test/profiling/allocations/AllocTestPublisher.cpp +++ b/test/profiling/allocations/AllocTestPublisher.cpp @@ -27,7 +27,6 @@ #include #include #include -#include #include "AllocTestCommon.h" #include "AllocTestTypePubSubTypes.h" @@ -35,13 +34,13 @@ using namespace eprosima::fastdds::dds; #define CHECK_RETURN_CODE(ret) \ - if (ReturnCode_t::RETCODE_OK != ret) \ + if (RETCODE_OK != ret) \ { \ return false; \ } #define CHECK_ENTITY_CREATION(entity) \ - if (nullptr != entity) \ + if (nullptr == entity) \ { \ return false; \ } @@ -78,7 +77,7 @@ bool AllocTestPublisher::init( profile_ = profile; output_file_ = output_file; - ReturnCode_t ret = ReturnCode_t::RETCODE_OK; + ReturnCode_t ret = RETCODE_OK; std::shared_ptr factory = DomainParticipantFactory::get_shared_instance(); ret = factory->load_XML_profiles_file("test_xml_profile.xml"); @@ -106,7 +105,7 @@ bool AllocTestPublisher::init( bool show_allocation_traces = std::getenv("FASTDDS_PROFILING_PRINT_TRACES") != nullptr; eprosima_profiling::entities_created(show_allocation_traces); - return ret == ReturnCode_t::RETCODE_OK; + return ret == RETCODE_OK; } void AllocTestPublisher::on_publication_matched( diff --git a/test/profiling/allocations/AllocTestPublisher.hpp b/test/profiling/allocations/AllocTestPublisher.hpp index 14d17dfd08e..f0747330ea6 100644 --- a/test/profiling/allocations/AllocTestPublisher.hpp +++ b/test/profiling/allocations/AllocTestPublisher.hpp @@ -34,7 +34,7 @@ #include #include -#include "AllocTestType.h" +#include "AllocTestType.hpp" class AllocTestPublisher : public eprosima::fastdds::dds::DataWriterListener { diff --git a/test/profiling/allocations/AllocTestSubscriber.cpp b/test/profiling/allocations/AllocTestSubscriber.cpp index 9e9887e87e9..98a6816f35f 100644 --- a/test/profiling/allocations/AllocTestSubscriber.cpp +++ b/test/profiling/allocations/AllocTestSubscriber.cpp @@ -33,7 +33,6 @@ #include #include #include -#include #include "AllocTestCommon.h" #include "AllocTestTypePubSubTypes.h" @@ -41,13 +40,13 @@ using namespace eprosima::fastdds::dds; #define CHECK_RETURN_CODE(ret) \ - if (ReturnCode_t::RETCODE_OK != ret) \ + if (RETCODE_OK != ret) \ { \ return false; \ } #define CHECK_ENTITY_CREATION(entity) \ - if (nullptr != entity) \ + if (nullptr == entity) \ { \ return false; \ } @@ -83,7 +82,7 @@ bool AllocTestSubscriber::init( profile_ = profile; output_file_ = output_file; - ReturnCode_t ret = ReturnCode_t::RETCODE_OK; + ReturnCode_t ret = RETCODE_OK; std::shared_ptr factory = DomainParticipantFactory::get_shared_instance(); ret = factory->load_XML_profiles_file("test_xml_profile.xml"); @@ -111,7 +110,7 @@ bool AllocTestSubscriber::init( bool show_allocation_traces = std::getenv("FASTDDS_PROFILING_PRINT_TRACES") != nullptr; eprosima_profiling::entities_created(show_allocation_traces); - return ret == ReturnCode_t::RETCODE_OK; + return ret == RETCODE_OK; } void AllocTestSubscriber::on_subscription_matched( @@ -140,7 +139,7 @@ void AllocTestSubscriber::on_data_available( DataReader* reader) { SampleInfo info; - if (ReturnCode_t::RETCODE_OK == reader->take_next_sample(&data_, &info)) + if (RETCODE_OK == reader->take_next_sample(&data_, &info)) { if ((info.instance_state == ALIVE_INSTANCE_STATE) && (info.valid_data) && (reader->is_sample_valid(&data_, &info))) diff --git a/test/profiling/allocations/AllocTestSubscriber.hpp b/test/profiling/allocations/AllocTestSubscriber.hpp index 6473235d630..f083dd11cf6 100644 --- a/test/profiling/allocations/AllocTestSubscriber.hpp +++ b/test/profiling/allocations/AllocTestSubscriber.hpp @@ -34,7 +34,7 @@ #include #include -#include "AllocTestType.h" +#include "AllocTestType.hpp" class AllocTestSubscriber : public eprosima::fastdds::dds::DataReaderListener { diff --git a/test/profiling/allocations/test_xml_profile.xml b/test/profiling/allocations/test_xml_profile.xml index 7a4c935c265..45d732735a4 100644 --- a/test/profiling/allocations/test_xml_profile.xml +++ b/test/profiling/allocations/test_xml_profile.xml @@ -69,6 +69,9 @@ + + OFF + TRANSIENT_LOCAL @@ -96,6 +99,9 @@ + + OFF + TRANSIENT_LOCAL @@ -123,6 +129,9 @@ + + OFF + VOLATILE @@ -150,6 +159,9 @@ + + OFF + VOLATILE @@ -179,6 +191,9 @@ + + OFF + TRANSIENT_LOCAL @@ -206,6 +221,9 @@ + + OFF + TRANSIENT_LOCAL @@ -233,6 +251,9 @@ + + OFF + VOLATILE @@ -260,6 +281,9 @@ + + OFF + VOLATILE