1#!/usr/bin/env python3 2# 3# Functional test that boots a mac99 machine with a PPC970 CPU 4# 5# SPDX-License-Identifier: GPL-2.0-or-later 6 7from qemu_test import LinuxKernelTest, Asset 8from qemu_test import exec_command_and_wait_for_pattern 9 10class mac99Test(LinuxKernelTest): 11 12 ASSET_BR2_MAC99_LINUX = Asset( 13 'https://github.com/legoater/qemu-ppc-boot/raw/refs/heads/main/buildroot/qemu_ppc64_mac99-2023.11-8-gdcd9f0f6eb-20240105/vmlinux', 14 'd59307437e4365f2cced0bbd1b04949f7397b282ef349b7cafd894d74aadfbff') 15 16 ASSET_BR2_MAC99_ROOTFS = Asset( 17 'https://github.com/legoater/qemu-ppc-boot/raw/refs/heads/main//buildroot/qemu_ppc64_mac99-2023.11-8-gdcd9f0f6eb-20240105/rootfs.ext2', 18 'bbd5fd8af62f580bc4e585f326fe584e22856572633a8333178ea6d4ed4955a4') 19 20 def test_ppc64_mac99_buildroot(self): 21 self.set_machine('mac99') 22 23 linux_path = self.ASSET_BR2_MAC99_LINUX.fetch() 24 rootfs_path = self.ASSET_BR2_MAC99_ROOTFS.fetch() 25 26 self.vm.set_console() 27 28 # Note: We need '-nographic' to get a serial console 29 self.vm.add_args('-kernel', linux_path, 30 '-append', 'root=/dev/sda', 31 '-drive', f'file={rootfs_path},format=raw', 32 '-snapshot', '-nographic') 33 self.vm.launch() 34 35 self.wait_for_console_pattern('>> OpenBIOS') 36 self.wait_for_console_pattern('Linux version') 37 self.wait_for_console_pattern('/init as init process') 38 self.wait_for_console_pattern('gem 0000:f0:0e.0 eth0: Link is up at 100 Mbps') 39 self.wait_for_console_pattern('buildroot login:') 40 exec_command_and_wait_for_pattern(self, 'root', '#') 41 exec_command_and_wait_for_pattern(self, 'poweroff', 'Power down') 42 43if __name__ == '__main__': 44 LinuxKernelTest.main() 45