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

Skip some tests in test_qos_event and run others with event types supported by rmw_zenoh #2626

Merged
merged 11 commits into from
Sep 30, 2024

Conversation

ahcorde
Copy link
Contributor

@ahcorde ahcorde commented Sep 11, 2024

Related to this issue ros2/rmw_zenoh#280

Signed-off-by: Alejandro Hernández Cordero <ahcorde@gmail.com>
Copy link
Member

@Yadunund Yadunund left a comment

Choose a reason for hiding this comment

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

Apart from deadline and lifetime QoS events, rmw_zenoh supports all other events including matched pub/sub. I've left some suggestions on how we can have some of these tests run for rmw_zenoh.

rclcpp/test/rclcpp/test_qos_event.cpp Outdated Show resolved Hide resolved
rclcpp/test/rclcpp/test_qos_event.cpp Show resolved Hide resolved
rclcpp/test/rclcpp/test_qos_event.cpp Outdated Show resolved Hide resolved
rclcpp/test/rclcpp/test_qos_event.cpp Outdated Show resolved Hide resolved
@@ -561,6 +618,11 @@ TEST_F(TestQosEvent, test_pub_matched_event_by_option_event_callback)

TEST_F(TestQosEvent, test_sub_matched_event_by_option_event_callback)
{
std::string rmw_implementation_str = std::string(rmw_get_implementation_identifier());
Copy link
Member

Choose a reason for hiding this comment

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

matched events should definitely work else there is a bug in rmw_zenoh.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

failing here too

Expected equality of these values:
  s.total_count
    Which is: 7
  matched_expected_result.total_count
    Which is: 1

/home/ahcorde/ros2_rolling/src/ros2/rclcpp/rclcpp/test/rclcpp/test_qos_event.cpp:620: Failure
Expected equality of these values:
  s.total_count_change
    Which is: 2
  matched_expected_result.total_count_change
    Which is: 1

/home/ahcorde/ros2_rolling/src/ros2/rclcpp/rclcpp/test/rclcpp/test_qos_event.cpp:621: Failure
Expected equality of these values:
  s.current_count
    Which is: 3
  matched_expected_result.current_count
    Which is: 1

/home/ahcorde/ros2_rolling/src/ros2/rclcpp/rclcpp/test/rclcpp/test_qos_event.cpp:619: Failure
Expected equality of these values:
  s.total_count
    Which is: 8
  matched_expected_result.total_count
    Which is: 1

/home/ahcorde/ros2_rolling/src/ros2/rclcpp/rclcpp/test/rclcpp/test_qos_event.cpp:620: Failure
Expected equality of these values:
  s.total_count_change
    Which is: 1
  matched_expected_result.total_count_change
    Which is: 0

/home/ahcorde/ros2_rolling/src/ros2/rclcpp/rclcpp/test/rclcpp/test_qos_event.cpp:621: Failure
Expected equality of these values:
  s.current_count
    Which is: 2
  matched_expected_result.current_count
    Which is: 0

Copy link
Member

Choose a reason for hiding this comment

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

So this relates to what I mentioned above where we should update the test similar to 4) in ros2/rcl#1164. Basically more QoS combinations are compatible in rmw_zenoh so we should set the matched_expected_result.current_count to the output of rmw_qos_profile_check_compatible checks.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There might be some tests that we can fix with your comment, but the subscription counter is wrong, it's only increasing.

If you comment out some tests the numbers are different which somehow don't clean the counters between tests.

Copy link
Member

Choose a reason for hiding this comment

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

This looks like a bug in rmw_zenoh. I would suggest we don't skip this test and instead have it fail so that we can address it.

We should only skip the tests for functionalities we do not support.

Copy link
Member

Choose a reason for hiding this comment

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

