From: "Clément Péron" <peron.clem@gmail.com>
To: meta-arm@lists.yoctoproject.org
Cc: "Peter Hoyes" <Peter.Hoyes@arm.com>,
"Clément Péron" <peron.clem@gmail.com>
Subject: [RFC PATCH v2 2/3] fvp: runner: execute fvp process in the same working directory as fvpconf
Date: Wed, 17 May 2023 12:09:12 +0200 [thread overview]
Message-ID: <20230517100913.96055-2-peron.clem@gmail.com> (raw)
In-Reply-To: <20230517100913.96055-1-peron.clem@gmail.com>
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>
---
meta-arm/lib/fvp/runner.py | 7 ++++++-
meta-arm/lib/oeqa/selftest/cases/runfvp.py | 8 ++++++--
2 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/meta-arm/lib/fvp/runner.py b/meta-arm/lib/fvp/runner.py
index 4f5f88ca..7ca3673d 100644
--- a/meta-arm/lib/fvp/runner.py
+++ b/meta-arm/lib/fvp/runner.py
@@ -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:
diff --git a/meta-arm/lib/oeqa/selftest/cases/runfvp.py b/meta-arm/lib/oeqa/selftest/cases/runfvp.py
index 2d2cdc80..d60aa3c4 100644
--- a/meta-arm/lib/oeqa/selftest/cases/runfvp.py
+++ b/meta-arm/lib/oeqa/selftest/cases/runfvp.py
@@ -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)
--
2.40.1
next prev parent reply other threads:[~2023-05-17 10:09 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-17 10:09 [RFC PATCH v2 1/3] runfvp: make fvp runner to hold the config Clément Péron
2023-05-17 10:09 ` Clément Péron [this message]
2023-05-17 10:09 ` [RFC PATCH v2 3/3] runfvp: update filepath in fvpconf to relative path Clément Péron
2023-05-23 11:40 ` [RFC PATCH v2 1/3] runfvp: make fvp runner to hold the config Clément Péron
2023-05-23 16:06 ` Peter Hoyes
2023-05-23 23:36 ` Jon Mason
2023-05-24 8:47 ` Clément Péron
2023-05-25 0:51 ` Jon Mason
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230517100913.96055-2-peron.clem@gmail.com \
--to=peron.clem@gmail.com \
--cc=Peter.Hoyes@arm.com \
--cc=meta-arm@lists.yoctoproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.