mirror of
https://git.yoctoproject.org/meta-arm
synced 2026-06-08 03:21:35 +00:00
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. Signed-off-by: Clément Péron <peron.clem@gmail.com> Signed-off-by: Jon Mason <jon.mason@arm.com>
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user