xref: /qemu/tests/functional/test_microblaze_s3adsp1800.py (revision ccc76731aee7d3efb16a679fa5bf3cc3f57e9f2d)
1#!/usr/bin/env python3
2#
3# Functional test that boots a microblaze Linux kernel and checks the console
4#
5# Copyright (c) 2018, 2021 Red Hat, Inc.
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 exec_command, exec_command_and_wait_for_pattern
11from qemu_test import QemuSystemTest, Asset
12from qemu_test import wait_for_console_pattern
13from qemu_test.utils import archive_extract
14
15class MicroblazeMachine(QemuSystemTest):
16
17    timeout = 90
18
19    ASSET_IMAGE = Asset(
20        ('https://qemu-advcal.gitlab.io/qac-best-of-multiarch/download/'
21         'day17.tar.xz'),
22        '3ba7439dfbea7af4876662c97f8e1f0cdad9231fc166e4861d17042489270057')
23
24    def test_microblaze_s3adsp1800(self):
25        self.set_machine('petalogix-s3adsp1800')
26        file_path = self.ASSET_IMAGE.fetch()
27        archive_extract(file_path, self.workdir)
28        self.vm.set_console()
29        self.vm.add_args('-kernel', self.workdir + '/day17/ballerina.bin')
30        self.vm.launch()
31        wait_for_console_pattern(self, 'This architecture does not have '
32                                       'kernel memory protection')
33        # Note:
34        # The kernel sometimes gets stuck after the "This architecture ..."
35        # message, that's why we don't test for a later string here. This
36        # needs some investigation by a microblaze wizard one day...
37
38if __name__ == '__main__':
39    QemuSystemTest.main()
40