Browse Source

autotest: wipe and reinitialise parameters when resetting SITL commandline

Should fix this scenario:
 - Plane soaring test uses different defaults file
 - soaring test sets a parameter away from default value
 - context pop sets it back to the value in the defaults file
 - it is now in permanent storage with the default found in the
different defaults file used by the soaring test
 - we finish running the soaring test an reset the SITL command line
back to default, with the old defaults file
 - we go on to running the next test.  At this point the value for that
parameter is the default in the defaults file used by the soaring test.

Something similar applies in the Callisto test.
zr-v5.1
Peter Barker 4 years ago committed by Peter Barker
parent
commit
0a5eedb05a
  1. 10
      Tools/autotest/common.py
  2. 2
      Tools/autotest/rover.py

10
Tools/autotest/common.py

@ -1916,9 +1916,10 @@ class AutoTest(ABC):
def reset_SITL_commandline(self): def reset_SITL_commandline(self):
self.progress("Resetting SITL commandline to default") self.progress("Resetting SITL commandline to default")
self.stop_SITL() self.stop_SITL()
self.start_SITL(wipe=False) self.start_SITL(wipe=True)
self.set_streamrate(self.sitl_streamrate()+1) self.set_streamrate(self.sitl_streamrate()+1)
self.set_streamrate(self.sitl_streamrate()) self.set_streamrate(self.sitl_streamrate())
self.apply_defaultfile_parameters()
self.progress("Reset SITL commandline to default") self.progress("Reset SITL commandline to default")
def stop_SITL(self): def stop_SITL(self):
@ -3248,6 +3249,7 @@ class AutoTest(ABC):
self.cpufailsafe_wait_servo_channel_value(2, 1260) self.cpufailsafe_wait_servo_channel_value(2, 1260)
self.send_set_rc(2, 1700) self.send_set_rc(2, 1700)
self.cpufailsafe_wait_servo_channel_value(2, 1660) self.cpufailsafe_wait_servo_channel_value(2, 1660)
self.reset_SITL_commandline()
def mavproxy_arm_vehicle(self): def mavproxy_arm_vehicle(self):
"""Arm vehicle with mavlink arm message send from MAVProxy.""" """Arm vehicle with mavlink arm message send from MAVProxy."""
@ -4707,8 +4709,7 @@ Also, ignores heartbeats not from our target system'''
self.get_exception_stacktrace(e)) self.get_exception_stacktrace(e))
ex = e ex = e
self.test_timings[desc] = time.time() - start_time self.test_timings[desc] = time.time() - start_time
if self.contexts[-1].sitl_commandline_customised: reset_needed = self.contexts[-1].sitl_commandline_customised
self.reset_SITL_commandline()
self.context_pop() self.context_pop()
passed = True passed = True
@ -4754,6 +4755,9 @@ Also, ignores heartbeats not from our target system'''
self.progress("Starting MAVProxy interaction as directed") self.progress("Starting MAVProxy interaction as directed")
self.mavproxy.interact() self.mavproxy.interact()
if reset_needed:
self.reset_SITL_commandline()
self.clear_mission_using_mavproxy() self.clear_mission_using_mavproxy()
tee.close() tee.close()

2
Tools/autotest/rover.py

@ -5265,6 +5265,8 @@ Brakes have negligible effect (with=%0.2fm without=%0.2fm delta=%0.2fm)
self.set_rc(1, 1400) self.set_rc(1, 1400)
self.set_rc(3, 1600) self.set_rc(3, 1600)
self.wait_heading(60) self.wait_heading(60)
self.zero_throttle()
self.disarm_vehicle()
def test_slew_rate(self): def test_slew_rate(self):
"""Test Motor Slew Rate feature.""" """Test Motor Slew Rate feature."""

Loading…
Cancel
Save