mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH 1/4] test: py: strategy: add OS shell state
Date: Thu, 18 Dec 2025 15:48:44 +0100	[thread overview]
Message-ID: <20251218144950.3068179-2-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20251218144950.3068179-1-a.fatoum@pengutronix.de>

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@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')
 
 
+@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




  reply	other threads:[~2025-12-18 14:50 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-18 14:48 [PATCH 0/4] efi: add EFI loader integration test Ahmad Fatoum
2025-12-18 14:48 ` Ahmad Fatoum [this message]
2025-12-18 14:48 ` [PATCH 2/4] test: py: add simple SMBIOS tests Ahmad Fatoum
2025-12-18 14:48 ` [PATCH 3/4] test: py: add simple EFI loader integration test Ahmad Fatoum
2025-12-18 14:48 ` [PATCH 4/4] test: arm: add Labgrid env YAML for multi_v8_efiloader_defconfig Ahmad Fatoum

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=20251218144950.3068179-2-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --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