master
py 48 lines 1.78 KB
Raw
1 #!/usr/bin/env python3
2 #
3 # Test that Linux kernel boots on the ppc bamboo board and check the console
4 #
5 # Copyright (c) 2021 Red Hat
6 #
7 # This work is licensed under the terms of the GNU GPL, version 2 or
8 # later. See the COPYING file in the top-level directory.
9
10 from qemu_test import QemuSystemTest, Asset
11 from qemu_test import wait_for_console_pattern
12 from qemu_test import exec_command_and_wait_for_pattern
13
14
15 class BambooMachine(QemuSystemTest):
16
17 timeout = 90
18
19 ASSET_KERNEL = Asset(
20 ('https://github.com/legoater/qemu-ppc-boot/raw/refs/heads/main/'
21 'buildroot/qemu_ppc_bamboo-2023.11-8-gdcd9f0f6eb-20240105/vmlinux'),
22 'a2e12eb45b73491ac62fc0bbeb68dead0dc5c0f22cf83146558389209b420ad1')
23 ASSET_INITRD = Asset(
24 ('https://github.com/legoater/qemu-ppc-boot/raw/refs/heads/main/'
25 'buildroot/qemu_ppc_bamboo-2023.11-8-gdcd9f0f6eb-20240105/rootfs.cpio'),
26 'd2a36bdb8763b389765dc8c29d4904cec2bd001c587f92e85ab9eb10d5ddda54')
27
28 def test_ppc_bamboo(self):
29 self.set_machine('bamboo')
30 self.require_accelerator("tcg")
31 self.require_netdev('user')
32
33 kernel = self.ASSET_KERNEL.fetch()
34 initrd = self.ASSET_INITRD.fetch()
35
36 self.vm.set_console()
37 self.vm.add_args('-kernel', kernel,
38 '-initrd', initrd,
39 '-nic', 'user,model=virtio-net-pci,restrict=on')
40 self.vm.launch()
41 wait_for_console_pattern(self, 'buildroot login:')
42 exec_command_and_wait_for_pattern(self, 'root', '#')
43 exec_command_and_wait_for_pattern(self, 'ping -c1 10.0.2.2',
44 '1 packets transmitted, 1 packets received, 0% packet loss')
45 exec_command_and_wait_for_pattern(self, 'halt', 'System Halted')
46
47 if __name__ == '__main__':
48 QemuSystemTest.main()