1# Test that Linux kernel boots on ppc machines and check the console
2#
3# Copyright (c) 2018, 2020 Red Hat, Inc.
4#
5# This work is licensed under the terms of the GNU GPL, version 2 or
6# later.  See the COPYING file in the top-level directory.
7
8from avocado.utils import archive
9from avocado_qemu import QemuSystemTest
10from avocado_qemu import wait_for_console_pattern
11
12class VirtexMl507Machine(QemuSystemTest):
13
14    timeout = 90
15    KERNEL_COMMON_COMMAND_LINE = 'printk.time=0 '
16    panic_message = 'Kernel panic - not syncing'
17
18    def test_ppc_virtex_ml507(self):
19        """
20        :avocado: tags=arch:ppc
21        :avocado: tags=machine:virtex-ml507
22        :avocado: tags=accel:tcg
23        """
24        self.require_accelerator("tcg")
25        tar_url = ('https://qemu-advcal.gitlab.io'
26                   '/qac-best-of-multiarch/download/day08.tar.xz')
27        tar_hash = '74c68f5af7a7b8f21c03097b298f3bb77ff52c1f'
28        file_path = self.fetch_asset(tar_url, asset_hash=tar_hash)
29        archive.extract(file_path, self.workdir)
30        self.vm.set_console()
31        self.vm.add_args('-kernel', self.workdir + '/hippo/hippo.linux',
32                         '-dtb', self.workdir + '/hippo/virtex440-ml507.dtb',
33                         '-m', '512')
34        self.vm.launch()
35        wait_for_console_pattern(self, 'QEMU advent calendar 2020',
36                                 self.panic_message)
37