[PATCH 1/4] test: py: strategy: add OS shell state
Ahmad Fatoum
a.fatoum at pengutronix.de
Thu Dec 18 06:48:44 PST 2025
So far, we only boot barebox from within barebox. Let's allow YAML files
to optional specify a ShellDriver that we will use to test booting of
actual kernels and not only barebox look-alikes.
Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
conftest.py | 6 ++++++
test/strategy.py | 11 +++++++++++
2 files changed, 17 insertions(+)
diff --git a/conftest.py b/conftest.py
index 55935f7602f7..ef6ca221a5db 100644
--- a/conftest.py
+++ b/conftest.py
@@ -25,6 +25,12 @@ def barebox(request, strategy, target):
return target.get_driver('BareboxDriver')
+ at pytest.fixture(scope='function')
+def shell(strategy, target):
+ strategy.transition('shell')
+ return target.get_driver('ShellDriver')
+
+
@pytest.fixture(scope="session")
def barebox_config(request, strategy, target):
transition_to_barebox(request, strategy)
diff --git a/test/strategy.py b/test/strategy.py
index fcfa2ed48125..0f1b76147443 100644
--- a/test/strategy.py
+++ b/test/strategy.py
@@ -25,6 +25,7 @@ class Status(enum.Enum):
qemu_dry_run = 3
qemu_interactive = 4
qemu_dump_dtb = 5
+ shell = 6
@target_factory.reg_driver
@@ -35,6 +36,7 @@ class BareboxTestStrategy(Strategy):
"power": "PowerProtocol",
"console": "ConsoleProtocol",
"barebox": "BareboxDriver",
+ "shell": {"ShellDriver", None},
}
status = attr.ib(default=Status.unknown)
@@ -55,6 +57,9 @@ class BareboxTestStrategy(Strategy):
step.skip("nothing to do")
return # nothing to do
elif status == Status.off:
+ self.target.deactivate(self.barebox)
+ if self.shell:
+ self.target.deactivate(self.shell)
self.target.deactivate(self.console)
self.target.activate(self.power)
self.power.off()
@@ -65,6 +70,12 @@ class BareboxTestStrategy(Strategy):
self.power.cycle()
# interrupt barebox
self.target.activate(self.barebox)
+ elif status == Status.shell:
+ # transition to barebox
+ self.transition(Status.barebox) # pylint: disable=missing-kwoa
+ self.barebox.boot("")
+ self.barebox.await_boot()
+ self.target.activate(self.shell)
else:
raise StrategyError(
"no transition found from {} to {}".
--
2.47.3
More information about the barebox
mailing list