1*55727771SCédric Le Goater#!/usr/bin/env python3 2*55727771SCédric Le Goater# 3*55727771SCédric Le Goater# Functional test that boots a sam460ex machine with a PPC 460EX CPU 4*55727771SCédric Le Goater# 5*55727771SCédric Le Goater# SPDX-License-Identifier: GPL-2.0-or-later 6*55727771SCédric Le Goater 7*55727771SCédric Le Goaterfrom qemu_test import LinuxKernelTest, Asset 8*55727771SCédric Le Goaterfrom qemu_test import exec_command_and_wait_for_pattern 9*55727771SCédric Le Goater 10*55727771SCédric Le Goater 11*55727771SCédric Le Goaterclass sam460exTest(LinuxKernelTest): 12*55727771SCédric Le Goater 13*55727771SCédric Le Goater ASSET_BR2_SAM460EX_LINUX = Asset( 14*55727771SCédric Le Goater 'https://github.com/legoater/qemu-ppc-boot/raw/refs/heads/main/buildroot/qemu_ppc_sam460ex-2023.11-8-gdcd9f0f6eb-20240105/vmlinux', 15*55727771SCédric Le Goater '6f46346f3e20e8b5fc050ff363f350f8b9d76a051b9e0bd7ea470cc680c14df2') 16*55727771SCédric Le Goater 17*55727771SCédric Le Goater def test_ppc_sam460ex_buildroot(self): 18*55727771SCédric Le Goater self.set_machine('sam460ex') 19*55727771SCédric Le Goater self.require_netdev('user') 20*55727771SCédric Le Goater 21*55727771SCédric Le Goater linux_path = self.ASSET_BR2_SAM460EX_LINUX.fetch() 22*55727771SCédric Le Goater 23*55727771SCédric Le Goater self.vm.set_console() 24*55727771SCédric Le Goater self.vm.add_args('-kernel', linux_path, 25*55727771SCédric Le Goater '-device', 'virtio-net-pci,netdev=net0', 26*55727771SCédric Le Goater '-netdev', 'user,id=net0') 27*55727771SCédric Le Goater self.vm.launch() 28*55727771SCédric Le Goater 29*55727771SCédric Le Goater self.wait_for_console_pattern('Linux version') 30*55727771SCédric Le Goater self.wait_for_console_pattern('Hardware name: amcc,canyonlands 460EX') 31*55727771SCédric Le Goater self.wait_for_console_pattern('/init as init process') 32*55727771SCédric Le Goater self.wait_for_console_pattern('lease of 10.0.2.15 obtained') 33*55727771SCédric Le Goater self.wait_for_console_pattern('buildroot login:') 34*55727771SCédric Le Goater exec_command_and_wait_for_pattern(self, 'root', '#') 35*55727771SCédric Le Goater exec_command_and_wait_for_pattern(self, 'poweroff', 'System Halted') 36*55727771SCédric Le Goater 37*55727771SCédric Le Goaterif __name__ == '__main__': 38*55727771SCédric Le Goater LinuxKernelTest.main() 39