|
| 1 | +#!/bin/bash |
| 2 | +set -e |
| 3 | + |
| 4 | +echo "=== rmw_zenoh_rs Executor Tests ===" |
| 5 | +echo "Date: $(date)" |
| 6 | +echo "ROS Distro: jazzy" |
| 7 | +echo "" |
| 8 | + |
| 9 | +# Setup |
| 10 | +RESULTS_DIR=/workspace/test-results |
| 11 | +mkdir -p $RESULTS_DIR |
| 12 | + |
| 13 | +# Source ROS |
| 14 | +source /opt/ros/jazzy/setup.bash |
| 15 | + |
| 16 | +# Install dependencies |
| 17 | +echo "=== Installing system dependencies ===" |
| 18 | +apt-get update |
| 19 | +apt-get install -y \ |
| 20 | + curl \ |
| 21 | + build-essential \ |
| 22 | + libclang-dev \ |
| 23 | + ros-jazzy-rclcpp \ |
| 24 | + ros-jazzy-test-msgs \ |
| 25 | + ros-jazzy-mimick-vendor \ |
| 26 | + ros-jazzy-osrf-testing-tools-cpp \ |
| 27 | + ros-jazzy-ament-cmake-google-benchmark \ |
| 28 | + ros-jazzy-performance-test-fixture \ |
| 29 | + ros-jazzy-rcpputils \ |
| 30 | + ros-jazzy-fastcdr \ |
| 31 | + ros-jazzy-rosidl-typesupport-fastrtps-c \ |
| 32 | + ros-jazzy-rosidl-typesupport-fastrtps-cpp \ |
| 33 | + git |
| 34 | + |
| 35 | +# Install Rust |
| 36 | +echo "=== Installing Rust ===" |
| 37 | +if ! command -v cargo &> /dev/null; then |
| 38 | + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y |
| 39 | + source "$HOME/.cargo/env" |
| 40 | +fi |
| 41 | +export PATH="$HOME/.cargo/bin:$PATH" |
| 42 | +rustc --version |
| 43 | +cargo --version |
| 44 | + |
| 45 | +# Create build workspace |
| 46 | +echo "=== Creating workspace ===" |
| 47 | +rm -rf /workspace/ws |
| 48 | +mkdir -p /workspace/ws/src |
| 49 | +cd /workspace/ws/src |
| 50 | + |
| 51 | +# Copy ros-z sources (excluding _tmp and other non-essential directories) |
| 52 | +echo "=== Copying ros-z sources ===" |
| 53 | +cp -r /workspace/ros-z /workspace/ws/src/ros-z |
| 54 | + |
| 55 | +# Add COLCON_IGNORE to directories that shouldn't be scanned |
| 56 | +for dir in _tmp book .github scripts ros-z-tests ros-z-console ros-z-py assets nix .config .claude; do |
| 57 | + if [ -d "/workspace/ws/src/ros-z/$dir" ]; then |
| 58 | + touch "/workspace/ws/src/ros-z/$dir/COLCON_IGNORE" |
| 59 | + fi |
| 60 | +done |
| 61 | + |
| 62 | +# Copy local rclcpp fork (with patches) |
| 63 | +echo "=== Copying local rclcpp fork ===" |
| 64 | +cp -r /workspace/rclcpp /workspace/ws/src/rclcpp |
| 65 | + |
| 66 | +# Copy local rcl fork (with patches) |
| 67 | +echo "=== Copying local rcl fork ===" |
| 68 | +cp -r /workspace/rcl /workspace/ws/src/rcl |
| 69 | + |
| 70 | +# Build rmw_zenoh_rs |
| 71 | +echo "=== Building rmw_zenoh_rs ===" |
| 72 | +cd /workspace/ws |
| 73 | +source /opt/ros/jazzy/setup.bash |
| 74 | +colcon build --packages-select rmw_zenoh_rs --cmake-args -DCMAKE_BUILD_TYPE=Release |
| 75 | + |
| 76 | +# Source the built workspace |
| 77 | +source /workspace/ws/install/setup.bash |
| 78 | + |
| 79 | +# Build rcl and rclcpp with tests (colcon resolves dependencies) |
| 80 | +echo "=== Building rcl and rclcpp with tests ===" |
| 81 | +colcon build --packages-up-to rclcpp --cmake-args -DBUILD_TESTING=ON |
| 82 | + |
| 83 | +# Source again after building |
| 84 | +source /workspace/ws/install/setup.bash |
| 85 | + |
| 86 | +# Set RMW implementation |
| 87 | +export RMW_IMPLEMENTATION=rmw_zenoh_rs |
| 88 | + |
| 89 | +echo "" |
| 90 | +echo "=== Verifying RMW implementation ===" |
| 91 | +echo "RMW_IMPLEMENTATION=$RMW_IMPLEMENTATION" |
| 92 | + |
| 93 | +# Check if rmw_zenoh_rs library exists |
| 94 | +if [ -f "/workspace/ws/install/rmw_zenoh_rs/lib/librmw_zenoh_rs.so" ]; then |
| 95 | + echo "rmw_zenoh_rs library found!" |
| 96 | +else |
| 97 | + echo "ERROR: rmw_zenoh_rs library not found!" |
| 98 | + ls -la /workspace/ws/install/rmw_zenoh_rs/lib/ 2>/dev/null || echo "Directory not found" |
| 99 | + exit 1 |
| 100 | +fi |
| 101 | + |
| 102 | +echo "" |
| 103 | +echo "=== Running Executor Tests with rmw_zenoh_rs ===" |
| 104 | +echo "" |
| 105 | + |
| 106 | +# Navigate to build directory for tests |
| 107 | +cd /workspace/ws/build/rclcpp |
| 108 | + |
| 109 | +# Run executor tests and capture results |
| 110 | +TESTS=( |
| 111 | + "test_executors" |
| 112 | + "test_executors_intraprocess" |
| 113 | + "test_executors_busy_waiting" |
| 114 | + "test_executors_warmup" |
| 115 | + "test_executors_timer_cancel_behavior" |
| 116 | + "test_executors_callback_group_behavior" |
| 117 | +) |
| 118 | + |
| 119 | +for test in "${TESTS[@]}"; do |
| 120 | + echo "" |
| 121 | + echo "=== Running $test ===" |
| 122 | + |
| 123 | + # Run test with timeout and capture output |
| 124 | + if timeout 180 ctest -R "^${test}$" -V 2>&1 | tee "$RESULTS_DIR/${test}.log"; then |
| 125 | + echo "RESULT: $test PASSED" |
| 126 | + echo "PASSED" >> "$RESULTS_DIR/${test}.result" |
| 127 | + else |
| 128 | + EXIT_CODE=$? |
| 129 | + echo "RESULT: $test FAILED (exit code: $EXIT_CODE)" |
| 130 | + echo "FAILED (exit code: $EXIT_CODE)" >> "$RESULTS_DIR/${test}.result" |
| 131 | + fi |
| 132 | +done |
| 133 | + |
| 134 | +# Summary |
| 135 | +echo "" |
| 136 | +echo "=== Test Summary ===" |
| 137 | +echo "" |
| 138 | +for test in "${TESTS[@]}"; do |
| 139 | + if [ -f "$RESULTS_DIR/${test}.result" ]; then |
| 140 | + echo "$test: $(cat $RESULTS_DIR/${test}.result)" |
| 141 | + else |
| 142 | + echo "$test: NOT RUN" |
| 143 | + fi |
| 144 | +done |
| 145 | + |
| 146 | +echo "" |
| 147 | +echo "=== Detailed logs saved to $RESULTS_DIR ===" |
| 148 | +ls -la $RESULTS_DIR/ |
0 commit comments