xref: /qemu/tests/functional/test_ppc64_pseries.py (revision c5f0a81650ada7178865f74dd4b3c9e508b3018e)
1*c5f0a816SDavid Gibson# Test that Linux kernel boots on ppc machines and check the console
2*c5f0a816SDavid Gibson#
3*c5f0a816SDavid Gibson# Copyright (c) 2018, 2020 Red Hat, Inc.
4*c5f0a816SDavid Gibson#
5*c5f0a816SDavid Gibson# This work is licensed under the terms of the GNU GPL, version 2 or
6*c5f0a816SDavid Gibson# later.  See the COPYING file in the top-level directory.
7*c5f0a816SDavid Gibson
8*c5f0a816SDavid Gibsonfrom avocado.utils import archive
9*c5f0a816SDavid Gibsonfrom avocado_qemu import Test
10*c5f0a816SDavid Gibsonfrom avocado_qemu import wait_for_console_pattern
11*c5f0a816SDavid Gibson
12*c5f0a816SDavid Gibsonclass pseriesMachine(Test):
13*c5f0a816SDavid Gibson
14*c5f0a816SDavid Gibson    timeout = 90
15*c5f0a816SDavid Gibson    KERNEL_COMMON_COMMAND_LINE = 'printk.time=0 '
16*c5f0a816SDavid Gibson    panic_message = 'Kernel panic - not syncing'
17*c5f0a816SDavid Gibson
18*c5f0a816SDavid Gibson    def test_ppc64_pseries(self):
19*c5f0a816SDavid Gibson        """
20*c5f0a816SDavid Gibson        :avocado: tags=arch:ppc64
21*c5f0a816SDavid Gibson        :avocado: tags=machine:pseries
22*c5f0a816SDavid Gibson        """
23*c5f0a816SDavid Gibson        kernel_url = ('https://archives.fedoraproject.org/pub/archive'
24*c5f0a816SDavid Gibson                      '/fedora-secondary/releases/29/Everything/ppc64le/os'
25*c5f0a816SDavid Gibson                      '/ppc/ppc64/vmlinuz')
26*c5f0a816SDavid Gibson        kernel_hash = '3fe04abfc852b66653b8c3c897a59a689270bc77'
27*c5f0a816SDavid Gibson        kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
28*c5f0a816SDavid Gibson
29*c5f0a816SDavid Gibson        self.vm.set_console()
30*c5f0a816SDavid Gibson        kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE + 'console=hvc0'
31*c5f0a816SDavid Gibson        self.vm.add_args('-kernel', kernel_path,
32*c5f0a816SDavid Gibson                         '-append', kernel_command_line)
33*c5f0a816SDavid Gibson        self.vm.launch()
34*c5f0a816SDavid Gibson        console_pattern = 'Kernel command line: %s' % kernel_command_line
35*c5f0a816SDavid Gibson        wait_for_console_pattern(self, console_pattern, self.panic_message)
36