1*e3fc99b1SThomas Huth#!/usr/bin/env python3 2*e3fc99b1SThomas Huth# 35ff1dfdfSThomas Huth# Test that Linux kernel boots on the ppc bamboo board and check the console 45ff1dfdfSThomas Huth# 55ff1dfdfSThomas Huth# Copyright (c) 2021 Red Hat 65ff1dfdfSThomas Huth# 75ff1dfdfSThomas Huth# This work is licensed under the terms of the GNU GPL, version 2 or 85ff1dfdfSThomas Huth# later. See the COPYING file in the top-level directory. 95ff1dfdfSThomas 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 145ff1dfdfSThomas Huth 152283b627SPhilippe Mathieu-Daudéclass BambooMachine(QemuSystemTest): 165ff1dfdfSThomas Huth 175ff1dfdfSThomas Huth timeout = 90 185ff1dfdfSThomas 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 245ff1dfdfSThomas Huth def test_ppc_bamboo(self): 25*e3fc99b1SThomas Huth self.set_machine('bamboo') 2652b7fb79SDaniel Henrique Barboza self.require_accelerator("tcg") 270793fe01SPeter Maydell self.require_netdev('user') 28*e3fc99b1SThomas Huth file_path = self.ASSET_IMAGE.fetch() 29*e3fc99b1SThomas Huth archive_extract(file_path, self.workdir) 305ff1dfdfSThomas Huth self.vm.set_console() 315ff1dfdfSThomas Huth self.vm.add_args('-kernel', self.workdir + 325ff1dfdfSThomas Huth '/system-image-powerpc-440fp/linux', 335ff1dfdfSThomas Huth '-initrd', self.workdir + 345ff1dfdfSThomas Huth '/system-image-powerpc-440fp/rootfs.cpio.gz', 355ff1dfdfSThomas Huth '-nic', 'user,model=rtl8139,restrict=on') 365ff1dfdfSThomas Huth self.vm.launch() 375ff1dfdfSThomas Huth wait_for_console_pattern(self, 'Type exit when done') 385ff1dfdfSThomas Huth exec_command_and_wait_for_pattern(self, 'ping 10.0.2.2', 395ff1dfdfSThomas Huth '10.0.2.2 is alive!') 405ff1dfdfSThomas 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