[prev in list] [next in list] [prev in thread] [next in thread]
List: openembedded-core
Subject: [OE-core] [PATCH v2 8/9] oeqa/selftest/cases: add barebox tests
From: Enrico Jörns <ejo () pengutronix ! de>
Date: 2023-03-31 10:40:24
Message-ID: 20230331104025.1478393-9-ejo () pengutronix ! de
[Download RAW message or body]
Content-Transfer-Encoding: 8bit
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
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#179422): https://lists.openembedded.org/g/openembedded-core/message/179422
Mute This Topic: https://lists.openembedded.org/mt/97970645/4454766
Group Owner: openembedded-core+owner@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [openembedded-core@marc.info]
-=-=-=-=-=-=-=-=-=-=-=-
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic