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

[16362] Fix Windows StatistisQosTests.cpp linkage and Failed test #3122

Merged
merged 2 commits into from
Dec 1, 2022

Conversation

Mario-DL
Copy link
Member

@Mario-DL Mario-DL commented Nov 30, 2022

Description

This PR intends to fix the StatisticsQosTests windows linkage issue. In addition, it fixes a test that tried to read a second xml profiles file with some profiles names shared with the first one, consequently, it was being ignored because of the bool flag default_xml_profiles_loaded in DomainParticipantFactory.

Proposed solution: Change the usage of ParticipantImpl to Participant (user api) to prevent linkage problems and unify all xml profiles from both files into a single one.

Contributor Checklist

  • Commit messages follow the project guidelines.
  • The code follows the style guidelines of this project.
    N/A Tests that thoroughly check the new feature have been added/Regression tests checking the bug and its fix have been added.
    N/A Any new/modified methods have been properly documented using Doxygen.
  • Fast DDS test suite has been run locally. linux x86_64 Ubuntu 22.04
  • Changes are ABI compatible.
  • Changes are API compatible.
    N/A Documentation builds and tests pass locally.
    N/A New feature has been added to the versions.md file (if applicable).
    N/A New feature has been documented/Current behavior is correctly described in the documentation.

Reviewer Checklist

  • Check contributor checklist is correct.
  • Check CI results: changes do not issue any warning.
  • Check CI results: failing tests are unrelated with the changes.

@Mario-DL Mario-DL added the needs-review PR that is ready to be reviewed label Nov 30, 2022
@JLBuenoLopez
Copy link
Contributor

@richiprosima please test this

