uboot.py 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. # Qemu-based u-boot bootloader integration testing
  2. #
  3. # Copyright OpenEmbedded Contributors
  4. #
  5. # SPDX-License-Identifier: MIT
  6. #
  7. from oeqa.selftest.case import OESelftestTestCase
  8. from oeqa.utils.commands import bitbake, runqemu
  9. from oeqa.core.decorator.data import skipIfNotArch
  10. from oeqa.core.decorator import OETestTag
  11. uboot_boot_patterns = {
  12. 'search_reached_prompt': "stop autoboot",
  13. 'search_login_succeeded': "=>",
  14. 'search_cmd_finished': "=>"
  15. }
  16. class UBootTest(OESelftestTestCase):
  17. @skipIfNotArch(['arm', 'aarch64'])
  18. @OETestTag("runqemu")
  19. def test_boot_uboot(self):
  20. """
  21. Tests building u-boot and booting it with QEMU
  22. """
  23. self.write_config("""
  24. QB_DEFAULT_BIOS = "u-boot.bin"
  25. PREFERRED_PROVIDER_virtual/bootloader = "u-boot"
  26. QEMU_USE_KVM = "False"
  27. """)
  28. bitbake("virtual/bootloader core-image-minimal")
  29. with runqemu('core-image-minimal', ssh=False, runqemuparams='nographic',
  30. boot_patterns=uboot_boot_patterns) as qemu:
  31. # test if u-boot console works
  32. cmd = "version"
  33. status, output = qemu.run_serial(cmd)
  34. self.assertEqual(status, 1, msg=output)
  35. self.assertTrue("U-Boot" in output, msg=output)