master
py 92 lines 3.9 KB
Raw
1 #!/usr/bin/env python3
2 #
3 # Functional test that boots a Linux kernel and checks the console
4 #
5 # SPDX-License-Identifier: GPL-2.0-or-later
6
7 from qemu_test import LinuxKernelTest, Asset, exec_command_and_wait_for_pattern
8 from qemu_test import interrupt_interactive_console_until_pattern, skipSlowTest
9
10
11 class EmcraftSf2Machine(LinuxKernelTest):
12
13 ASSET_IMAGE = Asset(
14 ('https://github.com/hskinnemoen/openbmc/releases/download/'
15 '20200711-gsj-qemu-0/obmc-phosphor-image-gsj.static.mtd.gz'),
16 'eccd4e375cde53034c84aece5c511932cacf838d9fd3f63da368a511757da72b')
17
18 ASSET_INITRD = Asset(
19 ('https://github.com/hskinnemoen/openbmc/releases/download/'
20 '20200711-gsj-qemu-0/obmc-phosphor-initramfs-gsj.cpio.xz'),
21 '37b05009fc54db1434beac12bd7ff99a2e751a2f032ee18d9042f991dd0cdeaa')
22
23 ASSET_KERNEL = Asset(
24 ('https://github.com/hskinnemoen/openbmc/releases/download/'
25 '20200711-gsj-qemu-0/uImage-gsj.bin'),
26 'ce6d6b37bff46c74fc7b1e90da10a431cc37a62cdb35ec199fa73473d0790110')
27
28 ASSET_DTB = Asset(
29 ('https://github.com/hskinnemoen/openbmc/releases/download/'
30 '20200711-gsj-qemu-0/nuvoton-npcm730-gsj.dtb'),
31 '3249b2da787d4b9ad4e61f315b160abfceb87b5e1895a7ce898ce7f40c8d4045')
32
33 @skipSlowTest()
34 def test_arm_quanta_gsj(self):
35 self.set_machine('quanta-gsj')
36 image_path = self.uncompress(self.ASSET_IMAGE, format='gz')
37
38 self.vm.set_console()
39 drive_args = 'file=' + image_path + ',if=mtd,bus=0,unit=0'
40 self.vm.add_args('-drive', drive_args)
41 self.vm.launch()
42
43 # Disable drivers and services that stall for a long time during boot,
44 # to avoid running past the 90-second timeout. These may be removed
45 # as the corresponding device support is added.
46 kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE + (
47 'console=${console} '
48 'mem=${mem} '
49 'initcall_blacklist=npcm_i2c_bus_driver_init '
50 'systemd.mask=systemd-random-seed.service '
51 'systemd.mask=dropbearkey.service '
52 )
53
54 self.wait_for_console_pattern('> BootBlock by Nuvoton')
55 self.wait_for_console_pattern('>Device: Poleg BMC NPCM730')
56 self.wait_for_console_pattern('>Skip DDR init.')
57 self.wait_for_console_pattern('U-Boot ')
58 interrupt_interactive_console_until_pattern(
59 self, 'Hit any key to stop autoboot:', 'U-Boot>')
60 exec_command_and_wait_for_pattern(
61 self, "setenv bootargs ${bootargs} " + kernel_command_line,
62 'U-Boot>')
63 exec_command_and_wait_for_pattern(
64 self, 'run romboot', 'Booting Kernel from flash')
65 self.wait_for_console_pattern('Booting Linux on physical CPU 0x0')
66 self.wait_for_console_pattern('CPU1: thread -1, cpu 1, socket 0')
67 self.wait_for_console_pattern('OpenBMC Project Reference Distro')
68 self.wait_for_console_pattern('gsj login:')
69
70 def test_arm_quanta_gsj_initrd(self):
71 self.set_machine('quanta-gsj')
72 initrd_path = self.ASSET_INITRD.fetch()
73 kernel_path = self.ASSET_KERNEL.fetch()
74 dtb_path = self.ASSET_DTB.fetch()
75
76 self.vm.set_console()
77 kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
78 'console=ttyS0,115200n8 '
79 'earlycon=uart8250,mmio32,0xf0001000')
80 self.vm.add_args('-kernel', kernel_path,
81 '-initrd', initrd_path,
82 '-dtb', dtb_path,
83 '-append', kernel_command_line)
84 self.vm.launch()
85
86 self.wait_for_console_pattern('Booting Linux on physical CPU 0x0')
87 self.wait_for_console_pattern('CPU1: thread -1, cpu 1, socket 0')
88 self.wait_for_console_pattern(
89 'Give root password for system maintenance')
90
91 if __name__ == '__main__':
92 LinuxKernelTest.main()