153a62fdeSThomas Huth#!/usr/bin/env python3 253a62fdeSThomas Huth# 353a62fdeSThomas Huth# Boot a Linux kernel on a e500 ppc64 machine and check the console 453a62fdeSThomas Huth# 553a62fdeSThomas Huth# SPDX-License-Identifier: GPL-2.0-or-later 653a62fdeSThomas Huth 753a62fdeSThomas Huthfrom qemu_test import LinuxKernelTest, Asset 872cdd672SCédric Le Goaterfrom qemu_test import exec_command_and_wait_for_pattern 95831ed84SDaniel P. Berrangé 1053a62fdeSThomas Huth 1153a62fdeSThomas Huthclass E500Test(LinuxKernelTest): 1253a62fdeSThomas Huth 1372cdd672SCédric Le Goater ASSET_BR2_E5500_UIMAGE = Asset( 1472cdd672SCédric Le Goater 'https://github.com/legoater/qemu-ppc-boot/raw/refs/heads/main/buildroot/qemu_ppc64_e5500-2023.11-8-gdcd9f0f6eb-20240104/uImage', 1572cdd672SCédric Le Goater '2478187c455d6cca3984e9dfde9c635d824ea16236b85fd6b4809f744706deda') 1653a62fdeSThomas Huth 1772cdd672SCédric Le Goater ASSET_BR2_E5500_ROOTFS = Asset( 1872cdd672SCédric Le Goater 'https://github.com/legoater/qemu-ppc-boot/raw/refs/heads/main//buildroot/qemu_ppc64_e5500-2023.11-8-gdcd9f0f6eb-20240104/rootfs.ext2', 1972cdd672SCédric Le Goater '9035ef97237c84c7522baaff17d25cdfca4bb7a053d5e296e902919473423d76') 2072cdd672SCédric Le Goater 2172cdd672SCédric Le Goater def test_ppc64_e500_buildroot(self): 2253a62fdeSThomas Huth self.set_machine('ppce500') 23*533b33d0SCédric Le Goater self.require_netdev('user') 2453a62fdeSThomas Huth self.cpu = 'e5500' 2572cdd672SCédric Le Goater 2672cdd672SCédric Le Goater uimage_path = self.ASSET_BR2_E5500_UIMAGE.fetch() 2772cdd672SCédric Le Goater rootfs_path = self.ASSET_BR2_E5500_ROOTFS.fetch() 2872cdd672SCédric Le Goater 2972cdd672SCédric Le Goater self.vm.set_console() 3072cdd672SCédric Le Goater self.vm.add_args('-kernel', uimage_path, 3172cdd672SCédric Le Goater '-append', 'root=/dev/vda', 3272cdd672SCédric Le Goater '-drive', f'file={rootfs_path},if=virtio,format=raw', 3372cdd672SCédric Le Goater '-snapshot', '-no-shutdown') 3472cdd672SCédric Le Goater self.vm.launch() 3572cdd672SCédric Le Goater 3672cdd672SCédric Le Goater self.wait_for_console_pattern('Linux version') 3772cdd672SCédric Le Goater self.wait_for_console_pattern('/init as init process') 3872cdd672SCédric Le Goater self.wait_for_console_pattern('lease of 10.0.2.15') 3972cdd672SCédric Le Goater self.wait_for_console_pattern('buildroot login:') 4072cdd672SCédric Le Goater exec_command_and_wait_for_pattern(self, 'root', '#') 4172cdd672SCédric Le Goater exec_command_and_wait_for_pattern(self, 'poweroff', 'Power down') 4253a62fdeSThomas Huth 4353a62fdeSThomas Huthif __name__ == '__main__': 4453a62fdeSThomas Huth LinuxKernelTest.main() 45