diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 8829ee50..50e0daaf 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -28,12 +28,16 @@ jobs: BUILD_TYPE: binary env: ROS2_REPOS_FILE_URL: 'https://raw.githubusercontent.com/ros2/ros2/${{ matrix.ROS_DISTRO }}/ros2.repos' + RMW_MIDDLEWARE_TEST_PACKAGES: 'test_rclcpp rcl' runs-on: ubuntu-latest container: image: ${{ matrix.BUILD_TYPE == 'binary' && format('ros:{0}-ros-base', matrix.ROS_DISTRO) || 'ubuntu:noble' }} steps: - uses: ros-tooling/setup-ros@v0.7 if: ${{ matrix.BUILD_TYPE == 'source' }} + with: + use-ros2-testing: true + required-ros-distributions: ${{ matrix.ROS_DISTRO }} - name: Install Coverage Tools if: ${{ matrix.BUILD_TYPE == 'binary' }} run: sudo apt update && sudo apt install -y python3-colcon-coveragepy-result python3-colcon-lcov-result lcov @@ -42,7 +46,15 @@ jobs: uses: ros-tooling/action-ros-ci@v0.3 with: package-name: | + ${{ matrix.BUILD_TYPE == 'source' && env.RMW_MIDDLEWARE_TEST_PACKAGES || '' }} rmw_zenoh_cpp zenoh_c_vendor target-ros2-distro: ${{ matrix.ROS_DISTRO }} vcs-repo-file-url: ${{ matrix.BUILD_TYPE == 'source' && env.ROS2_REPOS_FILE_URL || '' }} + skip-tests: true + - name: Run system_tests + if: ${{ matrix.BUILD_TYPE == 'source' }} + run: | + cd ${{ steps.action-ros-ci.outputs.ros-workspace-directory-name }} + . install/setup.sh + launch_test install/rmw_zenoh_cpp/test/rclcpp_integration.test.py workspace_directory:=`pwd .` diff --git a/rmw_zenoh_cpp/CMakeLists.txt b/rmw_zenoh_cpp/CMakeLists.txt index d2145006..2ee7e148 100644 --- a/rmw_zenoh_cpp/CMakeLists.txt +++ b/rmw_zenoh_cpp/CMakeLists.txt @@ -97,6 +97,9 @@ if(BUILD_TESTING) ament_lint_cmake() ament_uncrustify(EXCLUDE ${_linter_excludes}) ament_xmllint() + + install(FILES test/rclcpp_integration.test.py + DESTINATION test) endif() install( diff --git a/rmw_zenoh_cpp/package.xml b/rmw_zenoh_cpp/package.xml index 3da4920d..3c8e1404 100644 --- a/rmw_zenoh_cpp/package.xml +++ b/rmw_zenoh_cpp/package.xml @@ -25,6 +25,7 @@ rosidl_typesupport_fastrtps_cpp rmw + ament_index_python ament_lint_auto ament_lint_common diff --git a/rmw_zenoh_cpp/test/test_rclcpp_launch.py b/rmw_zenoh_cpp/test/rclcpp_integration.test.py similarity index 88% rename from rmw_zenoh_cpp/test/test_rclcpp_launch.py rename to rmw_zenoh_cpp/test/rclcpp_integration.test.py index 63a17826..5c4f96ad 100644 --- a/rmw_zenoh_cpp/test/test_rclcpp_launch.py +++ b/rmw_zenoh_cpp/test/rclcpp_integration.test.py @@ -21,6 +21,7 @@ import launch import launch.actions +import launch.substitutions import launch_ros.actions import launch_testing.actions import launch_testing.markers @@ -34,6 +35,9 @@ @launch_testing.markers.keep_alive def generate_test_description(): + workspace_directory = launch.substitutions.LaunchConfiguration('workspace_directory') + workspace_directory_arg = launch.actions.DeclareLaunchArgument('workspace_directory') + zenoh_router = launch_ros.actions.Node( package="rmw_zenoh_cpp", executable="rmw_zenohd", @@ -46,15 +50,17 @@ def generate_test_description(): 'colcon', 'test', '--packages-select', - 'rcl', + 'test_rclcpp', '--retest-until-pass', '2', ], shell=True, env=proc_env, + cwd=workspace_directory ) return launch.LaunchDescription([ + workspace_directory_arg, zenoh_router, dut_process, # In tests where all of the procs under tests terminate themselves, it's necessary @@ -66,7 +72,7 @@ def generate_test_description(): class TestTerminatingProcessStops(unittest.TestCase): def test_proc_terminates(self, proc_info, dut_process): - proc_info.assertWaitForShutdown(process=dut_process, timeout=400) + proc_info.assertWaitForShutdown(process=dut_process, timeout=400000) # These tests are run after the processes in generate_test_description() have shutdown. @launch_testing.post_shutdown_test()