Skip to content

Switch to isolated testing via rmw_test_fixture#1251

Merged
cottsay merged 2 commits intorollingfrom
yadu/rmw_test_fixture
Aug 21, 2025
Merged

Switch to isolated testing via rmw_test_fixture#1251
cottsay merged 2 commits intorollingfrom
yadu/rmw_test_fixture

Conversation

@Yadunund
Copy link
Copy Markdown
Member

@Yadunund Yadunund commented Aug 8, 2025

Description

This PR effectively reverts #1218 and instead relies on rmw_test_fixture to start a zenoh router when running tests with rmw_zenoh.

Fixes # (issue)
Partially addresses ros2/ros2#1664

Is this user-facing behavior change?

No

Did you use Generative AI?

No

Additional Information

Signed-off-by: Yadunund <yadunund@gmail.com>
@cottsay
Copy link
Copy Markdown
Member

cottsay commented Aug 9, 2025

I think there are a couple of other places where we'll need to isolate. This is how I got the remaining tests to pass locally:

diff --git a/rcl/test/cmake/rcl_add_custom_gtest.cmake b/rcl/test/cmake/rcl_add_custom_gtest.cmake
index da24cd49a7ad..fb34060fd3e7 100644
--- a/rcl/test/cmake/rcl_add_custom_gtest.cmake
+++ b/rcl/test/cmake/rcl_add_custom_gtest.cmake
@@ -71,8 +71,8 @@ macro(rcl_add_custom_gtest target)
   endif()
 
   # Pass args along to ament_add_gtest().
-  ament_add_gtest(${target} ${_ARG_SRCS} ${_ARG_ENV} ${_ARG_APPEND_ENV} ${_ARG_APPEND_LIBRARY_DIRS}
-                  ${_ARG_SKIP_TEST} ${_ARG_TIMEOUT})
+  ament_add_ros_isolated_gtest(${target} ${_ARG_SRCS} ${_ARG_ENV} ${_ARG_APPEND_ENV}
+    ${_ARG_APPEND_LIBRARY_DIRS} ${_ARG_SKIP_TEST} ${_ARG_TIMEOUT})
   # Check if the target was actually created.
   if(TARGET ${target})
     if(_ARG_TRACE)
diff --git a/rcl/test/cmake/rcl_add_custom_launch_test.cmake b/rcl/test/cmake/rcl_add_custom_launch_test.cmake
index 8be69800eaf9..9985a3121ec2 100644
--- a/rcl/test/cmake/rcl_add_custom_launch_test.cmake
+++ b/rcl/test/cmake/rcl_add_custom_launch_test.cmake
@@ -34,9 +34,11 @@ macro(rcl_add_custom_launch_test test_name executable1 executable2)
     OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/test/${test_name}${target_suffix}_$<CONFIG>.py"
     INPUT "${CMAKE_CURRENT_BINARY_DIR}/${test_name}${target_suffix}.py.configure"
   )
+  set(RUNNER "RUNNER" "${ament_cmake_ros_DIR}/run_test_isolated.py")
   add_launch_test(
     "${CMAKE_CURRENT_BINARY_DIR}/test/${test_name}${target_suffix}_$<CONFIG>.py"
     TARGET ${test_name}${target_suffix}
+    RUNNER "${RUNNER}"
     ${ARGN}
   )
   if(TEST ${test_name}${target_suffix})

The launch test one is a little tricky. All of the existing stuff for isolating launch tests is downstream from this package, but fortunately the launch tests in rcl are sane and can be isolated using the simple process-based isolator.

Signed-off-by: Yadunund <yadunund@gmail.com>
@Yadunund
Copy link
Copy Markdown
Member Author

@cottsay thanks a lot for flagging the changes needed to get the other tests to pass. I've pushed your suggestions.

@cottsay
Copy link
Copy Markdown
Member

cottsay commented Aug 21, 2025

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

@cottsay
Copy link
Copy Markdown
Member

cottsay commented Aug 21, 2025

The devel job for rcl is seeing the same two test failures, so I don't think those are related. ci.ros2.org came back green, so this is good to go 🚀

@cottsay cottsay merged commit 37e3c73 into rolling Aug 21, 2025
2 of 3 checks passed
@cottsay cottsay deleted the yadu/rmw_test_fixture branch August 21, 2025 20:58
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