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