runfvp: make fvp runner to hold the config
RFC PATCH v2 1/3 runfvp: make fvp runner to hold the config
At the moment the config is load and pass to FVPRunner.
Change the ownership to FVPRunner.
--- meta-arm/lib/fvp/runner.py | 15 +++++-- meta-arm/lib/oeqa/controllers/fvp.py | 13 +++--- meta-arm/lib/oeqa/selftest/cases/runfvp.py | 49 +++++++++++++--------- scripts/runfvp | 11 +++-- 4 files changed, 52 insertions(+), 36 deletions(-)
meta-arm/lib/fvp/runner.py +11 -4
@@ -6,7 +6,7 @@ import shutil import sys from .terminal import terminals - +from .conffile import load def cli_from_config(config, terminal_choice): cli = []
@@ -83,14 +83,18 @@ class FVPRunner: self._fvp_process = None self._telnets = [] self._pexpects = [] + self._config = None + + def start(self, fvpconf, extra_args=[], terminal_choice="none", stdout=subprocess.PIPE): + self._logger.debug(f"Loading {fvpconf}") + self._config = load(fvpconf) - def start(self, config, extra_args=[], terminal_choice="none", stdout=subprocess.PIPE): - cli = cli_from_config(config, terminal_choice) + cli = cli_from_config(self._config, terminal_choice) cli += extra_args # Pass through environment variables needed for GUI applications, such # as xterm, to work. - env = config['env'] + env = self._config['env'] for name in ('DISPLAY', 'PATH', 'WAYLAND_DISPLAY', 'XAUTHORITY'): if name in os.environ: env[name] = os.environ[name]
@@ -140,6 +144,9 @@ class FVPRunner: def wait(self, timeout): self._fvp_process.wait(timeout) + def getConfig(self): + return self._config + @property def stdout(self): return self._fvp_process.stdout
meta-arm/lib/oeqa/controllers/fvp.py +7 -6
@@ -3,7 +3,7 @@ import pexpect import os from oeqa.core.target.ssh import OESSHTarget -from fvp import conffile, runner +from fvp import runner class OEFVPSSHTarget(OESSHTarget):
@@ -19,7 +19,6 @@ class OEFVPSSHTarget(OESSHTarget): basename = pathlib.Path(rootfs) basename = basename.name.replace("".join(basename.suffixes), "") self.fvpconf = image_dir / (basename + ".fvpconf") - self.config = conffile.load(self.fvpconf) self.bootlog = bootlog if not self.fvpconf.exists():
@@ -31,7 +30,7 @@ class OEFVPSSHTarget(OESSHTarget): def start(self, **kwargs): self.fvp_log = self._create_logfile("fvp") self.fvp = runner.FVPRunner(self.logger) - self.fvp.start(self.config, stdout=self.fvp_log) + self.fvp.start(self.fvpconf, stdout=self.fvp_log) self.logger.debug(f"Started FVP PID {self.fvp.pid()}") self._after_start()
@@ -72,8 +71,9 @@ class OEFVPTarget(OEFVPSSHTarget): def _after_start(self): with open(self.fvp_log.name, 'rb') as logfile: parser = runner.ConsolePortParser(logfile) - self.logger.debug(f"Awaiting console on terminal {self.config['consoles']['default']}") - port = parser.parse_port(self.config['consoles']['default']) + config = self.fvp.getConfig() + self.logger.debug(f"Awaiting console on terminal {config['consoles']['default']}") + port = parser.parse_port(config['consoles']['default']) console = self.fvp.create_pexpect(port) try: console.expect("login\\:", timeout=self.boot_timeout)
@@ -105,7 +105,8 @@ class OEFVPSerialTarget(OEFVPSSHTarget): def _after_start(self): with open(self.fvp_log.name, 'rb') as logfile: parser = runner.ConsolePortParser(logfile) - for name, console in self.config["consoles"].items(): + config = self.fvp.getConfig() + for name, console in config["consoles"].items(): logfile = self._create_logfile(name) self.logger.info(f'Creating terminal {name} on {console}') port = parser.parse_port(console)
meta-arm/lib/oeqa/selftest/cases/runfvp.py +29 -20
66 lines not on this page · raw message
scripts/runfvp +5 -6
@@ -14,7 +14,7 @@ logger = logging.getLogger("RunFVP") libdir = pathlib.Path(__file__).parents[1] / "meta-arm" / "lib" sys.path.insert(0, str(libdir)) -from fvp import terminal, runner, conffile +from fvp import terminal, runner def parse_args(arguments): import argparse
@@ -49,12 +49,13 @@ def parse_args(arguments): logger.debug(f"FVP arguments: {fvp_args}") return args, fvp_args -def start_fvp(args, config, extra_args): +def start_fvp(args, fvpconf, extra_args): fvp = runner.FVPRunner(logger) try: - fvp.start(config, extra_args, args.terminals) + fvp.start(fvpconf, extra_args, args.terminals) if args.console: + config = fvp.getConfig() expected_terminal = config["consoles"].get("default") if expected_terminal is None: logger.error("--console used but FVP_CONSOLE not set in machine configuration")
@@ -87,9 +88,7 @@ def runfvp(cli_args): config_file = args.config else: config_file = conffile.find(args.config) - logger.debug(f"Loading {config_file}") - config = conffile.load(config_file) - start_fvp(args, config, extra_args) + start_fvp(args, config_file, extra_args) if __name__ == "__main__":
Signature · 1 line
2.40.1
RFC PATCH v2 2/3 fvp: runner: execute fvp process in the same working directory as fvpconf
In Order to be able to have filepath relative to fvpconf, execute the fvp process in the same working directory.
--- meta-arm/lib/fvp/runner.py | 7 ++++++- meta-arm/lib/oeqa/selftest/cases/runfvp.py | 8 ++++++-- 2 files changed, 12 insertions(+), 3 deletions(-)
meta-arm/lib/fvp/runner.py +6 -1
@@ -99,11 +99,16 @@ class FVPRunner: if name in os.environ: env[name] = os.environ[name] + # Allow filepath to be relative to fvp configuration file + cwd = os.path.dirname(fvpconf) + self._logger.debug(f"FVP call will be executed in working directory: {cwd}") + self._logger.debug(f"Constructed FVP call: {shlex_join(cli)}") self._fvp_process = subprocess.Popen( cli, stdin=subprocess.DEVNULL, stdout=stdout, stderr=subprocess.STDOUT, - env=env) + env=env, + cwd=cwd) def stop(self): if self._fvp_process:
meta-arm/lib/oeqa/selftest/cases/runfvp.py +6 -2
@@ -102,6 +102,7 @@ class RunnerTests(OESelftestTestCase): with tempfile.NamedTemporaryFile('w') as fvpconf: json.dump(config, fvpconf) fvpconf.flush() + cwd_mock = os.path.dirname(fvpconf.name) fvp.start(fvpconf.name) m.assert_called_once_with(['/usr/bin/FVP_Binary',
@@ -112,7 +113,8 @@ class RunnerTests(OESelftestTestCase): stdin=unittest.mock.ANY, stdout=unittest.mock.ANY, stderr=unittest.mock.ANY, - env={"FOO":"BAR", "PATH": "/path-42:/usr/sbin:/usr/bin:/sbin:/bin"}) + env={"FOO":"BAR", "PATH": "/path-42:/usr/sbin:/usr/bin:/sbin:/bin"}, + cwd=cwd_mock) @unittest.mock.patch.dict(os.environ, {"DISPLAY": ":42", "WAYLAND_DISPLAY": "wayland-42", "PATH": "/path-42:/usr/sbin:/usr/bin:/sbin:/bin"}) def test_env_passthrough(self):
@@ -132,10 +134,12 @@ class RunnerTests(OESelftestTestCase): with tempfile.NamedTemporaryFile('w') as fvpconf: json.dump(config, fvpconf) fvpconf.flush() + cwd_mock = os.path.dirname(fvpconf.name) fvp.start(fvpconf.name) m.assert_called_once_with(['/usr/bin/FVP_Binary'], stdin=unittest.mock.ANY, stdout=unittest.mock.ANY, stderr=unittest.mock.ANY, - env={"DISPLAY":":42", "FOO": "BAR", "WAYLAND_DISPLAY": "wayland-42", "PATH": "/path-42:/usr/sbin:/usr/bin:/sbin:/bin"}) + env={"DISPLAY":":42", "FOO": "BAR", "WAYLAND_DISPLAY": "wayland-42", "PATH": "/path-42:/usr/sbin:/usr/bin:/sbin:/bin"}, + cwd=cwd_mock)
Signature · 1 line
2.40.1
RFC PATCH v2 3/3 runfvp: update filepath in fvpconf to relative path
In reply to Clément PéronUsing absolute path in fvpconf will leak the host machine path.
This is a bit annoying when the builder and the runner doesn't use the same filepath hierachy.
Switch to relative path instead of absolute.
--- documentation/runfvp.md | 8 ++++---- meta-arm-bsp/conf/machine/corstone1000-fvp.conf | 6 +++--- meta-arm-bsp/conf/machine/corstone500.conf | 4 ++-- meta-arm-bsp/conf/machine/fvp-baser-aemv8r64.conf | 4 ++-- meta-arm-bsp/conf/machine/include/fvp-common.inc | 10 +++++----- meta-arm-bsp/conf/machine/tc1.conf | 8 ++++---- 6 files changed, 20 insertions(+), 20 deletions(-)
documentation/runfvp.md +4 -4
@@ -64,7 +64,7 @@ If `FVP_PROVIDER` is not set then it is assumed that `FVP_EXE` is installed on t Parameters passed to the FVP with the `--parameter`/`-C` option. These are expressed as variable flags so individual parameters can be altered easily. For example: ``` -FVP_CONFIG[bp.flashloader0.fname] = "${DEPLOY_DIR_IMAGE}/fip-fvp.bin" +FVP_CONFIG[bp.flashloader0.fname] = "fip-fvp.bin" ``` ### `FVP_DATA`
@@ -72,8 +72,8 @@ FVP_CONFIG[bp.flashloader0.fname] = "${DEPLOY_DIR_IMAGE}/fip-fvp.bin" Specify raw data to load at the specified address, passed to the FVP with the `--data` option. This is a space-separated list of parameters in the format `[INST=]FILE@[MEMSPACE:]ADDRESS`. For example: ``` -FVP_DATA = "cluster0.cpu0=${DEPLOY_DIR_IMAGE}/Image@0x80080000 \ - cluster0.cpu0=${DEPLOY_DIR_IMAGE}/fvp-base-revc.dtb@0x83000000" +FVP_DATA = "cluster0.cpu0=Image@0x80080000 \ + cluster0.cpu0=fvp-base-revc.dtb@0x83000000" ``` ### `FVP_APPLICATIONS`
@@ -81,7 +81,7 @@ FVP_DATA = "cluster0.cpu0=${DEPLOY_DIR_IMAGE}/Image@0x80080000 \ Applications to load on the cores, passed to the FVP with the `--application` option. These are expressed as variable flags with the flag name being the instance and flag value the filename, for example: ``` -FVP_APPLICATIONS[cluster0] = "${DEPLOY_DIR_IMAGE}/linux-system.axf" +FVP_APPLICATIONS[cluster0] = "linux-system.axf" ``` Note that symbols are not allowed in flag names, so if you need to use a wildcard in the instance then you'll need to use `FVP_EXTRA_ARGS` and `--application` directly.
meta-arm-bsp/conf/machine/corstone1000-fvp.conf +3 -3
@@ -17,7 +17,7 @@ FVP_EXE ?= "FVP_Corstone-1000" FVP_CONSOLE ?= "host_terminal_0" # FVP Parameters -FVP_CONFIG[se.trustedBootROMloader.fname] ?= "${DEPLOY_DIR_IMAGE}/bl1.bin" +FVP_CONFIG[se.trustedBootROMloader.fname] ?= "bl1.bin" FVP_CONFIG[board.xnvm_size] ?= "64" FVP_CONFIG[se.trustedSRAM_config] ?= "6" FVP_CONFIG[se.BootROM_config] ?= "3"
@@ -32,10 +32,10 @@ FVP_CONFIG[se.nvm.update_raw_image] ?= "0" FVP_CONFIG[se.cryptocell.USER_OTP_FILTERING_DISABLE] ?= "1" # Boot image -FVP_DATA ?= "board.flash0=${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.wic@0x68000000" +FVP_DATA ?= "board.flash0=${IMAGE_NAME}.rootfs.wic@0x68000000" # External system (cortex-M3) -FVP_CONFIG[extsys_harness0.extsys_flashloader.fname] ?= "${DEPLOY_DIR_IMAGE}/es_flashfw.bin" +FVP_CONFIG[extsys_harness0.extsys_flashloader.fname] ?= "es_flashfw.bin" # FVP Terminals FVP_TERMINALS[host.host_terminal_0] ?= "Normal World Console"
meta-arm-bsp/conf/machine/corstone500.conf +2 -2
@@ -38,8 +38,8 @@ TEST_SUITES = "linuxboot" FVP_PROVIDER ?= "fvp-corstone500-native" FVP_EXE ?= "FVP_Corstone-500" -FVP_CONFIG[board.flashloader0.fname] ?= "${DEPLOY_DIR_IMAGE}/bl1.bin" -FVP_DATA ?= "css.cluster.cpu0=${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.wic.nopt@0x80000000" +FVP_CONFIG[board.flashloader0.fname] ?= "bl1.bin" +FVP_DATA ?= "css.cluster.cpu0=${IMAGE_NAME}.rootfs.wic.nopt@0x80000000" FVP_CONSOLE ?= "terminal_0" FVP_TERMINALS[css.terminal_0] ?= "console" FVP_TERMINALS[css.terminal_1] ?= ""
meta-arm-bsp/conf/machine/fvp-baser-aemv8r64.conf +2 -2
@@ -34,7 +34,7 @@ TEST_SUITES = "linuxboot" TEST_TARGET_IP ?= "127.0.0.1:8022" TEST_SERVER_IP ?= "127.0.1.1" -FVP_EXTRA_ARGS = "-a cluster0*=${DEPLOY_DIR_IMAGE}/linux-system.axf" +FVP_EXTRA_ARGS = "-a cluster0*=linux-system.axf" FVP_PROVIDER ?= "fvp-base-r-aem-native" FVP_EXE ?= "FVP_BaseR_AEMv8R" FVP_CONSOLE ?= "terminal_0"
@@ -50,7 +50,7 @@ FVP_CONFIG[bp.virtio_net.hostbridge.userNetworking] ?= "1" FVP_CONFIG[bp.virtio_net.secure_accesses] = "1" FVP_CONFIG[bp.virtio_rng.enabled] ?= "1" FVP_CONFIG[bp.virtio_rng.secure_accesses] = "1" -FVP_CONFIG[bp.virtioblockdevice.image_path] ?= "${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.wic" +FVP_CONFIG[bp.virtioblockdevice.image_path] ?= "${IMAGE_NAME}.rootfs.wic" FVP_CONFIG[bp.virtioblockdevice.secure_accesses] = "1" FVP_CONFIG[cache_state_modelled] ?= "0" FVP_CONFIG[cci400.force_on_from_start] = "1"
meta-arm-bsp/conf/machine/include/fvp-common.inc +5 -5
@@ -33,15 +33,15 @@ FVP_CONFIG[bp.virtio_net.hostbridge.userNetworking] ?= "1" # Tell testimage to connect to localhost:8022, and forward that to SSH in the FVP. FVP_CONFIG[bp.virtio_net.hostbridge.userNetPorts] = "8022=22" FVP_CONFIG[cache_state_modelled] ?= "0" -FVP_CONFIG[bp.secureflashloader.fname] ?= "${DEPLOY_DIR_IMAGE}/bl1-fvp.bin" -FVP_CONFIG[bp.flashloader0.fname] ?= "${DEPLOY_DIR_IMAGE}/fip-fvp.bin" -FVP_CONFIG[bp.virtioblockdevice.image_path] ?= "${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.wic" +FVP_CONFIG[bp.secureflashloader.fname] ?= "bl1-fvp.bin" +FVP_CONFIG[bp.flashloader0.fname] ?= "fip-fvp.bin" +FVP_CONFIG[bp.virtioblockdevice.image_path] ?= "${IMAGE_NAME}.rootfs.wic" # Set the baseline to ARMv8.4, as the default is 8.0. FVP_CONFIG[cluster0.has_arm_v8-4] = "1" FVP_CONFIG[cluster1.has_arm_v8-4] = "1" FVP_CONSOLE ?= "terminal_0" -FVP_DATA ?= "cluster0.cpu0=${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}@0x80080000 \ - cluster0.cpu0=${DEPLOY_DIR_IMAGE}/fvp-base-revc.dtb@0x8fc00000" +FVP_DATA ?= "cluster0.cpu0=${KERNEL_IMAGETYPE}@0x80080000 \ + cluster0.cpu0=fvp-base-revc.dtb@0x8fc00000" FVP_TERMINALS[bp.terminal_0] ?= "Console" FVP_TERMINALS[bp.terminal_1] ?= "" FVP_TERMINALS[bp.terminal_2] ?= ""
meta-arm-bsp/conf/machine/tc1.conf +4 -4
@@ -14,9 +14,9 @@ FVP_PROVIDER ?= "fvp-tc1-native" FVP_EXE ?= "FVP_TC1" # FVP Parameters -FVP_CONFIG[css.scp.ROMloader.fname] ?= "${DEPLOY_DIR_IMAGE}/scp_romfw.bin" -FVP_CONFIG[css.trustedBootROMloader.fname] ?= "${DEPLOY_DIR_IMAGE}/bl1-tc.bin" -FVP_CONFIG[board.flashloader0.fname] ?= "${DEPLOY_DIR_IMAGE}/fip_gpt-tc.bin" +FVP_CONFIG[css.scp.ROMloader.fname] ?= "scp_romfw.bin" +FVP_CONFIG[css.trustedBootROMloader.fname] ?= "bl1-tc.bin" +FVP_CONFIG[board.flashloader0.fname] ?= "fip_gpt-tc.bin" #FVP_CONFIG[board.hostbridge.userNetworking] ?= "true" #FVP_CONFIG[board.hostbridge.userNetPorts] ?= "8022=22"
@@ -28,4 +28,4 @@ FVP_TERMINALS[soc.terminal_s0] ?= "Secure Console" FVP_TERMINALS[soc.terminal_s1] ?= "Console" # Boot image -FVP_DATA ?= "board.dram=${DEPLOY_DIR_IMAGE}/fitImage-core-image-minimal-tc1-tc1@0x20000000" +FVP_DATA ?= "board.dram=fitImage-core-image-minimal-tc1-tc1@0x20000000"
Signature · 1 line
2.40.1
Hi Peter,
Quoted 4 lines · Clément Péron
At the moment the config is load and pass to FVPRunner.
Change the ownership to FVPRunner.
What do you think about this patch?
I have moved the ownership of the config to the FVPRunner. Is it what you had in mind?
Thanks for your feedback
Regards,
Clement
Quoted 222 lines
Signed-off-by Clément Péron <[email protected]>--- meta-arm/lib/fvp/runner.py | 15 +++++-- meta-arm/lib/oeqa/controllers/fvp.py | 13 +++--- meta-arm/lib/oeqa/selftest/cases/runfvp.py | 49 +++++++++++++--------- scripts/runfvp | 11 +++-- 4 files changed, 52 insertions(+), 36 deletions(-)meta-arm/lib/fvp/runner.py +11
-4@@ -6,7 +6,7 @@ import shutil import sys from .terminal import terminals - +from .conffile import load def cli_from_config(config, terminal_choice): cli = []@@ -83,14 +83,18 @@ class FVPRunner: self._fvp_process = None self._telnets = [] self._pexpects = [] + self._config = None + + def start(self, fvpconf, extra_args=[], terminal_choice="none", stdout=subprocess.PIPE): + self._logger.debug(f"Loading {fvpconf}") + self._config = load(fvpconf) - def start(self, config, extra_args=[], terminal_choice="none", stdout=subprocess.PIPE): - cli = cli_from_config(config, terminal_choice) + cli = cli_from_config(self._config, terminal_choice) cli += extra_args # Pass through environment variables needed for GUI applications, such # as xterm, to work. - env = config['env'] + env = self._config['env'] for name in ('DISPLAY', 'PATH', 'WAYLAND_DISPLAY', 'XAUTHORITY'): if name in os.environ: env[name] = os.environ[name]@@ -140,6 +144,9 @@ class FVPRunner: def wait(self, timeout): self._fvp_process.wait(timeout) + def getConfig(self): + return self._config + @property def stdout(self): return self._fvp_process.stdoutmeta-arm/lib/oeqa/controllers/fvp.py +7
-6@@ -3,7 +3,7 @@ import pexpect import os from oeqa.core.target.ssh import OESSHTarget -from fvp import conffile, runner +from fvp import runner class OEFVPSSHTarget(OESSHTarget):@@ -19,7 +19,6 @@ class OEFVPSSHTarget(OESSHTarget): basename = pathlib.Path(rootfs) basename = basename.name.replace("".join(basename.suffixes), "") self.fvpconf = image_dir / (basename + ".fvpconf") - self.config = conffile.load(self.fvpconf) self.bootlog = bootlog if not self.fvpconf.exists():@@ -31,7 +30,7 @@ class OEFVPSSHTarget(OESSHTarget): def start(self, **kwargs): self.fvp_log = self._create_logfile("fvp") self.fvp = runner.FVPRunner(self.logger) - self.fvp.start(self.config, stdout=self.fvp_log) + self.fvp.start(self.fvpconf, stdout=self.fvp_log) self.logger.debug(f"Started FVP PID {self.fvp.pid()}") self._after_start()@@ -72,8 +71,9 @@ class OEFVPTarget(OEFVPSSHTarget): def _after_start(self): with open(self.fvp_log.name, 'rb') as logfile: parser = runner.ConsolePortParser(logfile) - self.logger.debug(f"Awaiting console on terminal {self.config['consoles']['default']}") - port = parser.parse_port(self.config['consoles']['default']) + config = self.fvp.getConfig() + self.logger.debug(f"Awaiting console on terminal {config['consoles']['default']}") + port = parser.parse_port(config['consoles']['default']) console = self.fvp.create_pexpect(port) try: console.expect("login\\:", timeout=self.boot_timeout)@@ -105,7 +105,8 @@ class OEFVPSerialTarget(OEFVPSSHTarget): def _after_start(self): with open(self.fvp_log.name, 'rb') as logfile: parser = runner.ConsolePortParser(logfile) - for name, console in self.config["consoles"].items(): + config = self.fvp.getConfig() + for name, console in config["consoles"].items(): logfile = self._create_logfile(name) self.logger.info(f'Creating terminal {name} on {console}') port = parser.parse_port(console)meta-arm/lib/oeqa/selftest/cases/runfvp.py +29
-20@@ -1,5 +1,6 @@ import asyncio import os +import json import pathlib import subprocess import tempfile@@ -88,16 +89,20 @@ class RunnerTests(OESelftestTestCase): from fvp import runner with self.create_mock() as m: fvp = runner.FVPRunner(self.logger) - fvp.start({ - "fvp-bindir": "/usr/bin", - "exe": "FVP_Binary", - "parameters": {'foo': 'bar'}, - "data": ['data1'], - "applications": {'a1': 'file'}, - "terminals": {}, - "args": ['--extra-arg'], - "env": {"FOO": "BAR"} - }) + config = {"fvp-bindir": "/usr/bin", + "exe": "FVP_Binary", + "parameters": {'foo': 'bar'}, + "data": ['data1'], + "applications": {'a1': 'file'}, + "terminals": {}, + "args": ['--extra-arg'], + "env": {"FOO": "BAR"} + } + + with tempfile.NamedTemporaryFile('w') as fvpconf: + json.dump(config, fvpconf) + fvpconf.flush() + fvp.start(fvpconf.name) m.assert_called_once_with(['/usr/bin/FVP_Binary', '--parameter', 'foo=bar',@@ -114,16 +119,20 @@ class RunnerTests(OESelftestTestCase): from fvp import runner with self.create_mock() as m: fvp = runner.FVPRunner(self.logger) - fvp.start({ - "fvp-bindir": "/usr/bin", - "exe": "FVP_Binary", - "parameters": {}, - "data": [], - "applications": {}, - "terminals": {}, - "args": [], - "env": {"FOO": "BAR"} - }) + config = {"fvp-bindir": "/usr/bin", + "exe": "FVP_Binary", + "parameters": {}, + "data": [], + "applications": {}, + "terminals": {}, + "args": [], + "env": {"FOO": "BAR"} + } + + with tempfile.NamedTemporaryFile('w') as fvpconf: + json.dump(config, fvpconf) + fvpconf.flush() + fvp.start(fvpconf.name) m.assert_called_once_with(['/usr/bin/FVP_Binary'], stdin=unittest.mock.ANY,scripts/runfvp +5
-7@@ -14,7 +14,7 @@ logger = logging.getLogger("RunFVP") libdir = pathlib.Path(__file__).parents[1] / "meta-arm" / "lib" sys.path.insert(0, str(libdir)) -from fvp import terminal, runner, conffile +from fvp import terminal, runner def parse_args(arguments): import argparse@@ -49,12 +49,13 @@ def parse_args(arguments): logger.debug(f"FVP arguments: {fvp_args}") return args, fvp_args -def start_fvp(args, config, extra_args): +def start_fvp(args, fvpconf, extra_args): fvp = runner.FVPRunner(logger) try: - fvp.start(config, extra_args, args.terminals) + fvp.start(fvpconf, extra_args, args.terminals) if args.console: + config = fvp.getConfig() expected_terminal = config["consoles"].get("default") if expected_terminal is None: logger.error("--console used but FVP_CONSOLE not set in machine configuration")@@ -87,9 +88,7 @@ def runfvp(cli_args): config_file = args.config else: config_file = conffile.find(args.config) - logger.debug(f"Loading {config_file}") - config = conffile.load(config_file) - start_fvp(args, config, extra_args) + start_fvp(args, config_file, extra_args) if __name__ == "__main__": --2.40.1
Hi Clement,
Quoted 5 lines · Clément Péron
Hi Peter,
Quoted 2 lines · Clément Péron
At the moment the config is load and pass to FVPRunner.
Quoted 7 lines
Quoted 1 line
Change the ownership to FVPRunner.
What do you think about this patch?
I have moved the ownership of the config to the FVPRunner. Is it what you had in mind?
Thanks for your feedback
First of all, this skipped my attention last week so apologies for the follow-up delay.
All three patches look great to me, but I'm having trouble applying them cleanly to master and I'm seeing CRLF line endings. It might be something at my end, but is it possible you need to rebase and/or use git send-email ?
@Jon Mason: LGTM if it pases CI!
Peter
Quoted 226 lines
Regards,
ClementQuoted 221 lines
Signed-off-by Clément Péron <[email protected]>--- meta-arm/lib/fvp/runner.py | 15 +++++-- meta-arm/lib/oeqa/controllers/fvp.py | 13 +++--- meta-arm/lib/oeqa/selftest/cases/runfvp.py | 49 +++++++++++++--------- scripts/runfvp | 11 +++-- 4 files changed, 52 insertions(+), 36 deletions(-)meta-arm/lib/fvp/runner.py +11
-4@@ -6,7 +6,7 @@ import shutil import sys from .terminal import terminals - +from .conffile import load def cli_from_config(config, terminal_choice): cli = []@@ -83,14 +83,18 @@ class FVPRunner: self._fvp_process = None self._telnets = [] self._pexpects = [] + self._config = None + + def start(self, fvpconf, extra_args=[], terminal_choice="none", stdout=subprocess.PIPE): + self._logger.debug(f"Loading {fvpconf}") + self._config = load(fvpconf) - def start(self, config, extra_args=[], terminal_choice="none", stdout=subprocess.PIPE): - cli = cli_from_config(config, terminal_choice) + cli = cli_from_config(self._config, terminal_choice) cli += extra_args # Pass through environment variables needed for GUI applications, such # as xterm, to work. - env = config['env'] + env = self._config['env'] for name in ('DISPLAY', 'PATH', 'WAYLAND_DISPLAY', 'XAUTHORITY'): if name in os.environ: env[name] = os.environ[name]@@ -140,6 +144,9 @@ class FVPRunner: def wait(self, timeout): self._fvp_process.wait(timeout) + def getConfig(self): + return self._config + @property def stdout(self): return self._fvp_process.stdoutmeta-arm/lib/oeqa/controllers/fvp.py +7
-6@@ -3,7 +3,7 @@ import pexpect import os from oeqa.core.target.ssh import OESSHTarget -from fvp import conffile, runner +from fvp import runner class OEFVPSSHTarget(OESSHTarget):@@ -19,7 +19,6 @@ class OEFVPSSHTarget(OESSHTarget): basename = pathlib.Path(rootfs) basename = basename.name.replace("".join(basename.suffixes), "") self.fvpconf = image_dir / (basename + ".fvpconf") - self.config = conffile.load(self.fvpconf) self.bootlog = bootlog if not self.fvpconf.exists():@@ -31,7 +30,7 @@ class OEFVPSSHTarget(OESSHTarget): def start(self, **kwargs): self.fvp_log = self._create_logfile("fvp") self.fvp = runner.FVPRunner(self.logger) - self.fvp.start(self.config, stdout=self.fvp_log) + self.fvp.start(self.fvpconf, stdout=self.fvp_log) self.logger.debug(f"Started FVP PID {self.fvp.pid()}") self._after_start()@@ -72,8 +71,9 @@ class OEFVPTarget(OEFVPSSHTarget): def _after_start(self): with open(self.fvp_log.name, 'rb') as logfile: parser = runner.ConsolePortParser(logfile) - self.logger.debug(f"Awaiting console on terminal {self.config['consoles']['default']}") - port = parser.parse_port(self.config['consoles']['default']) + config = self.fvp.getConfig() + self.logger.debug(f"Awaiting console on terminal {config['consoles']['default']}") + port = parser.parse_port(config['consoles']['default']) console = self.fvp.create_pexpect(port) try: console.expect("login\\:", timeout=self.boot_timeout)@@ -105,7 +105,8 @@ class OEFVPSerialTarget(OEFVPSSHTarget): def _after_start(self): with open(self.fvp_log.name, 'rb') as logfile: parser = runner.ConsolePortParser(logfile) - for name, console in self.config["consoles"].items(): + config = self.fvp.getConfig() + for name, console in config["consoles"].items(): logfile = self._create_logfile(name) self.logger.info(f'Creating terminal {name} on {console}') port = parser.parse_port(console)meta-arm/lib/oeqa/selftest/cases/runfvp.py +29
-20@@ -1,5 +1,6 @@ import asyncio import os +import json import pathlib import subprocess import tempfile@@ -88,16 +89,20 @@ class RunnerTests(OESelftestTestCase): from fvp import runner with self.create_mock() as m: fvp = runner.FVPRunner(self.logger) - fvp.start({ - "fvp-bindir": "/usr/bin", - "exe": "FVP_Binary", - "parameters": {'foo': 'bar'}, - "data": ['data1'], - "applications": {'a1': 'file'}, - "terminals": {}, - "args": ['--extra-arg'], - "env": {"FOO": "BAR"} - }) + config = {"fvp-bindir": "/usr/bin", + "exe": "FVP_Binary", + "parameters": {'foo': 'bar'}, + "data": ['data1'], + "applications": {'a1': 'file'}, + "terminals": {}, + "args": ['--extra-arg'], + "env": {"FOO": "BAR"} + } + + with tempfile.NamedTemporaryFile('w') as fvpconf: + json.dump(config, fvpconf) + fvpconf.flush() + fvp.start(fvpconf.name) m.assert_called_once_with(['/usr/bin/FVP_Binary', '--parameter', 'foo=bar',@@ -114,16 +119,20 @@ class RunnerTests(OESelftestTestCase): from fvp import runner with self.create_mock() as m: fvp = runner.FVPRunner(self.logger) - fvp.start({ - "fvp-bindir": "/usr/bin", - "exe": "FVP_Binary", - "parameters": {}, - "data": [], - "applications": {}, - "terminals": {}, - "args": [], - "env": {"FOO": "BAR"} - }) + config = {"fvp-bindir": "/usr/bin", + "exe": "FVP_Binary", + "parameters": {}, + "data": [], + "applications": {}, + "terminals": {}, + "args": [], + "env": {"FOO": "BAR"} + } + + with tempfile.NamedTemporaryFile('w') as fvpconf: + json.dump(config, fvpconf) + fvpconf.flush() + fvp.start(fvpconf.name) m.assert_called_once_with(['/usr/bin/FVP_Binary'], stdin=unittest.mock.ANY,scripts/runfvp +5
-7@@ -14,7 +14,7 @@ logger = logging.getLogger("RunFVP") libdir = pathlib.Path(__file__).parents[1] / "meta-arm" / "lib" sys.path.insert(0, str(libdir)) -from fvp import terminal, runner, conffile +from fvp import terminal, runner def parse_args(arguments): import argparse@@ -49,12 +49,13 @@ def parse_args(arguments): logger.debug(f"FVP arguments: {fvp_args}") return args, fvp_args -def start_fvp(args, config, extra_args): +def start_fvp(args, fvpconf, extra_args): fvp = runner.FVPRunner(logger) try: - fvp.start(config, extra_args, args.terminals) + fvp.start(fvpconf, extra_args, args.terminals) if args.console: + config = fvp.getConfig() expected_terminal = config["consoles"].get("default") if expected_terminal is None: logger.error("--console used but FVP_CONSOLE not set in machine configuration")@@ -87,9 +88,7 @@ def runfvp(cli_args): config_file = args.config else: config_file = conffile.find(args.config) - logger.debug(f"Loading {config_file}") - config = conffile.load(config_file) - start_fvp(args, config, extra_args) + start_fvp(args, config_file, extra_args) if __name__ == "__main__": --2.40.1
Quoted 16 lines · Peter Hoyes
Hi Clement,
Quoted 5 lines · Cl�ment P�ron
Hi Peter,
Quoted 2 lines · Cl�ment P�ron
At the moment the config is load and pass to FVPRunner.
Quoted 7 lines
Quoted 1 line
Change the ownership to FVPRunner.
What do you think about this patch?
I have moved the ownership of the config to the FVPRunner. Is it what you had in mind?
Thanks for your feedback
Quoted 8 lines
First of all, this skipped my attention last week so apologies for the follow-up delay.
All three patches look great to me, but I'm having trouble applying them cleanly to master and I'm seeing CRLF line endings. It might be something at my end, but� is it possible you need to rebase and/or use git send-email ?
@Jon Mason: LGTM if it pases CI!
I applied them to met-arm master-next and it passes CI (when stacked on top the other two pathes). See
https://gitlab.com/jonmason00/meta-arm/-/pipelines/874749366
If there aren't any objections, I can apply all five.
Thanks,
Jon
Quoted 230 lines
Peter
Quoted 226 lines
Regards,
ClementQuoted 221 lines
Signed-off-by Cl�ment P�ron <[email protected]>--- meta-arm/lib/fvp/runner.py | 15 +++++-- meta-arm/lib/oeqa/controllers/fvp.py | 13 +++--- meta-arm/lib/oeqa/selftest/cases/runfvp.py | 49 +++++++++++++--------- scripts/runfvp | 11 +++-- 4 files changed, 52 insertions(+), 36 deletions(-)meta-arm/lib/fvp/runner.py +11
-4@@ -6,7 +6,7 @@ import shutil import sys from .terminal import terminals - +from .conffile import load def cli_from_config(config, terminal_choice): cli = []@@ -83,14 +83,18 @@ class FVPRunner: self._fvp_process = None self._telnets = [] self._pexpects = [] + self._config = None + + def start(self, fvpconf, extra_args=[], terminal_choice="none", stdout=subprocess.PIPE): + self._logger.debug(f"Loading {fvpconf}") + self._config = load(fvpconf) - def start(self, config, extra_args=[], terminal_choice="none", stdout=subprocess.PIPE): - cli = cli_from_config(config, terminal_choice) + cli = cli_from_config(self._config, terminal_choice) cli += extra_args # Pass through environment variables needed for GUI applications, such # as xterm, to work. - env = config['env'] + env = self._config['env'] for name in ('DISPLAY', 'PATH', 'WAYLAND_DISPLAY', 'XAUTHORITY'): if name in os.environ: env[name] = os.environ[name]@@ -140,6 +144,9 @@ class FVPRunner: def wait(self, timeout): self._fvp_process.wait(timeout) + def getConfig(self): + return self._config + @property def stdout(self): return self._fvp_process.stdoutmeta-arm/lib/oeqa/controllers/fvp.py +7
-6@@ -3,7 +3,7 @@ import pexpect import os from oeqa.core.target.ssh import OESSHTarget -from fvp import conffile, runner +from fvp import runner class OEFVPSSHTarget(OESSHTarget):@@ -19,7 +19,6 @@ class OEFVPSSHTarget(OESSHTarget): basename = pathlib.Path(rootfs) basename = basename.name.replace("".join(basename.suffixes), "") self.fvpconf = image_dir / (basename + ".fvpconf") - self.config = conffile.load(self.fvpconf) self.bootlog = bootlog if not self.fvpconf.exists():@@ -31,7 +30,7 @@ class OEFVPSSHTarget(OESSHTarget): def start(self, **kwargs): self.fvp_log = self._create_logfile("fvp") self.fvp = runner.FVPRunner(self.logger) - self.fvp.start(self.config, stdout=self.fvp_log) + self.fvp.start(self.fvpconf, stdout=self.fvp_log) self.logger.debug(f"Started FVP PID {self.fvp.pid()}") self._after_start()@@ -72,8 +71,9 @@ class OEFVPTarget(OEFVPSSHTarget): def _after_start(self): with open(self.fvp_log.name, 'rb') as logfile: parser = runner.ConsolePortParser(logfile) - self.logger.debug(f"Awaiting console on terminal {self.config['consoles']['default']}") - port = parser.parse_port(self.config['consoles']['default']) + config = self.fvp.getConfig() + self.logger.debug(f"Awaiting console on terminal {config['consoles']['default']}") + port = parser.parse_port(config['consoles']['default']) console = self.fvp.create_pexpect(port) try: console.expect("login\\:", timeout=self.boot_timeout)@@ -105,7 +105,8 @@ class OEFVPSerialTarget(OEFVPSSHTarget): def _after_start(self): with open(self.fvp_log.name, 'rb') as logfile: parser = runner.ConsolePortParser(logfile) - for name, console in self.config["consoles"].items(): + config = self.fvp.getConfig() + for name, console in config["consoles"].items(): logfile = self._create_logfile(name) self.logger.info(f'Creating terminal {name} on {console}') port = parser.parse_port(console)meta-arm/lib/oeqa/selftest/cases/runfvp.py +29
-20@@ -1,5 +1,6 @@ import asyncio import os +import json import pathlib import subprocess import tempfile@@ -88,16 +89,20 @@ class RunnerTests(OESelftestTestCase): from fvp import runner with self.create_mock() as m: fvp = runner.FVPRunner(self.logger) - fvp.start({ - "fvp-bindir": "/usr/bin", - "exe": "FVP_Binary", - "parameters": {'foo': 'bar'}, - "data": ['data1'], - "applications": {'a1': 'file'}, - "terminals": {}, - "args": ['--extra-arg'], - "env": {"FOO": "BAR"} - }) + config = {"fvp-bindir": "/usr/bin", + "exe": "FVP_Binary", + "parameters": {'foo': 'bar'}, + "data": ['data1'], + "applications": {'a1': 'file'}, + "terminals": {}, + "args": ['--extra-arg'], + "env": {"FOO": "BAR"} + } + + with tempfile.NamedTemporaryFile('w') as fvpconf: + json.dump(config, fvpconf) + fvpconf.flush() + fvp.start(fvpconf.name) m.assert_called_once_with(['/usr/bin/FVP_Binary', '--parameter', 'foo=bar',@@ -114,16 +119,20 @@ class RunnerTests(OESelftestTestCase): from fvp import runner with self.create_mock() as m: fvp = runner.FVPRunner(self.logger) - fvp.start({ - "fvp-bindir": "/usr/bin", - "exe": "FVP_Binary", - "parameters": {}, - "data": [], - "applications": {}, - "terminals": {}, - "args": [], - "env": {"FOO": "BAR"} - }) + config = {"fvp-bindir": "/usr/bin", + "exe": "FVP_Binary", + "parameters": {}, + "data": [], + "applications": {}, + "terminals": {}, + "args": [], + "env": {"FOO": "BAR"} + } + + with tempfile.NamedTemporaryFile('w') as fvpconf: + json.dump(config, fvpconf) + fvpconf.flush() + fvp.start(fvpconf.name) m.assert_called_once_with(['/usr/bin/FVP_Binary'], stdin=unittest.mock.ANY,scripts/runfvp +5
-7@@ -14,7 +14,7 @@ logger = logging.getLogger("RunFVP") libdir = pathlib.Path(__file__).parents[1] / "meta-arm" / "lib" sys.path.insert(0, str(libdir)) -from fvp import terminal, runner, conffile +from fvp import terminal, runner def parse_args(arguments): import argparse@@ -49,12 +49,13 @@ def parse_args(arguments): logger.debug(f"FVP arguments: {fvp_args}") return args, fvp_args -def start_fvp(args, config, extra_args): +def start_fvp(args, fvpconf, extra_args): fvp = runner.FVPRunner(logger) try: - fvp.start(config, extra_args, args.terminals) + fvp.start(fvpconf, extra_args, args.terminals) if args.console: + config = fvp.getConfig() expected_terminal = config["consoles"].get("default") if expected_terminal is None: logger.error("--console used but FVP_CONSOLE not set in machine configuration")@@ -87,9 +88,7 @@ def runfvp(cli_args): config_file = args.config else: config_file = conffile.find(args.config) - logger.debug(f"Loading {config_file}") - config = conffile.load(config_file) - start_fvp(args, config, extra_args) + start_fvp(args, config_file, extra_args) if __name__ == "__main__": --2.40.1
Hi Jon, Peter,
Quoted 25 lines · Jon Mason
Quoted 23 lines · Peter Hoyes
Hi Clement,
Quoted 5 lines · Clément Péron
Hi Peter,
Quoted 2 lines · Clément Péron
At the moment the config is load and pass to FVPRunner.
Quoted 7 lines
Quoted 1 line
Change the ownership to FVPRunner.
What do you think about this patch?
I have moved the ownership of the config to the FVPRunner. Is it what you had in mind?
Thanks for your feedback
First of all, this skipped my attention last week so apologies for the follow-up delay.
All three patches look great to me, but I'm having trouble applying them cleanly to master and I'm seeing CRLF line endings. It might be something at my end, but is it possible you need to rebase and/or use git send-email ?
Quoted 7 lines
Quoted 1 line
@Jon Mason: LGTM if it pases CI!
I applied them to met-arm master-next and it passes CI (when stacked on top the other two pathes). See
https://gitlab.com/jonmason00/meta-arm/-/pipelines/874749366If there aren't any objections, I can apply all five.
That would be great, the last missing piece is the gator-daemon.
I'm now building a FVP image and running it inside Docker to get a "almost deterministic" ARM benchmark running on different x86 hardware, that's cool :).
I'm not sure how people deal with benchmarks in CI, but this one seems really stable.
Regards,
Clement
Quoted 234 lines
Thanks,
JonQuoted 230 lines
Peter
Quoted 226 lines
Regards,
ClementQuoted 221 lines
Signed-off-by Clément Péron <[email protected]>--- meta-arm/lib/fvp/runner.py | 15 +++++-- meta-arm/lib/oeqa/controllers/fvp.py | 13 +++--- meta-arm/lib/oeqa/selftest/cases/runfvp.py | 49 +++++++++++++--------- scripts/runfvp | 11 +++-- 4 files changed, 52 insertions(+), 36 deletions(-)meta-arm/lib/fvp/runner.py +11
-4@@ -6,7 +6,7 @@ import shutil import sys from .terminal import terminals - +from .conffile import load def cli_from_config(config, terminal_choice): cli = []@@ -83,14 +83,18 @@ class FVPRunner: self._fvp_process = None self._telnets = [] self._pexpects = [] + self._config = None + + def start(self, fvpconf, extra_args=[], terminal_choice="none", stdout=subprocess.PIPE): + self._logger.debug(f"Loading {fvpconf}") + self._config = load(fvpconf) - def start(self, config, extra_args=[], terminal_choice="none", stdout=subprocess.PIPE): - cli = cli_from_config(config, terminal_choice) + cli = cli_from_config(self._config, terminal_choice) cli += extra_args # Pass through environment variables needed for GUI applications, such # as xterm, to work. - env = config['env'] + env = self._config['env'] for name in ('DISPLAY', 'PATH', 'WAYLAND_DISPLAY', 'XAUTHORITY'): if name in os.environ: env[name] = os.environ[name]@@ -140,6 +144,9 @@ class FVPRunner: def wait(self, timeout): self._fvp_process.wait(timeout) + def getConfig(self): + return self._config + @property def stdout(self): return self._fvp_process.stdoutmeta-arm/lib/oeqa/controllers/fvp.py +7
-6@@ -3,7 +3,7 @@ import pexpect import os from oeqa.core.target.ssh import OESSHTarget -from fvp import conffile, runner +from fvp import runner class OEFVPSSHTarget(OESSHTarget):@@ -19,7 +19,6 @@ class OEFVPSSHTarget(OESSHTarget): basename = pathlib.Path(rootfs) basename = basename.name.replace("".join(basename.suffixes), "") self.fvpconf = image_dir / (basename + ".fvpconf") - self.config = conffile.load(self.fvpconf) self.bootlog = bootlog if not self.fvpconf.exists():@@ -31,7 +30,7 @@ class OEFVPSSHTarget(OESSHTarget): def start(self, **kwargs): self.fvp_log = self._create_logfile("fvp") self.fvp = runner.FVPRunner(self.logger) - self.fvp.start(self.config, stdout=self.fvp_log) + self.fvp.start(self.fvpconf, stdout=self.fvp_log) self.logger.debug(f"Started FVP PID {self.fvp.pid()}") self._after_start()@@ -72,8 +71,9 @@ class OEFVPTarget(OEFVPSSHTarget): def _after_start(self): with open(self.fvp_log.name, 'rb') as logfile: parser = runner.ConsolePortParser(logfile) - self.logger.debug(f"Awaiting console on terminal {self.config['consoles']['default']}") - port = parser.parse_port(self.config['consoles']['default']) + config = self.fvp.getConfig() + self.logger.debug(f"Awaiting console on terminal {config['consoles']['default']}") + port = parser.parse_port(config['consoles']['default']) console = self.fvp.create_pexpect(port) try: console.expect("login\\:", timeout=self.boot_timeout)@@ -105,7 +105,8 @@ class OEFVPSerialTarget(OEFVPSSHTarget): def _after_start(self): with open(self.fvp_log.name, 'rb') as logfile: parser = runner.ConsolePortParser(logfile) - for name, console in self.config["consoles"].items(): + config = self.fvp.getConfig() + for name, console in config["consoles"].items(): logfile = self._create_logfile(name) self.logger.info(f'Creating terminal {name} on {console}') port = parser.parse_port(console)meta-arm/lib/oeqa/selftest/cases/runfvp.py +29
-20@@ -1,5 +1,6 @@ import asyncio import os +import json import pathlib import subprocess import tempfile@@ -88,16 +89,20 @@ class RunnerTests(OESelftestTestCase): from fvp import runner with self.create_mock() as m: fvp = runner.FVPRunner(self.logger) - fvp.start({ - "fvp-bindir": "/usr/bin", - "exe": "FVP_Binary", - "parameters": {'foo': 'bar'}, - "data": ['data1'], - "applications": {'a1': 'file'}, - "terminals": {}, - "args": ['--extra-arg'], - "env": {"FOO": "BAR"} - }) + config = {"fvp-bindir": "/usr/bin", + "exe": "FVP_Binary", + "parameters": {'foo': 'bar'}, + "data": ['data1'], + "applications": {'a1': 'file'}, + "terminals": {}, + "args": ['--extra-arg'], + "env": {"FOO": "BAR"} + } + + with tempfile.NamedTemporaryFile('w') as fvpconf: + json.dump(config, fvpconf) + fvpconf.flush() + fvp.start(fvpconf.name) m.assert_called_once_with(['/usr/bin/FVP_Binary', '--parameter', 'foo=bar',@@ -114,16 +119,20 @@ class RunnerTests(OESelftestTestCase): from fvp import runner with self.create_mock() as m: fvp = runner.FVPRunner(self.logger) - fvp.start({ - "fvp-bindir": "/usr/bin", - "exe": "FVP_Binary", - "parameters": {}, - "data": [], - "applications": {}, - "terminals": {}, - "args": [], - "env": {"FOO": "BAR"} - }) + config = {"fvp-bindir": "/usr/bin", + "exe": "FVP_Binary", + "parameters": {}, + "data": [], + "applications": {}, + "terminals": {}, + "args": [], + "env": {"FOO": "BAR"} + } + + with tempfile.NamedTemporaryFile('w') as fvpconf: + json.dump(config, fvpconf) + fvpconf.flush() + fvp.start(fvpconf.name) m.assert_called_once_with(['/usr/bin/FVP_Binary'], stdin=unittest.mock.ANY,scripts/runfvp +5
-7@@ -14,7 +14,7 @@ logger = logging.getLogger("RunFVP") libdir = pathlib.Path(__file__).parents[1] / "meta-arm" / "lib" sys.path.insert(0, str(libdir)) -from fvp import terminal, runner, conffile +from fvp import terminal, runner def parse_args(arguments): import argparse@@ -49,12 +49,13 @@ def parse_args(arguments): logger.debug(f"FVP arguments: {fvp_args}") return args, fvp_args -def start_fvp(args, config, extra_args): +def start_fvp(args, fvpconf, extra_args): fvp = runner.FVPRunner(logger) try: - fvp.start(config, extra_args, args.terminals) + fvp.start(fvpconf, extra_args, args.terminals) if args.console: + config = fvp.getConfig() expected_terminal = config["consoles"].get("default") if expected_terminal is None: logger.error("--console used but FVP_CONSOLE not set in machine configuration")@@ -87,9 +88,7 @@ def runfvp(cli_args): config_file = args.config else: config_file = conffile.find(args.config) - logger.debug(f"Loading {config_file}") - config = conffile.load(config_file) - start_fvp(args, config, extra_args) + start_fvp(args, config_file, extra_args) if __name__ == "__main__": --2.40.1
Jon Mason
AppliedQuoted 3 lines · Clément Péron
At the moment the config is load and pass to FVPRunner.
Change the ownership to FVPRunner.
Applied, thanks!
[1/3] runfvp: make fvp runner to hold the config
commit: 272359be5dbf8047294e519a512f4dd6348bde5d
[2/3] fvp: runner: execute fvp process in the same working directory as fvpconf
commit: 1fa602ad3ba9356110c085cb9d92286d691294f9
[3/3] runfvp: update filepath in fvpconf to relative path
commit: cb31d9e5981074f083ea287b6cf8fb3460722db8Best regards,
Signature · 1 line
Jon Mason <[email protected]>