From: Ahmad Fatoum <a.fatoum@barebox.org>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@barebox.org>
Subject: [PATCH 2/5] test: py: strategy: add helpers for booting kernel and bootm
Date: Fri, 9 Jan 2026 17:57:28 +0100 [thread overview]
Message-ID: <20260109170007.805177-3-a.fatoum@barebox.org> (raw)
In-Reply-To: <20260109170007.805177-1-a.fatoum@barebox.org>
The current boot helper activates the barebox strategy with the
assumption that barebox is booting itself, which is indeed the
case in the FIT boot test.
In preparation for adding customized boot tests of actual kernels
(and not only barebox masquerading as one), rename it to boot_barebox
and add boot_kernel, which behaves similarly, but activates the shell
driver.
Additionally, add support for using bootm instead of boot, which is more
convenient if we have no script, no ESP and no bootloader spec file.
Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
test/py/test_fit.py | 2 +-
test/strategy.py | 36 +++++++++++++++++++++++++++++++++---
2 files changed, 34 insertions(+), 4 deletions(-)
diff --git a/test/py/test_fit.py b/test/py/test_fit.py
index 97fdac0c79d9..e0999a01b0cb 100644
--- a/test/py/test_fit.py
+++ b/test/py/test_fit.py
@@ -78,7 +78,7 @@ def test_fit(barebox, strategy, testfs, fit_testdata):
boottarget = generate_bootscript(barebox, fit_name('gzipped'))
- with strategy.boot(boottarget):
+ with strategy.boot_barebox(boottarget) as barebox:
assert of_get_property(barebox, "/chosen/barebox-version") == f'"{ver}"', \
"/chosen/barebox-version suggests we did not chainload"
diff --git a/test/strategy.py b/test/strategy.py
index 0ca08b0cdd15..c04d38c180a7 100644
--- a/test/strategy.py
+++ b/test/strategy.py
@@ -86,20 +86,50 @@ class BareboxTestStrategy(Strategy):
)
self.status = status
+ def barebox_bootm(self, image=None):
+ self.barebox._run(f"global.loglevel={self.barebox.saved_log_level}",
+ adjust_log_level=False)
+ if image:
+ self.console.sendline(f"bootm -v {image}")
+ else:
+ self.console.sendline("bootm -v")
+
@contextmanager
- def boot(self, boottarget=None):
+ def boot_barebox(self, boottarget=None, bootm=False):
self.transition(Status.barebox)
try:
- self.barebox.boot(boottarget)
+ if bootm:
+ self.barebox_bootm(boottarget)
+ else:
+ self.barebox.boot(boottarget)
+
self.target.deactivate(self.barebox)
self.target.activate(self.barebox)
- yield
+ yield self.barebox
finally:
self.target.deactivate(self.barebox)
self.power.cycle()
self.target.activate(self.barebox)
+ @contextmanager
+ def boot_kernel(self, boottarget=None, bootm=False):
+ self.transition(Status.barebox)
+
+ try:
+ if bootm:
+ self.barebox_bootm(boottarget)
+ else:
+ self.barebox.boot(boottarget)
+
+ self.barebox.await_boot()
+ self.target.activate(self.shell)
+ yield self.shell
+ finally:
+ self.target.deactivate(self.shell)
+ self.power.cycle()
+ self.target.activate(self.barebox)
+
def force(self, state):
self.transition(Status.off) # pylint: disable=missing-kwoa
--
2.47.3
next prev parent reply other threads:[~2026-01-09 17:01 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-09 16:57 [PATCH 0/5] test: arm: boot test Debian image in CI Ahmad Fatoum
2026-01-09 16:57 ` [PATCH 1/5] test: arm: multi_v8_efiloader_defconfig: use qcow2 image Ahmad Fatoum
2026-01-09 16:57 ` Ahmad Fatoum [this message]
2026-01-09 16:57 ` [PATCH 3/5] test: py: efiloader: prepare get_dmesg for more general usage Ahmad Fatoum
2026-01-09 16:57 ` [PATCH 4/5] test: py: add more kernel boot tests Ahmad Fatoum
2026-01-09 16:57 ` [PATCH 5/5] ci: add Debian ARM64 EFI loader boot test 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=20260109170007.805177-3-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