1
0
mirror of https://git.yoctoproject.org/meta-arm synced 2026-07-16 03:47:19 +00:00

arm/lib: Decouple console parsing from the FVPRunner

To simplify the FVPRunner class, create a separate ConsolePortParser
class to handle reading an iterator of lines and parsing port numbers
for FVP consoles. Use this in runfvp and the test targets.

This refactor also allows the stream being monitored to be changed more
easily, e.g. to a log file.

Issue-Id: SCM-5314
Signed-off-by: Peter Hoyes <Peter.Hoyes@arm.com>
Change-Id: Iade3a4c803fb355b04af7afa298d0a41fe707d94
Signed-off-by: Jon Mason <jon.mason@arm.com>
This commit is contained in:
Peter Hoyes
2022-11-15 15:01:14 +00:00
committed by Jon Mason
parent c6418d6d59
commit 8eba0eecec
3 changed files with 47 additions and 45 deletions
+5 -4
View File
@@ -52,17 +52,18 @@ def start_fvp(args, config, extra_args):
fvp.start(config, extra_args, args.terminals)
if args.console:
fvp.add_line_callback(lambda line: logger.debug(f"FVP output: {line}"))
expected_terminal = config["consoles"]["default"]
if not expected_terminal:
logger.error("--console used but FVP_CONSOLE not set in machine configuration")
return 1
telnet = fvp.create_telnet(expected_terminal)
parser = runner.ConsolePortParser(fvp.stdout)
port = parser.parse_port(expected_terminal)
telnet = fvp.create_telnet(port)
telnet.wait()
logger.debug(f"Telnet quit, cancelling tasks")
else:
fvp.add_line_callback(lambda line: print(line))
fvp.run()
for line in fvp.stdout:
print(line.strip().decode(errors='ignore'))
finally:
fvp.stop()