diff options
| -rw-r--r-- | meta/lib/oeqa/selftest/cases/uboot.py | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/meta/lib/oeqa/selftest/cases/uboot.py b/meta/lib/oeqa/selftest/cases/uboot.py new file mode 100644 index 0000000000..96da4efb06 --- /dev/null +++ b/meta/lib/oeqa/selftest/cases/uboot.py | |||
| @@ -0,0 +1,43 @@ | |||
| 1 | # Qemu-based u-boot bootloader integration testing | ||
| 2 | # | ||
| 3 | # Copyright OpenEmbedded Contributors | ||
| 4 | # | ||
| 5 | # SPDX-License-Identifier: MIT | ||
| 6 | # | ||
| 7 | |||
| 8 | from oeqa.selftest.case import OESelftestTestCase | ||
| 9 | from oeqa.utils.commands import bitbake, runqemu | ||
| 10 | from oeqa.core.decorator.data import skipIfNotArch | ||
| 11 | from oeqa.core.decorator import OETestTag | ||
| 12 | |||
| 13 | uboot_boot_patterns = { | ||
| 14 | 'search_reached_prompt': "stop autoboot", | ||
| 15 | 'search_login_succeeded': "=>", | ||
| 16 | 'search_cmd_finished': "=>" | ||
| 17 | } | ||
| 18 | |||
| 19 | |||
| 20 | class UBootTest(OESelftestTestCase): | ||
| 21 | |||
| 22 | @skipIfNotArch(['arm', 'aarch64']) | ||
| 23 | @OETestTag("runqemu") | ||
| 24 | def test_boot_uboot(self): | ||
| 25 | """ | ||
| 26 | Tests building u-boot and booting it with QEMU | ||
| 27 | """ | ||
| 28 | |||
| 29 | self.write_config(""" | ||
| 30 | QB_DEFAULT_BIOS = "u-boot.bin" | ||
| 31 | PREFERRED_PROVIDER_virtual/bootloader = "u-boot" | ||
| 32 | QEMU_USE_KVM = "False" | ||
| 33 | """) | ||
| 34 | bitbake("virtual/bootloader core-image-minimal") | ||
| 35 | |||
| 36 | with runqemu('core-image-minimal', ssh=False, runqemuparams='nographic', | ||
| 37 | boot_patterns=uboot_boot_patterns) as qemu: | ||
| 38 | |||
| 39 | # test if u-boot console works | ||
| 40 | cmd = "version" | ||
| 41 | status, output = qemu.run_serial(cmd) | ||
| 42 | self.assertEqual(status, 1, msg=output) | ||
| 43 | self.assertTrue("U-Boot" in output, msg=output) | ||
