xref: /qemu/tests/functional/test_ppc_sam460ex.py (revision 513823e7521a09ed7ad1e32e6454bac3b2cbf52d)
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
7from qemu_test import LinuxKernelTest, Asset
8from qemu_test import exec_command_and_wait_for_pattern
9
10
11class sam460exTest(LinuxKernelTest):
12
13    ASSET_BR2_SAM460EX_LINUX = Asset(
14        'https://github.com/legoater/qemu-ppc-boot/raw/refs/heads/main/buildroot/qemu_ppc_sam460ex-2023.11-8-gdcd9f0f6eb-20240105/vmlinux',
15        '6f46346f3e20e8b5fc050ff363f350f8b9d76a051b9e0bd7ea470cc680c14df2')
16
17    def test_ppc_sam460ex_buildroot(self):
18        self.set_machine('sam460ex')
19        self.require_netdev('user')
20
21        linux_path = self.ASSET_BR2_SAM460EX_LINUX.fetch()
22
23        self.vm.set_console()
24        self.vm.add_args('-kernel', linux_path,
25                         '-device', 'virtio-net-pci,netdev=net0',
26                         '-netdev', 'user,id=net0')
27        self.vm.launch()
28
29        self.wait_for_console_pattern('Linux version')
30        self.wait_for_console_pattern('Hardware name: amcc,canyonlands 460EX')
31        self.wait_for_console_pattern('/init as init process')
32        self.wait_for_console_pattern('lease of 10.0.2.15 obtained')
33        self.wait_for_console_pattern('buildroot login:')
34        exec_command_and_wait_for_pattern(self, 'root', '#')
35        exec_command_and_wait_for_pattern(self, 'poweroff', 'System Halted')
36
37if __name__ == '__main__':
38    LinuxKernelTest.main()
39