1
0
mirror of https://git.yoctoproject.org/meta-arm synced 2026-06-08 15:30:08 +00:00

arm/oeqa/fvp: fix scoping issues with the bootlog

If wait_for_login() times out then it raises an exception instead of
passing back return values, so the bootlog is never assigned.

We always want a boot log, so initialise it outside of wait_for_login and
pass it in.

Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Jon Mason <jon.mason@arm.com>
This commit is contained in:
Ross Burton
2022-01-21 16:41:58 +00:00
committed by Jon Mason
parent 5377fb7e09
commit edf050394e
+5 -6
View File
@@ -39,13 +39,12 @@ class OEFVPTarget(oeqa.core.target.ssh.OESSHTarget):
self.fvp = await asyncio.create_subprocess_exec(*cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, stdin=subprocess.PIPE) self.fvp = await asyncio.create_subprocess_exec(*cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, stdin=subprocess.PIPE)
self.logger.debug(f"Started runfvp PID {self.fvp.pid}") self.logger.debug(f"Started runfvp PID {self.fvp.pid}")
async def wait_for_login(): async def wait_for_login(bootlog):
bootlog = bytearray()
while True: while True:
line = await self.fvp.stdout.read(1024) line = await self.fvp.stdout.read(1024)
if not line: if not line:
self.logger.debug("runfvp terminated") self.logger.debug("runfvp terminated")
return False, bootlog return False
self.logger.debug(f"Read line [{line}]") self.logger.debug(f"Read line [{line}]")
@@ -55,11 +54,11 @@ class OEFVPTarget(oeqa.core.target.ssh.OESSHTarget):
if b" login:" in bootlog: if b" login:" in bootlog:
self.logger.debug("Found login prompt") self.logger.debug("Found login prompt")
return True, bootlog return True
return False, bootlog
bootlog = bytearray()
try: try:
found, bootlog = await asyncio.wait_for(wait_for_login(), self.boot_timeout) found = await asyncio.wait_for(wait_for_login(bootlog), self.boot_timeout)
if found: if found:
return return
except asyncio.TimeoutError: except asyncio.TimeoutError: