* [PATCH] test: add --bootarg option when running under QEMU
@ 2025-08-06 13:57 Ahmad Fatoum
2025-08-07 5:13 ` Sascha Hauer
0 siblings, 1 reply; 2+ messages in thread
From: Ahmad Fatoum @ 2025-08-06 13:57 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-08-07 5:13 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-08-06 13:57 [PATCH] test: add --bootarg option when running under QEMU Ahmad Fatoum
2025-08-07 5:13 ` Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox