Skip to content

Commit

Permalink
GH Actions: Enable grind option
Browse files Browse the repository at this point in the history
This allows to run the script in grind mode to find CI failures that are triggered through e.g. race conditions.
  • Loading branch information
LorenzMeier committed Dec 26, 2019
1 parent 73edc21 commit 26d01b8
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 23 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/sitl_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ jobs:
# Build all targets
run: DONT_RUN=1 make px4_sitl gazebo mavsdk_tests
- name: Run simulation tests
run: test/mavsdk_tests/mavsdk_test_runner.py --speed-factor 100
# Grind configuration: Run ~8 minutes for 35 iterations == close to the 6 hour limit of Github Actions
run: test/mavsdk_tests/mavsdk_test_runner.py --speed-factor 20 --iterations 1 --fail-early
34 changes: 19 additions & 15 deletions test/mavsdk_tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,21 +1,25 @@
cmake_minimum_required(VERSION 3.5.1)

find_package(MAVSDK)
if(${PX4_BOARD_MODEL} MATCHES "sitl")
find_package(MAVSDK QUIET)

if (MAVSDK_FOUND)
add_executable(mavsdk_tests
test_main.cpp
autopilot_tester.cpp
test_mission_multicopter.cpp
)
if (MAVSDK_FOUND)
add_executable(mavsdk_tests
test_main.cpp
autopilot_tester.cpp
test_mission_multicopter.cpp
)

target_link_libraries(mavsdk_tests
MAVSDK::mavsdk
MAVSDK::mavsdk_action
MAVSDK::mavsdk_mission
MAVSDK::mavsdk_telemetry
)
target_link_libraries(mavsdk_tests
MAVSDK::mavsdk
MAVSDK::mavsdk_action
MAVSDK::mavsdk_mission
MAVSDK::mavsdk_telemetry
)

target_compile_options(mavsdk_tests
PRIVATE -std=c++17 -Wall -Wextra -Werror)
target_compile_options(mavsdk_tests
PRIVATE -std=c++17 -Wall -Wextra -Werror)
else()
message("MAVSDK C++ not found, skipping mavsdk_tests build..")
endif()
endif()
17 changes: 10 additions & 7 deletions test/mavsdk_tests/mavsdk_test_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,12 +243,6 @@ def main():

returncode = test_runner.wait(group['timeout_min'])
was_success = (returncode == 0)
print("Test '{}': {}".
format(test, "Success" if was_success else "Fail"))
if not was_success:
overall_success = False
if args.fail_early:
break

if args.gui:
returncode = gzclient_runner.stop()
Expand All @@ -260,7 +254,16 @@ def main():
px4_runner.stop()
print("px4 exited with {}".format(returncode))

if not overall_success and x > 0:
# Test run results
print("Test '{}': {}".
format(test, "Success" if was_success else "Fail"))

# Flag it as group test failure, but finish the rest of the test targets
if not was_success:
overall_success = False

# Abort after the full matrix / test group
if not overall_success and x > 0 and args.fail_early:
print("Aborting with a failure in test run %d" % (x + 1))
sys.exit(0 if overall_success else 1)

Expand Down

0 comments on commit 26d01b8

Please sign in to comment.