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 10from qemu_test.utils import archive_extract 11from qemu_test import QemuSystemTest, Asset 12from qemu_test import wait_for_console_pattern 13from qemu_test import exec_command_and_wait_for_pattern 14 15class BambooMachine(QemuSystemTest): 16 17 timeout = 90 18 19 ASSET_IMAGE = Asset( 20 ('http://landley.net/aboriginal/downloads/binaries/' 21 'system-image-powerpc-440fp.tar.gz'), 22 'c12b58f841c775a0e6df4832a55afe6b74814d1565d08ddeafc1fb949a075c5e') 23 24 def test_ppc_bamboo(self): 25 self.set_machine('bamboo') 26 self.require_accelerator("tcg") 27 self.require_netdev('user') 28 file_path = self.ASSET_IMAGE.fetch() 29 archive_extract(file_path, self.workdir) 30 self.vm.set_console() 31 self.vm.add_args('-kernel', self.workdir + 32 '/system-image-powerpc-440fp/linux', 33 '-initrd', self.workdir + 34 '/system-image-powerpc-440fp/rootfs.cpio.gz', 35 '-nic', 'user,model=rtl8139,restrict=on') 36 self.vm.launch() 37 wait_for_console_pattern(self, 'Type exit when done') 38 exec_command_and_wait_for_pattern(self, 'ping 10.0.2.2', 39 '10.0.2.2 is alive!') 40 exec_command_and_wait_for_pattern(self, 'halt', 'System Halted') 41 42if __name__ == '__main__': 43 QemuSystemTest.main() 44