Browse Source

oeqa/selftest/cases: add basic barebox tests

This adds basic tests for qemuarm and qemuarm64.

So far, barebox fails to run properly under KVM for the same reasons
u-boot fails to run.

A patch series to address the problem was submitted by Ahmad Fatoum
after debugging the oe-selftest failures for this series:

https://lore.kernel.org/barebox/20241009060511.4121157-1-a.fatoum@pengutronix.de/

For now, simply disable KVM for these tests.

(From OE-Core rev: 9284ceb4d32a51c77792d9009bba400d0b17d731)

Signed-off-by: Enrico Jorns <ejo@pengutronix.de>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Enrico Jorns 7 months ago
parent
commit
f8d8f08f50
1 changed files with 44 additions and 0 deletions
  1. 44 0
      meta/lib/oeqa/selftest/cases/barebox.py

+ 44 - 0
meta/lib/oeqa/selftest/cases/barebox.py

@@ -0,0 +1,44 @@
+# 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"
+QEMU_USE_KVM = "False"
+""")
+
+        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)