| 1 | #!/usr/bin/env python3 |
| 2 | # |
| 3 | # Functional test that boots a sam460ex machine with a PPC 460EX 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 | |
| 11 | class Sam460exTest(LinuxKernelTest): |
| 12 | |
| 13 | ASSET_BR2_SAM460EX_LINUX = Asset( |
| 14 | ('https://github.com/legoater/qemu-ppc-boot/raw/refs/heads/main' |
| 15 | '/buildroot/qemu_ppc_sam460ex-2023.11-8-gdcd9f0f6eb-20240105/vmlinux'), |
| 16 | '6f46346f3e20e8b5fc050ff363f350f8b9d76a051b9e0bd7ea470cc680c14df2') |
| 17 | |
| 18 | def test_ppc_sam460ex_buildroot(self): |
| 19 | self.set_machine('sam460ex') |
| 20 | self.require_netdev('user') |
| 21 | |
| 22 | linux_path = self.ASSET_BR2_SAM460EX_LINUX.fetch() |
| 23 | |
| 24 | self.vm.set_console() |
| 25 | self.vm.add_args('-kernel', linux_path, |
| 26 | '-device', 'virtio-net-pci,netdev=net0', |
| 27 | '-netdev', 'user,id=net0') |
| 28 | self.vm.launch() |
| 29 | |
| 30 | self.wait_for_console_pattern('Linux version') |
| 31 | self.wait_for_console_pattern('Hardware name: amcc,canyonlands 460EX') |
| 32 | self.wait_for_console_pattern('/init as init process') |
| 33 | self.wait_for_console_pattern('lease of 10.0.2.15 obtained') |
| 34 | self.wait_for_console_pattern('buildroot login:') |
| 35 | exec_command_and_wait_for_pattern(self, 'root', '#') |
| 36 | exec_command_and_wait_for_pattern(self, 'poweroff', 'System Halted') |
| 37 | |
| 38 | if __name__ == '__main__': |
| 39 | LinuxKernelTest.main() |