-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Yadunund <[email protected]>
- Loading branch information
Showing
2 changed files
with
100 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,9 +24,20 @@ jobs: | |
- name: Setup Rust | ||
uses: dtolnay/[email protected] | ||
- uses: actions/checkout@v2 | ||
- name: Clone system_tests | ||
run: | | ||
git clone https://github.com/ros2/system_tests.git | ||
- name: rosdep | ||
run: | | ||
rosdep update | ||
rosdep install --from-paths . -yir | ||
- name: build | ||
run: /ros_entrypoint.sh colcon build | ||
- name: build_rmw | ||
run: /ros_entrypoint.sh colcon build --packages-up-to rmw_zenoh_cpp | ||
- name: build_tests | ||
run: | | ||
source install/setup.bash | ||
/ros_entrypoint.sh colcon build --packages-up-to test_rclcpp | ||
- name: test | ||
run: | | ||
source install/setup.bash | ||
/ros_entrypoint.sh launch_test rmw_zenoh_cpp/test/test_rclcpp_launch.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
# Copyright 2024 Open Source Robotics Foundation, Inc. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
import os | ||
import sys | ||
import signal | ||
import subprocess | ||
import time | ||
import unittest | ||
|
||
import launch | ||
import launch.actions | ||
import launch_ros.actions | ||
import launch_testing.actions | ||
import launch_testing.markers | ||
import pytest | ||
|
||
|
||
proc_env = os.environ.copy() | ||
proc_env['PYTHONUNBUFFERED'] = '1' | ||
proc_env['RMW_IMPLEMENTATION'] = 'rmw_zenoh_cpp' | ||
|
||
@pytest.mark.launch_test | ||
@launch_testing.markers.keep_alive | ||
def generate_test_description(): | ||
|
||
|
||
dut_process = launch.actions.ExecuteProcess( | ||
cmd=[ | ||
'colcon', | ||
'test', | ||
'--packages-select', | ||
'test_rclcpp', | ||
'--retest-until-pass', | ||
'2', | ||
], | ||
shell=True, | ||
env=proc_env, | ||
) | ||
|
||
return launch.LaunchDescription([ | ||
# rmw_zenohd, | ||
dut_process, | ||
# In tests where all of the procs under tests terminate themselves, it's necessary | ||
# to add a dummy process not under test to keep the launch alive. launch_test | ||
# provides a simple launch action that does this: | ||
launch_testing.util.KeepAliveProc(), | ||
launch_testing.actions.ReadyToTest() | ||
]) , {'dut_process': dut_process} | ||
|
||
class TestTerminatingProcessStops(unittest.TestCase): | ||
|
||
def test_proc_terminates(self, proc_info, dut_process): | ||
cmd=[ | ||
'ros2', | ||
'run ', | ||
'rmw_zenoh_cpp', | ||
'rmw_zenohd', | ||
] | ||
process_group = subprocess.Popen( | ||
cmd, stdout=subprocess.PIPE, | ||
shell=True, env=proc_env, preexec_fn=os.setsid) | ||
print(f'Started rmw_zenohd with pid [{process_group.pid}]') | ||
|
||
proc_info.assertWaitForShutdown(process=dut_process, timeout=400) | ||
|
||
os.killpg(os.getpgid(process_group.pid), signal.SIGTERM) | ||
|
||
|
||
# These tests are run after the processes in generate_test_description() have shutdown. | ||
@launch_testing.post_shutdown_test() | ||
class TestShutdown(unittest.TestCase): | ||
|
||
def test_exit_codes(self, proc_info): | ||
"""Check if the processes exited normally.""" | ||
launch_testing.asserts.assertExitCodes(proc_info) |