autotest: canonicalise on defaults_filepath rather than defaults_file

This naming better represents the fact this isn't just a filename.
This commit is contained in:
Peter Barker 2020-04-14 12:08:19 +10:00 committed by Peter Barker
parent c4e255fa5f
commit 10e8f3f3d7
5 changed files with 18 additions and 18 deletions

View File

@ -4934,7 +4934,7 @@ Brakes have negligible effect (with=%0.2fm without=%0.2fm delta=%0.2fm)
defaults_filepath = vinfo.options["APMrover2"]["frames"][model]["default_params_filename"] defaults_filepath = vinfo.options["APMrover2"]["frames"][model]["default_params_filename"]
self.customise_SITL_commandline([], self.customise_SITL_commandline([],
model=model, model=model,
defaults_file=defaults_filepath) defaults_filepath=defaults_filepath)
self.change_mode("MANUAL") self.change_mode("MANUAL")
self.wait_ready_to_arm() self.wait_ready_to_arm()
self.arm_vehicle() self.arm_vehicle()

View File

@ -62,7 +62,7 @@ class AutoTestPlane(AutoTest):
return "plane-elevrev" return "plane-elevrev"
def apply_defaultfile_parameters(self): def apply_defaultfile_parameters(self):
# plane passes in a defaults_file in place of applying # plane passes in a defaults_filepath in place of applying
# parameters afterwards. # parameters afterwards.
pass pass
@ -1864,4 +1864,4 @@ class AutoTestSoaring(AutoTestPlane):
("Mission", "Soaring mission", ("Mission", "Soaring mission",
self.fly_mission) self.fly_mission)
]) ])
return ret return ret

View File

@ -1370,12 +1370,12 @@ class AutoTest(ABC):
self.set_streamrate(self.sitl_streamrate()) self.set_streamrate(self.sitl_streamrate())
self.progress("Reboot complete") self.progress("Reboot complete")
def customise_SITL_commandline(self, customisations, model=None, defaults_file=None): def customise_SITL_commandline(self, customisations, model=None, defaults_filepath=None):
'''customisations could be "--uartF=sim:nmea" ''' '''customisations could be "--uartF=sim:nmea" '''
self.contexts[-1].sitl_commandline_customised = True self.contexts[-1].sitl_commandline_customised = True
self.stop_SITL() self.stop_SITL()
self.start_SITL(model=model, self.start_SITL(model=model,
defaults_file=defaults_file, defaults_filepath=defaults_filepath,
customisations=customisations, customisations=customisations,
wipe=False) wipe=False)
self.wait_heartbeat(drain_mav=True) self.wait_heartbeat(drain_mav=True)
@ -3387,9 +3387,9 @@ class AutoTest(ABC):
"wipe": True, "wipe": True,
} }
start_sitl_args.update(**sitl_args) start_sitl_args.update(**sitl_args)
if ("defaults_file" not in start_sitl_args or if ("defaults_filepath" not in start_sitl_args or
start_sitl_args["defaults_file"] is None): start_sitl_args["defaults_filepath"] is None):
start_sitl_args["defaults_file"] = self.defaults_filepath() start_sitl_args["defaults_filepath"] = self.defaults_filepath()
if "model" not in start_sitl_args or start_sitl_args["model"] is None: if "model" not in start_sitl_args or start_sitl_args["model"] is None:
start_sitl_args["model"] = self.frame start_sitl_args["model"] = self.frame

View File

@ -235,7 +235,7 @@ def start_SITL(binary,
home=None, home=None,
model=None, model=None,
speedup=1, speedup=1,
defaults_file=None, defaults_filepath=None,
unhide_parameters=False, unhide_parameters=False,
gdbserver=False, gdbserver=False,
breakpoints=[], breakpoints=[],
@ -318,10 +318,10 @@ def start_SITL(binary,
cmd.extend(['--model', model]) cmd.extend(['--model', model])
if speedup != 1: if speedup != 1:
cmd.extend(['--speedup', str(speedup)]) cmd.extend(['--speedup', str(speedup)])
if defaults_file is not None: if defaults_filepath is not None:
if type(defaults_file) == list: if type(defaults_filepath) == list:
defaults_file = ",".join(defaults_file) defaults_filepath = ",".join(defaults_filepath)
cmd.extend(['--defaults', defaults_file]) cmd.extend(['--defaults', defaults_filepath])
if unhide_parameters: if unhide_parameters:
cmd.extend(['--unhide-groups']) cmd.extend(['--unhide-groups'])
if vicon: if vicon:

View File

@ -59,17 +59,17 @@ class AutoTestQuadPlane(AutoTest):
self.current_test_name_directory = "ArduPlane_Tests/" + name + "/" self.current_test_name_directory = "ArduPlane_Tests/" + name + "/"
def apply_defaultfile_parameters(self): def apply_defaultfile_parameters(self):
# plane passes in a defaults_file in place of applying # plane passes in a defaults_filepath in place of applying
# parameters afterwards. # parameters afterwards.
pass pass
def defaults_filepath(self): def defaults_filepath(self):
vinfo = vehicleinfo.VehicleInfo() vinfo = vehicleinfo.VehicleInfo()
defaults_file = vinfo.options["ArduPlane"]["frames"][self.frame]["default_params_filename"] defaults_filepath = vinfo.options["ArduPlane"]["frames"][self.frame]["default_params_filename"]
if isinstance(defaults_file, str): if isinstance(defaults_filepath, str):
defaults_file = [defaults_file] defaults_filepath = [defaults_filepath]
defaults_list = [] defaults_list = []
for d in defaults_file: for d in defaults_filepath:
defaults_list.append(os.path.join(testdir, d)) defaults_list.append(os.path.join(testdir, d))
return ','.join(defaults_list) return ','.join(defaults_list)