autotest: correct implicit reboot after a failed test

correct problem where we only rebooted if the vehicle was armed after a failed test.

Should correct cascading failures after some tests
This commit is contained in:
Peter Barker 2023-04-07 11:31:05 +10:00 committed by Peter Barker
parent 3863183996
commit b620ba23a9
1 changed files with 7 additions and 0 deletions

View File

@ -7858,6 +7858,9 @@ Also, ignores heartbeats not from our target system'''
passed = False
reset_needed = True
# if we haven't already reset ArduPilot because it's dead,
# then ensure the vehicle was disarmed at the end of the test.
# If it wasn't then the test is considered failed:
if ardupilot_alive and self.armed() and not self.is_tracker():
if ex is None:
ex = ArmedAtEndOfTestException("Still armed at end of test")
@ -7874,6 +7877,10 @@ Also, ignores heartbeats not from our target system'''
self.progress("Force-rebooting SITL")
self.reboot_sitl() # that'll learn it
passed = False
elif not passed: # implicit reboot after a failed test:
self.progress("Test failed but ArduPilot process alive; rebooting")
self.progress("Force-rebooting SITL")
self.reboot_sitl() # that'll learn it
if self._mavproxy is not None:
self.progress("Stopping auto-started mavproxy")