* [PATCH] test: pytest: add support for --dump-dtb
@ 2025-01-06 9:19 Ahmad Fatoum
2025-01-06 13:26 ` Sascha Hauer
0 siblings, 1 reply; 2+ messages in thread
From: Ahmad Fatoum @ 2025-01-06 9:19 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
barebox built for some targets like the ARM virt machine doesn't yet
include a device tree and instead depends on previous stage firmware
running in QEMU (or QEMU itself) passing along the device tree that
QEMU assembles internally.
For debugging and to make it easier to use barebox in setups, where
a device tree needs to be provided explicitly, add a --dump-dtb option.
Note that not all machines seem to support this. If this is unsupported,
the QEMU VM will be started normally.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
conftest.py | 3 +++
test/strategy.py | 8 ++++++--
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/conftest.py b/conftest.py
index 5639b7e22ebd..941eddcb72dd 100644
--- a/conftest.py
+++ b/conftest.py
@@ -45,6 +45,9 @@ def pytest_addoption(parser):
parser.addoption('--dry-run', action='store_const', const='qemu_dry_run',
dest='lg_initial_state',
help=('(for debugging) skip tests and just print Qemu command line'))
+ parser.addoption('--dump-dtb', action='store_const', const='qemu_dump_dtb',
+ dest='lg_initial_state',
+ help=('(for debugging) skip tests and just dump the Qemu device tree'))
parser.addoption('--rng', action='count', dest='qemu_rng',
help=('instantiate Virt I/O random number generator'))
parser.addoption('--console', action='count', dest='qemu_console', default=0,
diff --git a/test/strategy.py b/test/strategy.py
index 4063b8ff818b..3e9c73724048 100644
--- a/test/strategy.py
+++ b/test/strategy.py
@@ -23,6 +23,7 @@ class Status(enum.Enum):
barebox = 2
qemu_dry_run = 3
qemu_interactive = 4
+ qemu_dump_dtb = 5
@target_factory.reg_driver
@attr.s(eq=False)
@@ -72,7 +73,10 @@ class BareboxTestStrategy(Strategy):
def force(self, state):
self.transition(Status.off) # pylint: disable=missing-kwoa
- if state == "qemu_dry_run" or state == "qemu_interactive":
+ if state.startswith("qemu_"):
+ if state == "qemu_dump_dtb":
+ self.qemu.machine += f",dumpdtb={self.target.name}.dtb"
+
cmd = self.qemu.get_qemu_base_args()
cmd.append("-serial")
@@ -88,7 +92,7 @@ class BareboxTestStrategy(Strategy):
pytest.exit('Interactive session terminated')
else:
- pytest.exit('Can only force to: qemu_dry_run, qemu_interactive')
+ pytest.exit('Can only force to: qemu_dry_run, qemu_interactive, qemu_dump_dtb')
def append_qemu_args(self, *args):
if self.qemu is None:
--
2.39.5
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] test: pytest: add support for --dump-dtb
2025-01-06 9:19 [PATCH] test: pytest: add support for --dump-dtb Ahmad Fatoum
@ 2025-01-06 13:26 ` Sascha Hauer
0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2025-01-06 13:26 UTC (permalink / raw)
To: barebox, Ahmad Fatoum
On Mon, 06 Jan 2025 10:19:27 +0100, Ahmad Fatoum wrote:
> barebox built for some targets like the ARM virt machine doesn't yet
> include a device tree and instead depends on previous stage firmware
> running in QEMU (or QEMU itself) passing along the device tree that
> QEMU assembles internally.
>
> For debugging and to make it easier to use barebox in setups, where
> a device tree needs to be provided explicitly, add a --dump-dtb option.
>
> [...]
Applied, thanks!
[1/1] test: pytest: add support for --dump-dtb
https://git.pengutronix.de/cgit/barebox/commit/?id=73e219e6e1b0 (link may not be stable)
Best regards,
--
Sascha Hauer <s.hauer@pengutronix.de>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-01-06 13:26 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-01-06 9:19 [PATCH] test: pytest: add support for --dump-dtb Ahmad Fatoum
2025-01-06 13:26 ` Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox