xref: /qemu/tests/functional/test_ppc_bamboo.py (revision 5831ed84e7e450a652f215721aba34ed4e1ffb97)
1e3fc99b1SThomas Huth#!/usr/bin/env python3
2e3fc99b1SThomas Huth#
35ff1dfdfSThomas Huth# Test that Linux kernel boots on the ppc bamboo board and check the console
45ff1dfdfSThomas Huth#
55ff1dfdfSThomas Huth# Copyright (c) 2021 Red Hat
65ff1dfdfSThomas Huth#
75ff1dfdfSThomas Huth# This work is licensed under the terms of the GNU GPL, version 2 or
85ff1dfdfSThomas Huth# later.  See the COPYING file in the top-level directory.
95ff1dfdfSThomas Huth
10e3fc99b1SThomas Huthfrom qemu_test import QemuSystemTest, Asset
11e3fc99b1SThomas Huthfrom qemu_test import wait_for_console_pattern
12e3fc99b1SThomas Huthfrom qemu_test import exec_command_and_wait_for_pattern
135ff1dfdfSThomas Huth
14*5831ed84SDaniel P. Berrangé
152283b627SPhilippe Mathieu-Daudéclass BambooMachine(QemuSystemTest):
165ff1dfdfSThomas Huth
175ff1dfdfSThomas Huth    timeout = 90
185ff1dfdfSThomas Huth
19e3fc99b1SThomas Huth    ASSET_IMAGE = Asset(
20e3fc99b1SThomas Huth        ('http://landley.net/aboriginal/downloads/binaries/'
21e3fc99b1SThomas Huth         'system-image-powerpc-440fp.tar.gz'),
22e3fc99b1SThomas Huth        'c12b58f841c775a0e6df4832a55afe6b74814d1565d08ddeafc1fb949a075c5e')
23e3fc99b1SThomas Huth
245ff1dfdfSThomas Huth    def test_ppc_bamboo(self):
25e3fc99b1SThomas Huth        self.set_machine('bamboo')
2652b7fb79SDaniel Henrique Barboza        self.require_accelerator("tcg")
270793fe01SPeter Maydell        self.require_netdev('user')
28*5831ed84SDaniel P. Berrangé        self.archive_extract(self.ASSET_IMAGE)
295ff1dfdfSThomas Huth        self.vm.set_console()
30beaf88c8SDaniel P. Berrangé        self.vm.add_args('-kernel',
31beaf88c8SDaniel P. Berrangé                         self.scratch_file('system-image-powerpc-440fp',
32beaf88c8SDaniel P. Berrangé                                           'linux'),
33beaf88c8SDaniel P. Berrangé                         '-initrd',
34beaf88c8SDaniel P. Berrangé                         self.scratch_file('system-image-powerpc-440fp',
35beaf88c8SDaniel P. Berrangé                                           'rootfs.cpio.gz'),
365ff1dfdfSThomas Huth                         '-nic', 'user,model=rtl8139,restrict=on')
375ff1dfdfSThomas Huth        self.vm.launch()
385ff1dfdfSThomas Huth        wait_for_console_pattern(self, 'Type exit when done')
395ff1dfdfSThomas Huth        exec_command_and_wait_for_pattern(self, 'ping 10.0.2.2',
405ff1dfdfSThomas Huth                                          '10.0.2.2 is alive!')
415ff1dfdfSThomas Huth        exec_command_and_wait_for_pattern(self, 'halt', 'System Halted')
42e3fc99b1SThomas Huth
43e3fc99b1SThomas Huthif __name__ == '__main__':
44e3fc99b1SThomas Huth    QemuSystemTest.main()
45