Skip to contentSkip to conversation

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

PATCH Applied Ross Burton 2 participants 3 messages Jan 21, 2022 – Jan 22, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 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.

---
 meta-arm/lib/oeqa/controllers/fvp.py | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)
meta-arm/lib/oeqa/controllers/fvp.py +5 -6
index 87e1b941..29ccae5f 100644
@@ -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.logger.debug(f"Started runfvp PID {self.fvp.pid}")
 
-        async def wait_for_login():
-            bootlog = bytearray()
+        async def wait_for_login(bootlog):
             while True:
                 line = await self.fvp.stdout.read(1024)
                 if not line:
                     self.logger.debug("runfvp terminated")
-                    return False, bootlog
+                    return False
 
                 self.logger.debug(f"Read line [{line}]")
 
@@ -55,11 +54,11 @@ class OEFVPTarget(oeqa.core.target.ssh.OESSHTarget):
 
                 if b" login:" in bootlog:
                     self.logger.debug("Found login prompt")
-                    return True, bootlog
-            return False, bootlog
+                    return True
 
+        bootlog = bytearray()
         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:
                 return
         except asyncio.TimeoutError:
Signature · 1 line
2.25.1
#1 lore raw

PATCH 2/2 runfvp: fix undefined variable in terminal selection login

Since 10e60cc the terminal_map doesn't exist, this piece of code wasn't updated.

---
 scripts/runfvp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/runfvp +1 -1
index ca1e797c..c20455fd 100755
@@ -182,7 +182,7 @@ def parse_config(args, config):
             # TODO if raw mode
             # cli.extend(["--parameter", f"{terminal}.mode=raw"])
             # TODO put name into terminal title
-            cli.extend(["--parameter", f"{terminal}.terminal_command={terminal_map[args.terminals]}"])
+            cli.extend(["--parameter", f"{terminal}.terminal_command={terminals[args.terminals].command}"])
         else:
             # Disable terminal
             cli.extend(["--parameter", f"{terminal}.start_telnet=0"])
Signature · 1 line
2.25.1
Applied
#2 lore raw
In reply to Ross Burton
Quoted 5 lines · Ross Burton

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.

Applied, thanks!

[1/2] arm/oeqa/fvp: fix scoping issues with the bootlog

      commit: edf050394ecff2dccfafdc0bc2674311e2e7e0ef
[2/2] runfvp: fix undefined variable in terminal selection login
      commit: 254482284d4588532bd7b9d980193e3e41adaa99

Best regards,

Signature · 1 line
Jon Mason <[email protected]>