1*e3fc99b1SThomas Huth#!/usr/bin/env python3 2*e3fc99b1SThomas Huth# 3*e3fc99b1SThomas Huth# Test that Linux kernel boots on the ppc bamboo board and check the console 4*e3fc99b1SThomas Huth# 5*e3fc99b1SThomas Huth# Copyright (c) 2021 Red Hat 6*e3fc99b1SThomas Huth# 7*e3fc99b1SThomas Huth# This work is licensed under the terms of the GNU GPL, version 2 or 8*e3fc99b1SThomas Huth# later. See the COPYING file in the top-level directory. 9*e3fc99b1SThomas Huth 10*e3fc99b1SThomas Huthfrom qemu_test.utils import archive_extract 11*e3fc99b1SThomas Huthfrom qemu_test import QemuSystemTest, Asset 12*e3fc99b1SThomas Huthfrom qemu_test import wait_for_console_pattern 13*e3fc99b1SThomas Huthfrom qemu_test import exec_command_and_wait_for_pattern 14*e3fc99b1SThomas Huth 15*e3fc99b1SThomas Huthclass BambooMachine(QemuSystemTest): 16*e3fc99b1SThomas Huth 17*e3fc99b1SThomas Huth timeout = 90 18*e3fc99b1SThomas Huth 19*e3fc99b1SThomas Huth ASSET_IMAGE = Asset( 20*e3fc99b1SThomas Huth ('http://landley.net/aboriginal/downloads/binaries/' 21*e3fc99b1SThomas Huth 'system-image-powerpc-440fp.tar.gz'), 22*e3fc99b1SThomas Huth 'c12b58f841c775a0e6df4832a55afe6b74814d1565d08ddeafc1fb949a075c5e') 23*e3fc99b1SThomas Huth 24*e3fc99b1SThomas Huth def test_ppc_bamboo(self): 25*e3fc99b1SThomas Huth self.set_machine('bamboo') 26*e3fc99b1SThomas Huth self.require_accelerator("tcg") 27*e3fc99b1SThomas Huth self.require_netdev('user') 28*e3fc99b1SThomas Huth file_path = self.ASSET_IMAGE.fetch() 29*e3fc99b1SThomas Huth archive_extract(file_path, self.workdir) 30*e3fc99b1SThomas Huth self.vm.set_console() 31*e3fc99b1SThomas Huth self.vm.add_args('-kernel', self.workdir + 32*e3fc99b1SThomas Huth '/system-image-powerpc-440fp/linux', 33*e3fc99b1SThomas Huth '-initrd', self.workdir + 34*e3fc99b1SThomas Huth '/system-image-powerpc-440fp/rootfs.cpio.gz', 35*e3fc99b1SThomas Huth '-nic', 'user,model=rtl8139,restrict=on') 36*e3fc99b1SThomas Huth self.vm.launch() 37*e3fc99b1SThomas Huth wait_for_console_pattern(self, 'Type exit when done') 38*e3fc99b1SThomas Huth exec_command_and_wait_for_pattern(self, 'ping 10.0.2.2', 39*e3fc99b1SThomas Huth '10.0.2.2 is alive!') 40*e3fc99b1SThomas Huth exec_command_and_wait_for_pattern(self, 'halt', 'System Halted') 41*e3fc99b1SThomas Huth 42*e3fc99b1SThomas Huthif __name__ == '__main__': 43*e3fc99b1SThomas Huth QemuSystemTest.main() 44