Skip to content

Commit bb92b9b

Browse files
added CLI --sim option to test_flights_sim and made two different systemtests workflows as suggested by Wolfram
1 parent 086e3fe commit bb92b9b

File tree

3 files changed

+68
-2
lines changed

3 files changed

+68
-2
lines changed
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: System Tests Real
2+
3+
4+
#run the physical tests only manually or on push from feature-systemtests-downloadUSD
5+
on:
6+
push:
7+
branches: [ "feature-systemtests-downloadUSD" ]
8+
# manual trigger
9+
workflow_dispatch:
10+
11+
jobs:
12+
build:
13+
runs-on: self-hosted
14+
steps:
15+
- name: Create workspace
16+
id: step1
17+
run: |
18+
cd ros2_ws/src || mkdir -p ros2_ws/src
19+
- name: Checkout motion capture package
20+
id: step2
21+
run: |
22+
cd ros2_ws/src
23+
ls motion_capture_tracking || git clone --branch ros2 --recursive https://github.com/IMRCLab/motion_capture_tracking.git
24+
- name: Checkout Crazyswarm2
25+
id: step3
26+
uses: actions/checkout@v4
27+
with:
28+
path: ros2_ws/src/crazyswarm2
29+
submodules: 'recursive'
30+
- name: Build workspace
31+
id: step4
32+
run: |
33+
source /opt/ros/humble/setup.bash
34+
cd ros2_ws
35+
colcon build --symlink-install
36+
37+
- name: Flight test
38+
id: step5
39+
run: |
40+
cd ros2_ws
41+
source /opt/ros/humble/setup.bash
42+
. install/local_setup.bash
43+
export ROS_LOCALHOST_ONLY=1
44+
python3 src/crazyswarm2/systemtests/test_flights.py
45+
46+
- name: Upload files
47+
id: step6
48+
if: '!cancelled()'
49+
uses: actions/upload-artifact@v3
50+
with:
51+
name: pdf_rosbags_and_logs
52+
path: |
53+
ros2_ws/results
54+
55+
56+
57+
58+

.github/workflows/systemtests_sim.yml

Whitespace-only changes.

systemtests/test_flights_sim.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def clean_process(process:Popen) -> int :
4848

4949

5050
class TestFlights(unittest.TestCase):
51-
SIM = True
51+
SIM = False
5252

5353
def __init__(self, methodName: str = "runTest") -> None:
5454
super().__init__(methodName)
@@ -171,4 +171,12 @@ def test_multi_trajectory(self):
171171

172172

173173
if __name__ == '__main__':
174-
unittest.main()
174+
from argparse import ArgumentParser, Namespace
175+
import sys
176+
parser = ArgumentParser(description="Runs (real or simulated) flight tests with pytest framework")
177+
parser.add_argument("--sim", action="store_true", help="Runs the test from the simulation backend")
178+
args, other_args = parser.parse_known_args()
179+
if args.sim :
180+
TestFlights.SIM = True
181+
182+
unittest.main(argv=[sys.argv[0]] + other_args)

0 commit comments

Comments
 (0)