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

[21383] Fix tests on Ubuntu 24.04 #168

Merged
merged 2 commits into from
Jul 19, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
124 changes: 10 additions & 114 deletions fastdds_python/src/swig/fastdds/dds/domain/DomainParticipantFactory.i
Original file line number Diff line number Diff line change
Expand Up @@ -16,124 +16,22 @@
#include "fastdds/dds/domain/DomainParticipantFactory.hpp"
%}

%extend eprosima::fastdds::dds::DomainParticipantFactory
{
/**
* Create a Participant.
*
* @param domain_id Domain Id.
* @param qos DomainParticipantQos Reference.
* @param listener DomainParticipantListener Pointer (default: nullptr)
* @param mask StatusMask Reference (default: all)
* @return DomainParticipant pointer. (nullptr if not created.)
*/
DomainParticipant* create_participant(
DomainId_t domain_id,
const DomainParticipantQos& qos,
DomainParticipantListener* listener = nullptr,
const StatusMask& mask = eprosima::fastdds::dds::StatusMask::all())
{
if (nullptr != listener)
{
Swig::Director* director = SWIG_DIRECTOR_CAST(listener);

if (nullptr != director)
{
SWIG_PYTHON_THREAD_BEGIN_BLOCK;
Py_INCREF(director->swig_get_self());
SWIG_PYTHON_THREAD_END_BLOCK;
}
}

return self->create_participant(domain_id, qos, listener, mask);
}

/**
* Create a Participant.
*
* @param extended_qos DomainParticipantExtendedQos Reference.
* @param listener DomainParticipantListener Pointer (default: nullptr)
* @param mask StatusMask Reference (default: all)
* @return DomainParticipant pointer. (nullptr if not created.)
*/
DomainParticipant* create_participant(
const DomainParticipantExtendedQos& extended_qos,
DomainParticipantListener* listener = nullptr,
const StatusMask& mask = eprosima::fastdds::dds::StatusMask::all())
{
if (nullptr != listener)
{
Swig::Director* director = SWIG_DIRECTOR_CAST(listener);

if (nullptr != director)
{
SWIG_PYTHON_THREAD_BEGIN_BLOCK;
Py_INCREF(director->swig_get_self());
SWIG_PYTHON_THREAD_END_BLOCK;
}
}

return self->create_participant(extended_qos.domainId(), extended_qos, listener, mask);
}

/**
* Create a Participant.
*
* @param domain_id Domain Id.
* @param profile_name Participant profile name.
* @param listener DomainParticipantListener Pointer (default: nullptr)
* @param mask StatusMask Reference (default: all)
* @return DomainParticipant pointer. (nullptr if not created.)
*/
DomainParticipant* create_participant_with_profile(
DomainId_t domain_id,
const std::string& profile_name,
DomainParticipantListener* listener = nullptr,
const StatusMask& mask = eprosima::fastdds::dds::StatusMask::all())
%typemap(in) (eprosima::fastdds::dds::DomainParticipantListener* listener) %{
$typemap(in, eprosima::fastdds::dds::DomainParticipantListener* DISOWN)
{
if (nullptr != listener)
{
Swig::Director* director = SWIG_DIRECTOR_CAST(listener);
Swig::Director* director = SWIG_DIRECTOR_CAST($1);

if (nullptr != director)
{
SWIG_PYTHON_THREAD_BEGIN_BLOCK;
Py_INCREF(director->swig_get_self());
SWIG_PYTHON_THREAD_END_BLOCK;
}
}

return self->create_participant_with_profile(domain_id, profile_name, listener, mask);
}

/**
* Create a Participant.
*
* @param profile_name Participant profile name.
* @param listener DomainParticipantListener Pointer (default: nullptr)
* @param mask StatusMask Reference (default: all)
* @return DomainParticipant pointer. (nullptr if not created.)
*/
DomainParticipant* create_participant_with_profile(
const std::string& profile_name,
DomainParticipantListener* listener = nullptr,
const StatusMask& mask = eprosima::fastdds::dds::StatusMask::all())
{
if (nullptr != listener)
if (nullptr != director)
{
Swig::Director* director = SWIG_DIRECTOR_CAST(listener);

if (nullptr != director)
{
SWIG_PYTHON_THREAD_BEGIN_BLOCK;
Py_INCREF(director->swig_get_self());
SWIG_PYTHON_THREAD_END_BLOCK;
}
SWIG_PYTHON_THREAD_BEGIN_BLOCK;
director->swig_incref();
SWIG_PYTHON_THREAD_END_BLOCK;
}

return self->create_participant_with_profile(profile_name, listener, mask);
}
%}

%extend eprosima::fastdds::dds::DomainParticipantFactory
{
/**
* Remove a Participant and all associated publishers and subscribers.
*
Expand Down Expand Up @@ -164,8 +62,6 @@
}
}

%ignore eprosima::fastdds::dds::DomainParticipantFactory::create_participant;
%ignore eprosima::fastdds::dds::DomainParticipantFactory::create_participant_with_profile;
%ignore eprosima::fastdds::dds::DomainParticipantFactory::delete_participant;
%ignore eprosima::fastdds::dds::DomainParticipantFactory::get_dynamic_type_builder_from_xml_by_name;

Expand Down
75 changes: 20 additions & 55 deletions fastdds_python/test/api/test_datareader.py
Original file line number Diff line number Diff line change
Expand Up @@ -743,67 +743,33 @@ def test_get_set_listener(datareader):
assert(fastdds.StatusMask.all() ==
datareader.get_status_mask())

def test(status_mask_1, status_mask_2):
def test(status_mask):
"""
Test the entity creation using the two types of StatusMasks.
Test the entity creation using the type of StatusMask.
"""
listener = DataReaderListener()
assert(listener is not None)
assert(fastdds.RETCODE_OK ==
datareader.set_listener(listener, status_mask_1))
datareader.set_listener(listener, status_mask))
assert(datareader.get_listener() == listener)
assert(status_mask_1 == datareader.get_status_mask())
listener = DataReaderListener()
assert(listener is not None)
assert(fastdds.RETCODE_OK ==
datareader.set_listener(listener, status_mask_2))
assert(datareader.get_listener() == listener)
assert(status_mask_2 == datareader.get_status_mask())
assert(status_mask == datareader.get_status_mask())

# Overload 2: Different status masks
test(fastdds.StatusMask.all(), fastdds.StatusMask_all())
test(fastdds.StatusMask.all(), fastdds.StatusMask_all())
test(fastdds.StatusMask.none(), fastdds.StatusMask_none())
test(fastdds.StatusMask.data_available(),
fastdds.StatusMask_data_available())
test(fastdds.StatusMask.data_on_readers(),
fastdds.StatusMask_data_on_readers())
test(fastdds.StatusMask.inconsistent_topic(),
fastdds.StatusMask_inconsistent_topic())
test(fastdds.StatusMask.liveliness_changed(),
fastdds.StatusMask_liveliness_changed())
test(fastdds.StatusMask.liveliness_lost(),
fastdds.StatusMask_liveliness_lost())
test(fastdds.StatusMask.offered_deadline_missed(),
fastdds.StatusMask_offered_deadline_missed())
test(fastdds.StatusMask.offered_incompatible_qos(),
fastdds.StatusMask_offered_incompatible_qos())
test(fastdds.StatusMask.publication_matched(),
fastdds.StatusMask_publication_matched())
test(fastdds.StatusMask.requested_deadline_missed(),
fastdds.StatusMask_requested_deadline_missed())
test(fastdds.StatusMask.requested_incompatible_qos(),
fastdds.StatusMask_requested_incompatible_qos())
test(fastdds.StatusMask.sample_lost(),
fastdds.StatusMask_sample_lost())
test(fastdds.StatusMask.sample_rejected(),
fastdds.StatusMask_sample_rejected())
test(fastdds.StatusMask.subscription_matched(),
fastdds.StatusMask_subscription_matched())

m = fastdds.StatusMask_data_available() << \
fastdds.StatusMask_data_on_readers() << \
fastdds.StatusMask_inconsistent_topic() << \
fastdds.StatusMask_liveliness_changed() << \
fastdds.StatusMask_liveliness_lost() << \
fastdds.StatusMask_offered_deadline_missed() << \
fastdds.StatusMask_offered_incompatible_qos() << \
fastdds.StatusMask_publication_matched() << \
fastdds.StatusMask_requested_deadline_missed() << \
fastdds.StatusMask_requested_incompatible_qos() << \
fastdds.StatusMask_sample_lost() << \
fastdds.StatusMask_sample_rejected() << \
fastdds.StatusMask_subscription_matched()
test(fastdds.StatusMask.all())
test(fastdds.StatusMask.none())
test(fastdds.StatusMask.data_available())
test(fastdds.StatusMask.data_on_readers())
test(fastdds.StatusMask.inconsistent_topic())
test(fastdds.StatusMask.liveliness_changed())
test(fastdds.StatusMask.liveliness_lost())
test(fastdds.StatusMask.offered_deadline_missed())
test(fastdds.StatusMask.offered_incompatible_qos())
test(fastdds.StatusMask.publication_matched())
test(fastdds.StatusMask.requested_deadline_missed())
test(fastdds.StatusMask.requested_incompatible_qos())
test(fastdds.StatusMask.sample_lost())
test(fastdds.StatusMask.sample_rejected())
test(fastdds.StatusMask.subscription_matched())

test(fastdds.StatusMask.data_available() <<
fastdds.StatusMask.data_on_readers() <<
Expand All @@ -817,8 +783,7 @@ def test(status_mask_1, status_mask_2):
fastdds.StatusMask.requested_incompatible_qos() <<
fastdds.StatusMask.sample_lost() <<
fastdds.StatusMask.sample_rejected() <<
fastdds.StatusMask.subscription_matched(),
m)
fastdds.StatusMask.subscription_matched())


def test_get_listening_locators(datareader):
Expand Down
75 changes: 20 additions & 55 deletions fastdds_python/test/api/test_datawriter.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,67 +253,33 @@ def test_get_set_listener(datawriter):
assert(datawriter.get_listener() == listener)
assert(fastdds.StatusMask.all() == datawriter.get_status_mask())

def test(status_mask_1, status_mask_2):
def test(status_mask):
"""
Test the entity creation using the two types of StatusMasks.
Test the entity creation using the type of StatusMask.
"""
listener = DataWriterListener()
assert(listener is not None)
assert(fastdds.RETCODE_OK ==
datawriter.set_listener(listener, status_mask_1))
datawriter.set_listener(listener, status_mask))
assert(datawriter.get_listener() == listener)
assert(status_mask_1 == datawriter.get_status_mask())
listener = DataWriterListener()
assert(listener is not None)
assert(fastdds.RETCODE_OK ==
datawriter.set_listener(listener, status_mask_2))
assert(datawriter.get_listener() == listener)
assert(status_mask_2 == datawriter.get_status_mask())
assert(status_mask == datawriter.get_status_mask())

# Overload 2: Different status masks
test(fastdds.StatusMask.all(), fastdds.StatusMask_all())
test(fastdds.StatusMask.all(), fastdds.StatusMask_all())
test(fastdds.StatusMask.none(), fastdds.StatusMask_none())
test(fastdds.StatusMask.data_available(),
fastdds.StatusMask_data_available())
test(fastdds.StatusMask.data_on_readers(),
fastdds.StatusMask_data_on_readers())
test(fastdds.StatusMask.inconsistent_topic(),
fastdds.StatusMask_inconsistent_topic())
test(fastdds.StatusMask.liveliness_changed(),
fastdds.StatusMask_liveliness_changed())
test(fastdds.StatusMask.liveliness_lost(),
fastdds.StatusMask_liveliness_lost())
test(fastdds.StatusMask.offered_deadline_missed(),
fastdds.StatusMask_offered_deadline_missed())
test(fastdds.StatusMask.offered_incompatible_qos(),
fastdds.StatusMask_offered_incompatible_qos())
test(fastdds.StatusMask.publication_matched(),
fastdds.StatusMask_publication_matched())
test(fastdds.StatusMask.requested_deadline_missed(),
fastdds.StatusMask_requested_deadline_missed())
test(fastdds.StatusMask.requested_incompatible_qos(),
fastdds.StatusMask_requested_incompatible_qos())
test(fastdds.StatusMask.sample_lost(),
fastdds.StatusMask_sample_lost())
test(fastdds.StatusMask.sample_rejected(),
fastdds.StatusMask_sample_rejected())
test(fastdds.StatusMask.subscription_matched(),
fastdds.StatusMask_subscription_matched())

m = fastdds.StatusMask_data_available() << \
fastdds.StatusMask_data_on_readers() << \
fastdds.StatusMask_inconsistent_topic() << \
fastdds.StatusMask_liveliness_changed() << \
fastdds.StatusMask_liveliness_lost() << \
fastdds.StatusMask_offered_deadline_missed() << \
fastdds.StatusMask_offered_incompatible_qos() << \
fastdds.StatusMask_publication_matched() << \
fastdds.StatusMask_requested_deadline_missed() << \
fastdds.StatusMask_requested_incompatible_qos() << \
fastdds.StatusMask_sample_lost() << \
fastdds.StatusMask_sample_rejected() << \
fastdds.StatusMask_subscription_matched()
test(fastdds.StatusMask.all())
test(fastdds.StatusMask.none())
test(fastdds.StatusMask.data_available())
test(fastdds.StatusMask.data_on_readers())
test(fastdds.StatusMask.inconsistent_topic())
test(fastdds.StatusMask.liveliness_changed())
test(fastdds.StatusMask.liveliness_lost())
test(fastdds.StatusMask.offered_deadline_missed())
test(fastdds.StatusMask.offered_incompatible_qos())
test(fastdds.StatusMask.publication_matched())
test(fastdds.StatusMask.requested_deadline_missed())
test(fastdds.StatusMask.requested_incompatible_qos())
test(fastdds.StatusMask.sample_lost())
test(fastdds.StatusMask.sample_rejected())
test(fastdds.StatusMask.subscription_matched())

test(fastdds.StatusMask.data_available() <<
fastdds.StatusMask.data_on_readers() <<
Expand All @@ -327,8 +293,7 @@ def test(status_mask_1, status_mask_2):
fastdds.StatusMask.requested_incompatible_qos() <<
fastdds.StatusMask.sample_lost() <<
fastdds.StatusMask.sample_rejected() <<
fastdds.StatusMask.subscription_matched(),
m)
fastdds.StatusMask.subscription_matched())


def test_get_liveliness_lost_status(datawriter):
Expand Down
Loading
Loading