From: "Enrico Jörns" <ejo@pengutronix.de>
To: openembedded-core@lists.openembedded.org
Cc: yocto@pengutronix.de
Subject: [PATCH v4 5/7] oeqa: support passing custom boot patterns to runqemu
Date: Tue, 10 Sep 2024 09:20:04 +0200 [thread overview]
Message-ID: <20240910072006.3938401-6-ejo@pengutronix.de> (raw)
In-Reply-To: <20240910072006.3938401-1-ejo@pengutronix.de>
From: Enrico Jorns <ejo@pengutronix.de>
This allows defining non-standard patterns from QEMU tests just as they
are already supported by the testimage.bbclass.
Will allow testing non-Linux shells in QEMU, too (e.g. a U-Boot shell or
another bootloader shell).
Signed-off-by: Enrico Jorns <ejo@pengutronix.de>
---
meta/lib/oeqa/targetcontrol.py | 5 +++--
meta/lib/oeqa/utils/commands.py | 5 +++--
meta/lib/oeqa/utils/qemurunner.py | 2 +-
3 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/meta/lib/oeqa/targetcontrol.py b/meta/lib/oeqa/targetcontrol.py
index 6e8b781973..cdf382ee21 100644
--- a/meta/lib/oeqa/targetcontrol.py
+++ b/meta/lib/oeqa/targetcontrol.py
@@ -88,7 +88,7 @@ class QemuTarget(BaseTarget):
supported_image_fstypes = ['ext3', 'ext4', 'cpio.gz', 'wic']
- def __init__(self, d, logger, image_fstype=None):
+ def __init__(self, d, logger, image_fstype=None, boot_patterns=None):
import oe.types
@@ -141,7 +141,8 @@ class QemuTarget(BaseTarget):
dump_dir = dump_dir,
logger = logger,
tmpfsdir = d.getVar("RUNQEMU_TMPFS_DIR"),
- serial_ports = len(d.getVar("SERIAL_CONSOLES").split()))
+ serial_ports = len(d.getVar("SERIAL_CONSOLES").split()),
+ boot_patterns = boot_patterns)
self.monitor_dumper = MonitorDumper(dump_monitor_cmds, dump_dir, self.runner)
if (self.monitor_dumper):
diff --git a/meta/lib/oeqa/utils/commands.py b/meta/lib/oeqa/utils/commands.py
index bf2f49d0c0..ca22d69f29 100644
--- a/meta/lib/oeqa/utils/commands.py
+++ b/meta/lib/oeqa/utils/commands.py
@@ -312,7 +312,7 @@ def create_temp_layer(templayerdir, templayername, priority=999, recipepathspec=
f.write('LAYERSERIES_COMPAT_%s = "%s"\n' % (templayername, corenames))
@contextlib.contextmanager
-def runqemu(pn, ssh=True, runqemuparams='', image_fstype=None, launch_cmd=None, qemuparams=None, overrides={}, discard_writes=True):
+def runqemu(pn, ssh=True, runqemuparams='', image_fstype=None, launch_cmd=None, qemuparams=None, overrides={}, boot_patterns = {}, discard_writes=True):
"""
Starts a context manager for a 'oeqa.targetcontrol.QemuTarget' resource.
The underlying Qemu will be booted into a shell when the generator yields
@@ -330,6 +330,7 @@ def runqemu(pn, ssh=True, runqemuparams='', image_fstype=None, launch_cmd=None,
image_fstype (str): IMAGE_FSTYPE to use
launch_cmd (str): directly run this command and bypass automatic runqemu parameter generation
overrides (dict): dict of "'<bitbake-variable>': value" pairs that allows overriding bitbake variables
+ boot_patterns (dict): dict of "'<pattern-name>': value" pairs to override default boot patterns, e.g. when not booting Linux
discard_writes (boolean): enables qemu -snapshot feature to prevent modifying original image
"""
@@ -361,7 +362,7 @@ def runqemu(pn, ssh=True, runqemuparams='', image_fstype=None, launch_cmd=None,
logdir = recipedata.getVar("TEST_LOG_DIR")
- qemu = oeqa.targetcontrol.QemuTarget(recipedata, targetlogger, image_fstype)
+ qemu = oeqa.targetcontrol.QemuTarget(recipedata, targetlogger, image_fstype, boot_patterns=boot_patterns)
finally:
# We need to shut down tinfoil early here in case we actually want
# to run tinfoil-using utilities with the running QEMU instance.
diff --git a/meta/lib/oeqa/utils/qemurunner.py b/meta/lib/oeqa/utils/qemurunner.py
index 63fc6f6b53..5c3a8e5999 100644
--- a/meta/lib/oeqa/utils/qemurunner.py
+++ b/meta/lib/oeqa/utils/qemurunner.py
@@ -103,7 +103,7 @@ class QemuRunner:
# Only override patterns that were set e.g. login user TESTIMAGE_BOOT_PATTERNS[send_login_user] = "webserver\n"
for pattern in accepted_patterns:
- if not self.boot_patterns[pattern]:
+ if pattern not in self.boot_patterns or not self.boot_patterns[pattern]:
self.boot_patterns[pattern] = default_boot_patterns[pattern]
def create_socket(self):
--
2.39.2
next prev parent reply other threads:[~2024-09-10 7:21 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-10 7:19 [PATCH v4 0/7] Add barebox bootloader support (and testing) Enrico Jörns
2024-09-10 7:20 ` [PATCH v4 1/7] barebox: add initial support Enrico Jörns
2024-09-10 8:33 ` [OE-core] " Alexander Kanavin
2024-09-10 8:41 ` Enrico Jörns
2024-09-10 7:20 ` [PATCH v4 2/7] barebox-tools: add initial barebox tools support Enrico Jörns
2024-09-10 8:37 ` [OE-core] " Alexander Kanavin
2024-09-10 8:45 ` Enrico Jörns
2024-09-10 8:49 ` Alexander Kanavin
2024-09-10 9:02 ` Enrico Jörns
2024-09-10 9:22 ` Alexander Kanavin
2024-09-10 9:32 ` Enrico Jörns
2024-09-10 7:20 ` [PATCH v4 3/7] barebox: set default BAREBOX_CONFIG for qemu machines Enrico Jörns
2024-09-10 7:20 ` [PATCH v4 4/7] oeqa/utils/qemurunner: support ignoring vt100 escape sequences Enrico Jörns
2024-09-10 7:20 ` Enrico Jörns [this message]
2024-09-10 7:20 ` [PATCH v4 6/7] oeqa/selftest/cases: add basic u-boot test Enrico Jörns
2024-09-10 7:20 ` [PATCH v4 7/7] oeqa/selftest/cases: add basic barebox tests Enrico Jörns
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=20240910072006.3938401-6-ejo@pengutronix.de \
--to=ejo@pengutronix.de \
--cc=openembedded-core@lists.openembedded.org \
--cc=yocto@pengutronix.de \
/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