xref: /qemu/tests/functional/test_ppc_bamboo.py (revision 513823e7521a09ed7ad1e32e6454bac3b2cbf52d)
1#!/usr/bin/env python3
2#
3# Test that Linux kernel boots on the ppc bamboo board and check the console
4#
5# Copyright (c) 2021 Red Hat
6#
7# This work is licensed under the terms of the GNU GPL, version 2 or
8# later.  See the COPYING file in the top-level directory.
9
10from qemu_test import QemuSystemTest, Asset
11from qemu_test import wait_for_console_pattern
12from qemu_test import exec_command_and_wait_for_pattern
13
14
15class BambooMachine(QemuSystemTest):
16
17    timeout = 90
18
19    ASSET_IMAGE = Asset(
20        ('http://landley.net/aboriginal/downloads/binaries/'
21         'system-image-powerpc-440fp.tar.gz'),
22        'c12b58f841c775a0e6df4832a55afe6b74814d1565d08ddeafc1fb949a075c5e')
23
24    def test_ppc_bamboo(self):
25        self.set_machine('bamboo')
26        self.require_accelerator("tcg")
27        self.require_netdev('user')
28        self.archive_extract(self.ASSET_IMAGE)
29        self.vm.set_console()
30        self.vm.add_args('-kernel',
31                         self.scratch_file('system-image-powerpc-440fp',
32                                           'linux'),
33                         '-initrd',
34                         self.scratch_file('system-image-powerpc-440fp',
35                                           'rootfs.cpio.gz'),
36                         '-nic', 'user,model=rtl8139,restrict=on')
37        self.vm.launch()
38        wait_for_console_pattern(self, 'Type exit when done')
39        exec_command_and_wait_for_pattern(self, 'ping 10.0.2.2',
40                                          '10.0.2.2 is alive!')
41        exec_command_and_wait_for_pattern(self, 'halt', 'System Halted')
42
43if __name__ == '__main__':
44    QemuSystemTest.main()
45