Browse Source

Tools: autotest: Added a generic run_test.

This function is called from every vehicle to run a test. If any of the tests throws an exception, it will be caught here, and the name of the test and the exception that got raised will be added to the fail_list
mission-4.1.18
Karthik Desai 7 years ago committed by Peter Barker
parent
commit
7a20dd8b73
  1. 13
      Tools/autotest/common.py

13
Tools/autotest/common.py

@ -668,6 +668,19 @@ class AutoTest(ABC): @@ -668,6 +668,19 @@ class AutoTest(ABC):
self.progress("Failed to get EKF.flags=%u" % required_value)
raise AutoTestTimeoutException()
def run_test(self, desc, function):
self.progress("#")
self.progress("########## %s ##########" % (desc))
self.progress("#")
try:
function()
except Exception as e:
self.progress('FAILED: "%s": %s' % (desc, type(e).__name__))
self.fail_list.append( (desc, e) )
return
self.progress('PASSED: "%s"' % desc)
@abc.abstractmethod
def init(self):
"""Initilialize autotest feature."""

Loading…
Cancel
Save