Tools: use relative paths for parameter files

This commit is contained in:
Willian Galvani 2022-01-26 14:20:18 -03:00 committed by Peter Barker
parent 392911fc62
commit 6e91ae554a
3 changed files with 8 additions and 6 deletions

View File

@ -1658,7 +1658,7 @@ class AutoTest(ABC):
if self.params is None:
self.params = self.model_defaults_filepath(self.frame)
for x in self.params:
self.repeatedly_apply_parameter_file(os.path.join(testdir, x))
self.repeatedly_apply_parameter_file(x)
def count_lines_in_filepath(self, filepath):
return len([i for i in open(filepath)])
@ -11695,7 +11695,7 @@ switch value'''
defaults_filepath = [defaults_filepath]
defaults_list = []
for d in defaults_filepath:
defaults_list.append(os.path.join(testdir, d))
defaults_list.append(util.reltopdir(os.path.join(testdir, d)))
return defaults_list
def load_default_params_file(self, filename):

View File

@ -408,10 +408,11 @@ def start_SITL(binary,
cmd.extend(['--speedup', str(speedup)])
if defaults_filepath is not None:
if type(defaults_filepath) == list:
if len(defaults_filepath):
cmd.extend(['--defaults', ",".join(defaults_filepath)])
defaults = [reltopdir(path) for path in defaults_filepath]
if len(defaults):
cmd.extend(['--defaults', ",".join(defaults)])
else:
cmd.extend(['--defaults', defaults_filepath])
cmd.extend(['--defaults', reltopdir(defaults_filepath)])
if unhide_parameters:
cmd.extend(['--unhide-groups'])
# somewhere for MAVProxy to connect to:

View File

@ -28,6 +28,7 @@ import shlex
import binascii
import math
from pysim import util
from pysim import vehicleinfo
@ -683,7 +684,7 @@ def start_vehicle(binary, opts, stuff, spawns=None):
paths = stuff["default_params_filename"]
if not isinstance(paths, list):
paths = [paths]
paths = [os.path.join(autotest_dir, x) for x in paths]
paths = [util.reltopdir(os.path.join(autotest_dir, x)) for x in paths]
for x in paths:
if not os.path.isfile(x):
print("The parameter file (%s) does not exist" % (x,))