diff options
Diffstat (limited to 'meta/lib/oeqa/selftest/cases/barebox.py')
-rw-r--r-- | meta/lib/oeqa/selftest/cases/barebox.py | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/meta/lib/oeqa/selftest/cases/barebox.py b/meta/lib/oeqa/selftest/cases/barebox.py new file mode 100644 index 0000000000..3f8f232432 --- /dev/null +++ b/meta/lib/oeqa/selftest/cases/barebox.py | |||
@@ -0,0 +1,44 @@ | |||
1 | # Qemu-based barebox 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 | barebox_boot_patterns = { | ||
14 | 'search_reached_prompt': r"stop autoboot", | ||
15 | 'search_login_succeeded': r"barebox@[^:]+:[^ ]+ ", | ||
16 | 'search_cmd_finished': r"barebox@[a-zA-Z0-9\-\s]+:/" | ||
17 | } | ||
18 | |||
19 | |||
20 | class BareboxTest(OESelftestTestCase): | ||
21 | |||
22 | @skipIfNotArch(['arm', 'aarch64']) | ||
23 | @OETestTag("runqemu") | ||
24 | def test_boot_barebox(self): | ||
25 | """ | ||
26 | Tests building barebox and booting it with QEMU | ||
27 | """ | ||
28 | |||
29 | self.write_config(""" | ||
30 | QB_DEFAULT_KERNEL = "barebox-dt-2nd.img" | ||
31 | PREFERRED_PROVIDER_virtual/bootloader = "barebox" | ||
32 | QEMU_USE_KVM = "False" | ||
33 | """) | ||
34 | |||
35 | bitbake("virtual/bootloader core-image-minimal") | ||
36 | |||
37 | with runqemu('core-image-minimal', ssh=False, runqemuparams='nographic', | ||
38 | boot_patterns=barebox_boot_patterns) as qemu: | ||
39 | |||
40 | # test if barebox console works | ||
41 | cmd = "version" | ||
42 | status, output = qemu.run_serial(cmd) | ||
43 | self.assertEqual(status, 1, msg=output) | ||
44 | self.assertTrue("barebox" in output, msg=output) | ||