Skip to content

fix test failures for rclc.#442

Open
fujitatomoya wants to merge 1 commit intorollingfrom
fujitatomoya/rclc-test-fixes
Open

fix test failures for rclc.#442
fujitatomoya wants to merge 1 commit intorollingfrom
fujitatomoya/rclc-test-fixes

Conversation

@fujitatomoya
Copy link
Contributor

Description

this PR addresses 2 issues.

  • rclcpp::spin_some(Node::SharedPtr) is deprecated in favor of using an executor directly. see https://ci.ros2.org/job/ci_linux-aarch64/20707/clang-tidy/
  • test failures due to invalid ROS 2 context when creating guard conditions. this occurred because the executor was being constructed before rclcpp::init() was called and rclcpp::init() was being called unconditionally, causing issues when running multiple tests.

Fixes # (issue)

Is this user-facing behavior change?

No

Did you use Generative AI?

Copilot Claude Sonnet 4.5

Additional Information

Signed-off-by: Tomoya Fujita <Tomoya.Fujita@sony.com>
@fujitatomoya fujitatomoya requested a review from Copilot February 14, 2026 23:44
@fujitatomoya fujitatomoya self-assigned this Feb 14, 2026
@fujitatomoya
Copy link
Contributor Author

Pulls: #442
Gist: https://gist.githubusercontent.com/fujitatomoya/3df3ccc3575f1ca296db2c60d571c83d/raw/abd6981248937b2f47c96b8f348e9c32df112cb6/ros2.repos
BUILD args: --packages-up-to rclc
TEST args: --packages-select rclc
ROS Distro: rolling
Job: ci_launcher
ci_launcher ran: https://ci.ros2.org/job/ci_launcher/18203

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

Copy link
Contributor Author

@fujitatomoya fujitatomoya left a comment

Choose a reason for hiding this comment

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

@SuperJappie08 can you review this?

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes test failures in the rclc action client tests by addressing two key issues: replacing the deprecated rclcpp::spin_some(Node::SharedPtr) API with an executor-based approach, and fixing ROS 2 context initialization problems that occurred when running multiple tests sequentially.

Changes:

  • Replaced deprecated rclcpp::spin_some() with explicit executor usage
  • Added conditional rclcpp::init() check to prevent multiple initialization failures
  • Ensured proper cleanup order for rclcpp resources before shutdown

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor Author

@fujitatomoya fujitatomoya left a comment

Choose a reason for hiding this comment

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

i think this has been broke for certain time? but this fixes a couple of problems in my local environment.

@fujitatomoya fujitatomoya requested a review from ahcorde February 14, 2026 23:51
Copy link
Contributor

@SuperJappie08 SuperJappie08 left a comment

Choose a reason for hiding this comment

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

@fujitatomoya, I have some concerns about the rclcpp::Context check.
(See the comment)

However, I don't have much experience with complex testing for rclcpp (and rclc). So I might be a bit too cautious.

Comment on lines +204 to +206
if (!rclcpp::ok()) {
rclcpp::init(0, NULL);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

This check worries me, as to my understanding this would imply that another section has initialized the rclcpp context, which in turn would/should tear it down as well.

I'm afraid this could cause issues in two cases:

  1. The other test shuts the context down earlier, which would stop this executor.
  2. The order of the tests change, causing an error in the other test.

How are multi-context cases handled when testing rclcpp as I would imagine they have to deal with the same issue?

Copy link
Contributor

Choose a reason for hiding this comment

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

I did a quick search, and the other rclcpp::Context lives in test_action_server.cpp

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.

2 participants