Skip to content

Commit

Permalink
Fix profiling allocations test build (#4843)
Browse files Browse the repository at this point in the history
* Refs #21081: Make Alloc Tests compatible with 3.x

Signed-off-by: cferreiragonz <[email protected]>

* Refs #21081: Use a separate listener in pub/sub

Signed-off-by: cferreiragonz <[email protected]>

* Refs #21081: Disable Data_sharing

Signed-off-by: cferreiragonz <[email protected]>

* Revert "Refs #21081: Use a separate listener in pub/sub"

This reverts commit ac21b65.

Signed-off-by: cferreiragonz <[email protected]>

---------

Signed-off-by: cferreiragonz <[email protected]>
  • Loading branch information
cferreiragonz committed May 31, 2024
1 parent 863b990 commit 2b7c0f6
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 13 deletions.
9 changes: 4 additions & 5 deletions test/profiling/allocations/AllocTestPublisher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,20 @@
#include <fastdds/dds/publisher/qos/DataWriterQos.hpp>
#include <fastdds/dds/publisher/qos/PublisherQos.hpp>
#include <fastdds/dds/topic/qos/TopicQos.hpp>
#include <fastrtps/types/TypesBase.h>

#include "AllocTestCommon.h"
#include "AllocTestTypePubSubTypes.h"

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; \
}
Expand Down Expand Up @@ -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<DomainParticipantFactory> factory = DomainParticipantFactory::get_shared_instance();
ret = factory->load_XML_profiles_file("test_xml_profile.xml");
Expand Down Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion test/profiling/allocations/AllocTestPublisher.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
#include <fastdds/dds/topic/Topic.hpp>
#include <fastdds/dds/topic/TypeSupport.hpp>

#include "AllocTestType.h"
#include "AllocTestType.hpp"

class AllocTestPublisher : public eprosima::fastdds::dds::DataWriterListener
{
Expand Down
11 changes: 5 additions & 6 deletions test/profiling/allocations/AllocTestSubscriber.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,20 @@
#include <fastdds/dds/subscriber/qos/SubscriberQos.hpp>
#include <fastdds/dds/subscriber/SampleInfo.hpp>
#include <fastdds/dds/topic/qos/TopicQos.hpp>
#include <fastrtps/types/TypesBase.h>

#include "AllocTestCommon.h"
#include "AllocTestTypePubSubTypes.h"

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; \
}
Expand Down Expand Up @@ -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<DomainParticipantFactory> factory = DomainParticipantFactory::get_shared_instance();
ret = factory->load_XML_profiles_file("test_xml_profile.xml");
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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)))
Expand Down
2 changes: 1 addition & 1 deletion test/profiling/allocations/AllocTestSubscriber.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
#include <fastdds/dds/topic/Topic.hpp>
#include <fastdds/dds/topic/TypeSupport.hpp>

#include "AllocTestType.h"
#include "AllocTestType.hpp"

class AllocTestSubscriber : public eprosima::fastdds::dds::DataReaderListener
{
Expand Down
24 changes: 24 additions & 0 deletions test/profiling/allocations/test_xml_profile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@
</resourceLimitsQos>
</topic>
<qos>
<data_sharing>
<kind>OFF</kind>
</data_sharing>
<durability>
<kind>TRANSIENT_LOCAL</kind>
</durability>
Expand Down Expand Up @@ -96,6 +99,9 @@
</resourceLimitsQos>
</topic>
<qos>
<data_sharing>
<kind>OFF</kind>
</data_sharing>
<durability>
<kind>TRANSIENT_LOCAL</kind>
</durability>
Expand Down Expand Up @@ -123,6 +129,9 @@
</resourceLimitsQos>
</topic>
<qos>
<data_sharing>
<kind>OFF</kind>
</data_sharing>
<durability>
<kind>VOLATILE</kind>
</durability>
Expand Down Expand Up @@ -150,6 +159,9 @@
</resourceLimitsQos>
</topic>
<qos>
<data_sharing>
<kind>OFF</kind>
</data_sharing>
<durability>
<kind>VOLATILE</kind>
</durability>
Expand Down Expand Up @@ -179,6 +191,9 @@
</resourceLimitsQos>
</topic>
<qos>
<data_sharing>
<kind>OFF</kind>
</data_sharing>
<durability>
<kind>TRANSIENT_LOCAL</kind>
</durability>
Expand Down Expand Up @@ -206,6 +221,9 @@
</resourceLimitsQos>
</topic>
<qos>
<data_sharing>
<kind>OFF</kind>
</data_sharing>
<durability>
<kind>TRANSIENT_LOCAL</kind>
</durability>
Expand Down Expand Up @@ -233,6 +251,9 @@
</resourceLimitsQos>
</topic>
<qos>
<data_sharing>
<kind>OFF</kind>
</data_sharing>
<durability>
<kind>VOLATILE</kind>
</durability>
Expand Down Expand Up @@ -260,6 +281,9 @@
</resourceLimitsQos>
</topic>
<qos>
<data_sharing>
<kind>OFF</kind>
</data_sharing>
<durability>
<kind>VOLATILE</kind>
</durability>
Expand Down

0 comments on commit 2b7c0f6

Please sign in to comment.