This commit is contained in:
2026-08-04 18:14:49 +08:00
parent 74b3c89e1e
commit 61796dfa9f
8 changed files with 201 additions and 95 deletions
+37 -19
View File
@@ -287,15 +287,20 @@ TEST_F(MyFixture, SpinSomeWorks) {
| 包 | 测试 | 用例数 | 通过率 |
|---|---|---|---|
| py_pubsub | pytest + in-process | 4/4 | 100% |
| cpp_pubsub | gtest | 2/2 | 100% |
| py_srv | pytest + Service | 1/1 | 100% |
| py_action_demo | pytest + Action | 1/1 | 100% |
| cpp_robot_tf2 | gtest + TF2 | 2/2 | 100% |
| py_vision_demo | pytest + Image | 2/2 | 100% |
| bringup | launch 6 文件就绪 | OK | 100% |
| py_pubsub | pytest + in-process | 11/11 | 100% |
| cpp_pubsub | gtest + launch_test | 4/4 | 100% |
| py_srv | pytest + Service | 7/7 | 100% |
| py_action_demo | pytest + Action | 5/5 | 100% |
| cpp_robot_tf2 | gtest + TF2 + launch_test | 5/5 | 100% |
| py_vision_demo | pytest + Image | 13/13 | 100% |
| py_params | pytest + 参数校验 | 16/16 | 100% |
| cpp_custom_interface | gtest + launch_test | 4/4 | 100% |
| py_lifecycle_composable | pytest + Lifecycle | 6/6 | 100% |
| cpp_qos_demo | gtest + launch_test | 5/5 | 100% |
| py_overlay_dds | pytest + DDS 配置 | 6/6 | 100% |
| bringup | launch 聚合(无单元测试) | 0/0 | n/a |
**合计: 10/10 测试 100% PASSED**
**合计: 82/82 测试 100% PASSED**(64 pytest + 14 gtest + 4 launch_test)
---
@@ -378,10 +383,18 @@ jobs:
## 9. 在本仓库里跑
### 9.1 跑全部测试
### 9.1 跑全部测试(推荐用脚本)
```bash
docker exec ros2_dev bash -lc "source /opt/ros/humble/setup.bash && cd /root/ros2_ws && colcon test --packages-select py_pubsub cpp_pubsub py_srv py_action_demo cpp_robot_tf2 py_vision_demo bringup"
docker exec ros2_dev bash /root/ros2_ws/scripts/test.sh
# 或在容器内: bash scripts/test.sh
```
> ❗ `scripts/test.sh` 已带 `--executor sequential`,直接跑 12 包 82 用例稳定通过。
**手动等价命令**:
```bash
docker exec ros2_dev bash -lc "source /opt/ros/humble/setup.bash && cd /root/ros2_ws && colcon test --executor sequential --packages-select py_pubsub cpp_pubsub py_srv py_action_demo cpp_robot_tf2 py_vision_demo py_params cpp_custom_interface py_lifecycle_composable cpp_qos_demo py_overlay_dds bringup && colcon test-result --all"
```
### 9.2 单包测试
@@ -400,17 +413,22 @@ cat build/cpp_pubsub/test_results/cpp_pubsub/test_pub_sub.gtest.xml
cat build/py_pubsub/pytest.xml
```
### 9.4 当前结果(固化)
### 9.4 当前结果(2026-08-04 实测)
```
cpp_pubsub: 2/2 PASSED
✅ py_pubsub: 4/4 PASSED
✅ py_srv: 1/1 PASSED
✅ py_action_demo: 1/1 PASSED
✅ cpp_robot_tf2: 2/2 PASSED
✅ py_vision_demo: 2/2 PASSED
bringup: OK (no tests)
合计: 10/10 PASSED
✅ py_pubsub: 11/11 PASSED (pytest)
cpp_pubsub: 4/4 PASSED (3 gtest + 1 launch_test)
✅ py_srv: 7/7 PASSED (pytest)
✅ py_action_demo: 5/5 PASSED (pytest)
✅ cpp_robot_tf2: 5/5 PASSED (4 gtest + 1 launch_test)
✅ py_vision_demo: 13/13 PASSED (pytest)
py_params: 16/16 PASSED (pytest)
✅ cpp_custom_interface: 4/4 PASSED (3 gtest + 1 launch_test)
✅ py_lifecycle_composable: 6/6 PASSED (pytest)
✅ cpp_qos_demo: 5/5 PASSED (4 gtest + 1 launch_test)
✅ py_overlay_dds: 6/6 PASSED (pytest)
✅ bringup: 0/0 (launch 聚合,无单元测试)
合计: 82/82 PASSED (64 pytest + 14 gtest + 4 launch_test)
```
---