Skip to content

Commit

Permalink
Integrated system test into CI
Browse files Browse the repository at this point in the history
  • Loading branch information
CihatAltiparmak committed Aug 28, 2024
1 parent 9377fa4 commit dbccd7c
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 2 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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/[email protected]
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
Expand All @@ -42,7 +46,15 @@ jobs:
uses: ros-tooling/[email protected]
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 .`
3 changes: 3 additions & 0 deletions rmw_zenoh_cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
1 change: 1 addition & 0 deletions rmw_zenoh_cpp/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
<depend>rosidl_typesupport_fastrtps_cpp</depend>
<depend>rmw</depend>

<test_depend>ament_index_python</test_depend>
<test_depend>ament_lint_auto</test_depend>
<test_depend>ament_lint_common</test_depend>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

import launch
import launch.actions
import launch.substitutions
import launch_ros.actions
import launch_testing.actions
import launch_testing.markers
Expand All @@ -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",
Expand All @@ -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
Expand All @@ -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()
Expand Down

0 comments on commit dbccd7c

Please sign in to comment.