After looking at the problem closer; the issue is that

  1. rmw_init() is called once in SetUpTestCase() which creates the Zenoh session and initializes the ROS graph.
  2. Each time a new test case runs, we run SetUp() and TearDown() which creates and destroys the node and some publishes and subscriptions. However, since the session is still the same throughout the tests each time a new pub/sub match is found, the same total_count and total_count_change updates. From the sessions's perspective, the total count is indeed valid since it was never shutdown.

In 6c9baba, I moved the rmw_init() command inside SetUp() and the rmw_shutdown() inside TearDown(), the total_count numbers are accurate. With ros2/rmw_zenoh#287 all events tests are passing.

rclcpp/test/rclcpp/test_qos_event.cpp Outdated Show resolved Hide resolved
rclcpp/test/rclcpp/test_qos_event.cpp Outdated Show resolved Hide resolved
Signed-off-by: Alejandro Hernández Cordero <ahcorde@gmail.com>
@Yadunund
Copy link
Member

@ahcorde we should also skip test_events_executor/test_default_incompatible_qos_callbacks since there is no qos incompatibility with Zenoh.

rclcpp/test/rclcpp/test_qos_event.cpp Outdated Show resolved Hide resolved
rclcpp/test/rclcpp/test_qos_event.cpp Outdated Show resolved Hide resolved
rclcpp/test/rclcpp/test_qos_event.cpp Outdated Show resolved Hide resolved
rclcpp/test/rclcpp/test_qos_event.cpp Outdated Show resolved Hide resolved
Signed-off-by: Alejandro Hernández Cordero <ahcorde@gmail.com>
…cpp_test' into ahcorde/rolling/clean_rmw_zenoh_cpp_test
@ahcorde ahcorde requested a review from Yadunund September 26, 2024 08:41
@Yadunund Yadunund changed the title Clean rmw_zenoh_cpp tests Skip test_qos_event for rmw_zenoh Sep 27, 2024
Signed-off-by: Yadunund <yadunund@intrinsic.ai>
Signed-off-by: Yadunund <yadunund@intrinsic.ai>
Signed-off-by: Yadunund <yadunund@intrinsic.ai>
Copy link
Member

@Yadunund Yadunund left a comment

Choose a reason for hiding this comment

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

I pushed some commits to make sure we run a lot of the tests here and only skip the ones that we truly don't support in rmw_zenoh. Tests that were checking for construction/destruction of event callbacks are updated to use events that we support. The diff looks big but that's because I moved some code within an indented block that runs only if the middleware is not rmw_zenoh_cpp.

One big behavioral change is that I initialize and shutdown the middleware between each test case. Without this, the ROS graph which is tied to the context (and hence initialized and shutdown only once) is reused for each test.

@Yadunund Yadunund changed the title Skip test_qos_event for rmw_zenoh Skip some test_qos_event and run others with supported event types supported by rmw_zenoh Sep 27, 2024
@Yadunund Yadunund changed the title Skip some test_qos_event and run others with supported event types supported by rmw_zenoh Skip some tests in test_qos_event and run others with event types supported by rmw_zenoh Sep 27, 2024
Signed-off-by: Yadunund <yadunund@intrinsic.ai>
@ahcorde
Copy link
Contributor Author

ahcorde commented Sep 27, 2024

Pulls: #2626
Gist: https://gist.githubusercontent.com/ahcorde/6b43ecce585f20d60397baa760b412ef/raw/15e027f863567d1c697304388188bdfaff546631/ros2.repos
BUILD args: --packages-up-to rclcpp --packages-above-and-dependencies rclcpp
TEST args: --packages-select rclcpp --packages-above rclcpp
ROS Distro: rolling
Job: ci_launcher
ci_launcher ran: https://ci.ros2.org/job/ci_launcher/14624

  • Linux Build Status
  • Linux-aarch64 Build Status
  • Linux-rhel Build Status
  • Windows Build Status

@ahcorde ahcorde merged commit 51dfdc3 into rolling Sep 30, 2024
3 checks passed
@ahcorde ahcorde deleted the ahcorde/rolling/clean_rmw_zenoh_cpp_test branch September 30, 2024 08:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants