Skip to content

Commit 8be859d

Browse files
authored
fix(interop_test): return error if demo_node_cpp is missing (#27)
1 parent a8c732c commit 8be859d

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

ros-z-tests/tests/common/mod.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,3 +92,15 @@ pub fn check_rmw_zenoh_available() -> bool {
9292
.map(|status| status.success())
9393
.unwrap_or(false)
9494
}
95+
96+
/// Check if demo_nodes_cpp package is available
97+
#[allow(dead_code)]
98+
pub fn check_demo_nodes_cpp_available() -> bool {
99+
Command::new("ros2")
100+
.args(["pkg", "prefix", "demo_nodes_cpp"])
101+
.stdout(Stdio::null())
102+
.stderr(Stdio::null())
103+
.status()
104+
.map(|status| status.success())
105+
.unwrap_or(false)
106+
}

ros-z-tests/tests/service_interop.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,14 @@ fn test_ros2_server_ros_z_client() {
150150
panic!("ros2 CLI not available");
151151
}
152152

153+
if !check_demo_nodes_cpp_available() {
154+
panic!(
155+
"demo_nodes_cpp package not found!\n\
156+
Please install it with: apt install ros-$ROS_DISTRO-demo-nodes-cpp\n\
157+
Or ensure ROS environment is sourced: source /opt/ros/$ROS_DISTRO/setup.bash"
158+
);
159+
}
160+
153161
ensure_zenohd_running();
154162

155163
println!("\n=== Test: ROS2 server <-> ros-z client ===");

0 commit comments

Comments
 (0)