From: Ahmad Fatoum <a.fatoum@barebox.org>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@barebox.org>
Subject: [PATCH] test: add --bootarg option when running under QEMU
Date: Wed, 6 Aug 2025 15:57:51 +0200 [thread overview]
Message-ID: <20250806135751.2865266-1-a.fatoum@barebox.org> (raw)
On platforms, where the device tree is passed by QEMU, /chosen/bootargs
is an easy way to pass early settings to barebox.
Expose this over a new --bootarg parameter.
Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
conftest.py | 5 +++++
test/strategy.py | 7 +++++++
2 files changed, 12 insertions(+)
diff --git a/conftest.py b/conftest.py
index 782ebc0536fd..45e8835924b3 100644
--- a/conftest.py
+++ b/conftest.py
@@ -68,6 +68,8 @@ def pytest_addoption(parser):
help=('Pass barebox environment files to barebox. Can be specified more than once'))
parser.addoption('--qemu', dest='qemu_arg', nargs=argparse.REMAINDER, default=[],
help=('Pass all remaining options to QEMU as is'))
+ parser.addoption('--bootarg', action='append', dest='bootarg', default=[],
+ help=('Pass boot arguments to barebox for debugging purposes'))
@pytest.fixture(scope="session")
def strategy(request, target, pytestconfig):
@@ -152,6 +154,9 @@ def strategy(request, target, pytestconfig):
else:
pytest.exit("--env unsupported for target\n", 1)
+ if len(pytestconfig.option.bootarg) > 0:
+ strategy.append_qemu_bootargs(pytestconfig.option.bootarg)
+
for arg in pytestconfig.option.qemu_arg:
strategy.append_qemu_args(arg)
diff --git a/test/strategy.py b/test/strategy.py
index b5a9d8b814a8..11406b97f5f1 100644
--- a/test/strategy.py
+++ b/test/strategy.py
@@ -100,6 +100,13 @@ class BareboxTestStrategy(Strategy):
for arg in args:
self.console.extra_args += " " + arg
+ def append_qemu_bootargs(self, args):
+ if self.qemu is None:
+ pytest.exit('Qemu option supplied for non-Qemu target')
+ if self.console.boot_args is None:
+ self.console.boot_args = ""
+ self.console.boot_args += " ".join(args)
+
def quote_cmd(cmd):
quoted = map(lambda s : s if s.find(" ") == -1 else "'" + s + "'", cmd)
return " ".join(quoted)
--
2.39.5
next reply other threads:[~2025-08-06 14:04 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-06 13:57 Ahmad Fatoum [this message]
2025-08-07 5:13 ` Sascha Hauer
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=20250806135751.2865266-1-a.fatoum@barebox.org \
--to=a.fatoum@barebox.org \
--cc=barebox@lists.infradead.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox