public inbox for openembedded-core@lists.openembedded.org
 help / color / mirror / Atom feed
From: Enrico Jorns <ejo@pengutronix.de>
To: openembedded-core@lists.openembedded.org
Cc: yocto@pengutronix.de, ejo@pengutronix.de,
	Richard Purdie <richard.purdie@linuxfoundation.org>,
	Alexander Kanavin <alex.kanavin@gmail.com>,
	alexandre.belloni@bootlin.com
Subject: [PATCH v2 8/9] oeqa/selftest/cases: add barebox tests
Date: Fri, 31 Mar 2023 12:40:24 +0200	[thread overview]
Message-ID: <20230331104025.1478393-9-ejo@pengutronix.de> (raw)
In-Reply-To: <20230331104025.1478393-1-ejo@pengutronix.de>

Signed-off-by: Enrico Jorns <ejo@pengutronix.de>
---
 meta/lib/oeqa/selftest/cases/barebox.py | 72 +++++++++++++++++++++++++
 1 file changed, 72 insertions(+)
 create mode 100644 meta/lib/oeqa/selftest/cases/barebox.py

diff --git a/meta/lib/oeqa/selftest/cases/barebox.py b/meta/lib/oeqa/selftest/cases/barebox.py
new file mode 100644
index 0000000000..497cd6e8dd
--- /dev/null
+++ b/meta/lib/oeqa/selftest/cases/barebox.py
@@ -0,0 +1,72 @@
+# Qemu-based barebox bootloader integration testing
+#
+# Copyright OpenEmbedded Contributors
+#
+# SPDX-License-Identifier: MIT
+#
+
+from oeqa.selftest.case import OESelftestTestCase
+from oeqa.utils.commands import bitbake, runqemu
+from oeqa.core.decorator.data import skipIfNotArch
+from oeqa.core.decorator import OETestTag
+
+barebox_boot_patterns = {
+        'search_reached_prompt': r"stop autoboot",
+        'search_login_succeeded': r"barebox@[^:]+:[^ ]+ ",
+        'search_cmd_finished': r"barebox@[a-zA-Z0-9\-\s]+:/"
+        }
+
+
+class BareboxTest(OESelftestTestCase):
+
+    @skipIfNotArch(['arm', 'aarch64'])
+    @OETestTag("runqemu")
+    def test_boot_barebox(self):
+        """
+        Tests building barebox and booting it with QEMU
+        """
+
+        self.write_config("""
+QB_DEFAULT_KERNEL = "barebox-dt-2nd.img"
+PREFERRED_PROVIDER_virtual/bootloader = "barebox"
+""")
+
+        bitbake("virtual/bootloader core-image-minimal")
+
+        with runqemu('core-image-minimal', ssh=False, runqemuparams='nographic',
+                     boot_patterns=barebox_boot_patterns) as qemu:
+
+            # test if barebox console works
+            cmd = "version"
+            status, output = qemu.run_serial(cmd)
+            self.assertEqual(status, 1, msg=output)
+            self.assertTrue("barebox" in output, msg=output)
+
+    @skipIfNotArch(['x86_64'])
+    @OETestTag("runqemu")
+    def test_boot_barebox_efi(self):
+        """
+        Tests building barebox for UEFI and booting it as EFI payload
+        with QEMU + OVMF
+        """
+        image = "core-image-minimal"
+
+        self.write_config("""
+IMAGE_INSTALL:append = " barebox"
+MACHINE_FEATURES:append = " pcbios efi"
+EXTRA_IMAGEDEPENDS += "ovmf"
+EFI_PROVIDER = "barebox"
+IMAGE_FSTYPES += "wic"
+WKS_FILE = "efi-bootdisk.wks.in"
+""")
+
+        bitbake(image)
+
+        with runqemu(image, ssh=False, runqemuparams='nographic ovmf',
+                     boot_patterns=barebox_boot_patterns, image_fstype='wic') as qemu:
+
+            # test if barebox console works
+            cmd = "version"
+            status, output = qemu.run_serial(cmd)
+            self.assertEqual(status, 1, msg=output)
+            self.assertTrue("barebox" in output, msg=output)
-- 
2.39.2



  parent reply	other threads:[~2023-03-31 10:40 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-31 10:40 [PATCH v2 0/9] Add barebox bootloader support (and testing) Enrico Jorns
2023-03-31 10:40 ` [PATCH v2 1/9] barebox: add initial support Enrico Jorns
2023-03-31 10:40 ` [PATCH v2 2/9] barebox-tools: add initial barebox tools support Enrico Jorns
2023-03-31 10:40 ` [PATCH v2 3/9] barebox: set default BAREBOX_CONFIG for qemu machines Enrico Jorns
2023-03-31 14:04   ` Alexander Kanavin
2023-04-03 11:42     ` Enrico Jörns
2023-04-11 14:16       ` Alexander Kanavin
2023-04-24 15:15         ` Enrico Jörns
2023-03-31 10:40 ` [PATCH v2 4/9] oeqa/utils/qemurunner: support ignoring vt100 escape sequences Enrico Jorns
2023-03-31 14:05   ` Alexander Kanavin
2023-04-03 13:02     ` Enrico Jörns
2023-04-11 14:17       ` Alexander Kanavin
2023-03-31 10:40 ` [PATCH v2 5/9] oeqa/utils/qemurunner: simplify output parsing and make crlf-compatible Enrico Jorns
2023-03-31 10:40 ` [PATCH v2 6/9] oeqa/utils/commands: document runqemu context manager Enrico Jorns
2023-03-31 10:40 ` [PATCH v2 7/9] oeqa: support passing custom boot patterns to runqemu Enrico Jorns
2023-03-31 10:40 ` Enrico Jorns [this message]
2023-03-31 10:40 ` [PATCH v2 9/9] oeqa/selftest/cases: add basic u-boot test Enrico Jorns
2023-03-31 14:03 ` [PATCH v2 0/9] Add barebox bootloader support (and testing) Alexander Kanavin
2023-04-03 15:49 ` Richard Purdie
2023-04-03 21:20   ` Enrico Jörns
2023-04-04  2:33     ` [OE-core] " Khem Raj
2023-04-04 11:13       ` Enrico Jörns
2023-04-04 16:11         ` Khem Raj

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=20230331104025.1478393-9-ejo@pengutronix.de \
    --to=ejo@pengutronix.de \
    --cc=alex.kanavin@gmail.com \
    --cc=alexandre.belloni@bootlin.com \
    --cc=openembedded-core@lists.openembedded.org \
    --cc=richard.purdie@linuxfoundation.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