Browse Source

autotest: print stack traces for caught exceptions

c415-sdk
Peter Barker 4 years ago committed by Peter Barker
parent
commit
47aea5f44c
  1. 18
      Tools/autotest/arducopter.py
  2. 4
      Tools/autotest/arduplane.py
  3. 6
      Tools/autotest/rover.py

18
Tools/autotest/arducopter.py

@ -482,6 +482,8 @@ class AutoTestCopter(AutoTest):
self.wait_disarmed() self.wait_disarmed()
except Exception as e: except Exception as e:
self.progress("Caught exception: %s" %
self.get_exception_stacktrace(e))
ex = e ex = e
self.context_pop() self.context_pop()
@ -866,6 +868,8 @@ class AutoTestCopter(AutoTest):
try: try:
self.test_battery_failsafe(timeout=timeout) self.test_battery_failsafe(timeout=timeout)
except Exception as e: except Exception as e:
self.progress("Caught exception: %s" %
self.get_exception_stacktrace(e))
ex = e ex = e
self.set_parameter('BATT_LOW_VOLT', 0) self.set_parameter('BATT_LOW_VOLT', 0)
@ -1741,6 +1745,8 @@ class AutoTestCopter(AutoTest):
self.set_parameter('SIM_SPEEDUP', old_speedup) self.set_parameter('SIM_SPEEDUP', old_speedup)
self.do_RTL() self.do_RTL()
except Exception as e: except Exception as e:
self.progress("Caught exception: %s" %
self.get_exception_stacktrace(e))
ex = e ex = e
self.set_message_rate_hz(mavutil.mavlink.MAVLINK_MSG_ID_ATTITUDE, 0) self.set_message_rate_hz(mavutil.mavlink.MAVLINK_MSG_ID_ATTITUDE, 0)
sr = self.sitl_streamrate() sr = self.sitl_streamrate()
@ -1794,6 +1800,8 @@ class AutoTestCopter(AutoTest):
self.wait_groundspeed(10, 100, timeout=60) self.wait_groundspeed(10, 100, timeout=60)
except Exception as e: except Exception as e:
self.progress("Caught exception: %s" %
self.get_exception_stacktrace(e))
ex = e ex = e
self.set_rc(2, 1500) self.set_rc(2, 1500)
@ -2154,6 +2162,8 @@ class AutoTestCopter(AutoTest):
else: else:
raise NotAchievedException("Detected peak %.1f Hz %.2f dB" % (freq, peakdB)) raise NotAchievedException("Detected peak %.1f Hz %.2f dB" % (freq, peakdB))
except Exception as e: except Exception as e:
self.progress("Caught exception: %s" %
self.get_exception_stacktrace(e))
ex = e ex = e
self.context_pop() self.context_pop()
@ -4049,6 +4059,8 @@ class AutoTestCopter(AutoTest):
raise raise
except Exception as e: except Exception as e:
self.progress("Caught exception: %s" %
self.get_exception_stacktrace(e))
ex = e ex = e
self.context_pop() self.context_pop()
@ -4775,6 +4787,8 @@ class AutoTestCopter(AutoTest):
raise NotAchievedException("Failed to maintain takeoff alt") raise NotAchievedException("Failed to maintain takeoff alt")
self.progress("takeoff OK") self.progress("takeoff OK")
except Exception as e: except Exception as e:
self.progress("Caught exception: %s" %
self.get_exception_stacktrace(e))
ex = e ex = e
self.land_and_disarm() self.land_and_disarm()
@ -5689,6 +5703,8 @@ class AutoTestCopter(AutoTest):
except Exception as e: except Exception as e:
self.disarm_vehicle(force=True) self.disarm_vehicle(force=True)
self.progress("Caught exception: %s" %
self.get_exception_stacktrace(e))
ex = e ex = e
self.context_pop() self.context_pop()
if ex is not None: if ex is not None:
@ -6408,6 +6424,8 @@ class AutoTestHeli(AutoTestCopter):
self.progress("takeoff OK") self.progress("takeoff OK")
except Exception as e: except Exception as e:
self.progress("Caught exception: %s" %
self.get_exception_stacktrace(e))
ex = e ex = e
self.land_and_disarm() self.land_and_disarm()

4
Tools/autotest/arduplane.py

@ -791,6 +791,8 @@ class AutoTestPlane(AutoTest):
self.progress("Flaps OK") self.progress("Flaps OK")
except Exception as e: except Exception as e:
self.progress("Caught exception: %s" %
self.get_exception_stacktrace(e))
ex = e ex = e
self.context_pop() self.context_pop()
if ex: if ex:
@ -1620,6 +1622,8 @@ class AutoTestPlane(AutoTest):
raise NotAchievedException("Got collision message when I shouldn't have") raise NotAchievedException("Got collision message when I shouldn't have")
except Exception as e: except Exception as e:
self.progress("Caught exception: %s" %
self.get_exception_stacktrace(e))
ex = e ex = e
self.context_pop() self.context_pop()
self.reboot_sitl() self.reboot_sitl()

6
Tools/autotest/rover.py

@ -4893,6 +4893,8 @@ Brakes have negligible effect (with=%0.2fm without=%0.2fm delta=%0.2fm)
self.reboot_sitl() self.reboot_sitl()
self.delay_sim_time(10) self.delay_sim_time(10)
except Exception as e: except Exception as e:
self.progress("Caught exception: %s" %
self.get_exception_stacktrace(e))
ex = e ex = e
self.remove_example_script(example_script) self.remove_example_script(example_script)
self.reboot_sitl() self.reboot_sitl()
@ -4935,6 +4937,8 @@ Brakes have negligible effect (with=%0.2fm without=%0.2fm delta=%0.2fm)
self.remove_example_script(script) self.remove_example_script(script)
except Exception as e: except Exception as e:
self.progress("Caught exception: %s" %
self.get_exception_stacktrace(e))
ex = e ex = e
self.reboot_sitl() self.reboot_sitl()
@ -4969,6 +4973,8 @@ Brakes have negligible effect (with=%0.2fm without=%0.2fm delta=%0.2fm)
self.reboot_sitl() self.reboot_sitl()
self.wait_statustext('hello, world', check_context=True, timeout=30) self.wait_statustext('hello, world', check_context=True, timeout=30)
except Exception as e: except Exception as e:
self.progress("Caught exception: %s" %
self.get_exception_stacktrace(e))
ex = e ex = e
self.remove_example_script(example_script) self.remove_example_script(example_script)

Loading…
Cancel
Save