autotest: extend pexpect timeouts when running under Valgrind

This commit is contained in:
Peter Barker 2021-02-17 12:58:21 +11:00 committed by Peter Barker
parent a292fe1b8b
commit 33fee211a4
2 changed files with 17 additions and 4 deletions

View File

@ -5273,10 +5273,18 @@ Also, ignores heartbeats not from our target system'''
def start_mavproxy(self):
self.progress("Starting MAVProxy")
# determine a good pexpect timeout for reading MAVProxy's
# output; some regmes may require longer timeouts.
pexpect_timeout=60
if self.valgrind:
pexpect_timeout *= 10
self.mavproxy = util.start_MAVProxy_SITL(
self.vehicleinfo_key(),
logfile=self.mavproxy_logfile,
options=self.mavproxy_options())
options=self.mavproxy_options(),
pexpect_timeout=pexpect_timeout)
self.mavproxy.expect('Telemetry log: (\S+)\r\n')
self.logfile = self.mavproxy.match.group(1)
self.progress("LOGFILE %s" % self.logfile)

View File

@ -431,8 +431,13 @@ def MAVProxy_version():
raise ValueError("Unable to determine MAVProxy version from (%s)" % output)
return (int(match.group(1)), int(match.group(2)), int(match.group(3)))
def start_MAVProxy_SITL(atype, aircraft=None, setup=False, master='tcp:127.0.0.1:5762',
options=[], logfile=sys.stdout):
def start_MAVProxy_SITL(atype,
aircraft=None,
setup=False,
master='tcp:127.0.0.1:5762',
options=[],
pexpect_timeout=60,
logfile=sys.stdout):
"""Launch mavproxy connected to a SITL instance."""
local_mp_modules_dir = os.path.abspath(
os.path.join(__file__, '..', '..', '..', 'mavproxy_modules'))
@ -458,7 +463,7 @@ def start_MAVProxy_SITL(atype, aircraft=None, setup=False, master='tcp:127.0.0.1
print("PYTHONPATH: %s" % str(env['PYTHONPATH']))
print("Running: %s" % cmd_as_shell(cmd))
ret = pexpect.spawn(cmd[0], cmd[1:], logfile=logfile, encoding=ENCODING, timeout=60, env=env)
ret = pexpect.spawn(cmd[0], cmd[1:], logfile=logfile, encoding=ENCODING, timeout=pexpect_timeout, env=env)
ret.delaybeforesend = 0
pexpect_autoclose(ret)
return ret