{
const char* xml =
" \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sometimes uncrustify resolves rules in a very weird manner. Nevertheless, I suggest keeping aligned the \.

Comment on lines 82 to 182
<dds xmlns=\"http://www.eprosima.com/XMLSchemas/fastRTPS_Profiles\"> \
<profiles> \
<participant profile_name=\"statistics_participant\" is_default_profile=\"true\"> \
<rtps> \
<propertiesPolicy> \
<properties> \
<property> \
<name>fastdds.statistics</name> \
<value>HISTORY_LATENCY_TOPIC;PUBLICATION_THROUGHPUT_TOPIC;DATA_COUNT_TOPIC;DISCOVERY_TOPIC</value>\
</property> \
</properties> \
</propertiesPolicy> \
</rtps> \
</participant> \
<data_writer profile_name=\"HISTORY_LATENCY_TOPIC\"> \
<qos> \
<reliability> \
<kind>BEST_EFFORT</kind> \
</reliability> \
<durability> \
<kind>VOLATILE</kind> \
</durability> \
<publishMode> \
<kind>SYNCHRONOUS</kind> \
</publishMode> \
</qos> \
</data_writer> \
<data_writer profile_name=\"NETWORK_LATENCY_TOPIC\"> \
</data_writer> \
<data_writer profile_name=\"SUBSCRIPTION_THROUGHPUT_TOPIC\"> \
<qos> \
<reliability> \
<kind>BEST_EFFORT</kind> \
</reliability> \
<partition> \
<names> \
<name>part1</name> \
<name>part2</name> \
</names> \
</partition> \
<deadline> \
<period> \
<sec>3</sec> \
</period> \
</deadline> \
<latencyBudget> \
<duration> \
<sec>2</sec> \
</duration> \
</latencyBudget> \
<disable_heartbeat_piggyback>true</disable_heartbeat_piggyback> \
</qos> \
</data_writer> \
<data_writer profile_name=\"DATA_COUNT_TOPIC\"> \
<qos> \
<liveliness> \
<kind>AUTOMATIC</kind> \
<lease_duration> \
<sec>1</sec> \
<nanosec>856000</nanosec> \
</lease_duration> \
<announcement_period> \
<sec>1</sec> \
<nanosec>856000</nanosec> \
</announcement_period> \
</liveliness> \
</qos> \
</data_writer> \
<data_writer profile_name=\"HEARTBEAT_COUNT_TOPIC\"> \
<qos> \
<liveliness> \
<kind>AUTOMATIC</kind> \
<lease_duration> \
<sec>1</sec> \
<nanosec>856000</nanosec> \
</lease_duration> \
<announcement_period> \
<sec>1</sec> \
<nanosec>856000</nanosec> \
</announcement_period> \
</liveliness> \
</qos> \
</data_writer> \
<data_writer profile_name=\"OTHER_NAME_FOR_PROFILE\"> \
<qos> \
<reliability> \
<kind>BEST_EFFORT</kind> \
</reliability> \
</qos> \
</data_writer> \
<data_writer profile_name=\"DISCOVERY_TOPIC\"> \
<qos> \
<reliability> \
<kind>RELIABLE</kind> \
</reliability> \
</qos> \
</data_writer> \
</profiles> \
</dds> \
";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the alignment forced by uncrustify? I do not think so. I suggest modifying and using our tabulations rules (only 4 spaces between levels instead of the 8 being applied now.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The alignment was the one the file had before. However, I will apply a 4 indent for uniformity.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I know it is legacy code, but in this way we strive to always be improving the code. 😄

" \
<?xml version=\"1.0\" encoding=\"utf-8\" ?> \
<dds xmlns=\"http://www.eprosima.com/XMLSchemas/fastRTPS_Profiles\"> \
<profiles> \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<profiles> tag should be indented with respect to <dds> tag

{
const char* xml =
" \
<?xml version=\"1.0\" encoding=\"utf-8\" ?> \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest aligning this first line with the " in the line before. I do not think uncrustify will complain, though I am not completely sure.

<dds xmlns=\"http://www.eprosima.com/XMLSchemas/fastRTPS_Profiles\"> \
<profiles> \
<participant profile_name=\"statistics_participant\" is_default_profile=\"true\"> \
<rtps> \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This tag should be indented

<properties> \
<property> \
<name>fastdds.statistics</name> \
<value>HISTORY_LATENCY_TOPIC;PUBLICATION_THROUGHPUT_TOPIC;DATA_COUNT_TOPIC;DISCOVERY_TOPIC</value>\
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this line should be split to keep the alignment

@@ -341,7 +348,7 @@ TEST_F(StatisticsFromXMLProfileTests, XMLConfigurationForStatisticsDataWritersQo
// it is just defined as data_writer profile. Thus, should not be created
std::string subscription_througput_name = SUBSCRIPTION_THROUGHPUT_TOPIC;
eprosima::fastdds::dds::DataWriter* subscription_througput_writer =
statistics_publisher_impl->lookup_datawriter(subscription_througput_name);
statistics_publisher->lookup_datawriter(subscription_througput_name);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know it is not related to these changes, but I suggest fixing this typo:

Suggested change
statistics_publisher->lookup_datawriter(subscription_througput_name);
statistics_publisher->lookup_datawriter(subscription_throughput_name);

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this previous suggestion was overlooked 😅

<properties> \
<property> \
<name>fastdds.statistics</name> \
<value>HISTORY_LATENCY_TOPIC;PUBLICATION_THROUGHPUT_TOPIC;DATA_COUNT_TOPIC;DISCOVERY_TOPIC</value>\
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am missing some cases that were tested with the second XML file:

  • Check that it worked without using the alias and using directly the topic name (both setting the property as the profile name being used in that specific topic).
  • The GENERIC_STATISTICS_PROFILE is not being tested applying these changes.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On the next commit, I have rewritten the tests in a (i think) more elegant way. Instead of creating two files and point them from the environment, I use directly the load_XML_profiles_string() so it is clearer.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably when the original code was implemented, the option of loading the XML profiles directly from a string was not implemented. As you say, now that this feature is included with Fast DDS it makes more sense. Thank you!

test_statistics_domain_participant_impl->get_publisher_impl();
ASSERT_NE(_statistics_publisher_impl, nullptr);
// Get Publisher
_statistics_publisher =
Copy link
Contributor

@JLBuenoLopez JLBuenoLopez Dec 1, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know it is not related to the changes but I think we should unify the code style according to Fast DDS guidestyle. Private class member should have a trailing underscore, but there is no rule to add underscore before the variable name.

@JLBuenoLopez
Copy link
Contributor

Related to the checklist:

  1. The second commit is not following the project guidelines (the reference to the corresponding task is missing).
  2. The third point I think it is N/A because no new test have been added, either for regression or check a new feature.

@JLBuenoLopez
Copy link
Contributor

I have build in Windows and the linking issue is solved (CI does not test with FASTDDS_STATISTICS option enabled).

…tests so that not file creation needed. Applied requested changes.

Signed-off-by: Mario Dominguez <[email protected]>
@Mario-DL
Copy link
Member Author

Mario-DL commented Dec 1, 2022

Note: StatisticsQosTests have to be run individually (as in the ci). Re-written both tests under StatisticsFromXMLProfileTests so that no file creation is needed.

@Mario-DL
Copy link
Member Author

Mario-DL commented Dec 1, 2022

@richiprosima please test this

Copy link
Contributor

@JLBuenoLopez JLBuenoLopez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two small nitpicks

@@ -341,7 +348,7 @@ TEST_F(StatisticsFromXMLProfileTests, XMLConfigurationForStatisticsDataWritersQo
// it is just defined as data_writer profile. Thus, should not be created
std::string subscription_througput_name = SUBSCRIPTION_THROUGHPUT_TOPIC;
eprosima::fastdds::dds::DataWriter* subscription_througput_writer =
statistics_publisher_impl->lookup_datawriter(subscription_througput_name);
statistics_publisher->lookup_datawriter(subscription_througput_name);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this previous suggestion was overlooked 😅

<properties> \
<property> \
<name>fastdds.statistics</name> \
<value>HISTORY_LATENCY_TOPIC;PUBLICATION_THROUGHPUT_TOPIC;DISCOVERY_TOPIC;</value>\
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of the alias it would be nice to have one check with the topic name directly, as it was done before: instead of DISCOVERY_TOPIC, use _fastdds_statistics_discovered_entity. This apply also in the corresponding profile.

Copy link
Contributor

@JLBuenoLopez JLBuenoLopez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@MiguelCompany MiguelCompany merged commit 5926ee8 into master Dec 1, 2022
@MiguelCompany MiguelCompany deleted the fix/16362 branch December 1, 2022 15:36
@EduPonz
Copy link

EduPonz commented Dec 2, 2022

@Mergifyio backport 2.8.x

@mergify
Copy link
Contributor

mergify bot commented Dec 2, 2022

backport 2.8.x

✅ Backports have been created

mergify bot pushed a commit that referenced this pull request Dec 2, 2022
* Refs #16362: Fix Windows StatistisQosTests.cpp linkage and rewritten tests so that not file creation needed. Applied requested changes.

Signed-off-by: Mario Dominguez <[email protected]>

* Refs #16362: Applied requested changes

Signed-off-by: Mario Dominguez <[email protected]>

Signed-off-by: Mario Dominguez <[email protected]>
(cherry picked from commit 5926ee8)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-review PR that is ready to be reviewed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants