xref: /qemu/tests/functional/test_mips64el_loongson3v.py (revision ccc76731aee7d3efb16a679fa5bf3cc3f57e9f2d)
1#!/usr/bin/env python3
2#
3# Functional tests for the Generic Loongson-3 Platform.
4#
5# Copyright (c) 2021 Jiaxun Yang <jiaxun.yang@flygoat.com>
6#
7# This work is licensed under the terms of the GNU GPL, version 2 or later.
8# See the COPYING file in the top-level directory.
9#
10# SPDX-License-Identifier: GPL-2.0-or-later
11
12import os
13
14from unittest import skipUnless
15from qemu_test import QemuSystemTest, Asset
16from qemu_test import wait_for_console_pattern
17
18class MipsLoongson3v(QemuSystemTest):
19    timeout = 60
20
21    ASSET_PMON = Asset(
22        ('https://github.com/loongson-community/pmon/'
23         'releases/download/20210112/pmon-3avirt.bin'),
24        'fcdf6bb2cb7885a4a62f31fcb0d5e368bac7b6cea28f40c6dfa678af22fea20a')
25
26    @skipUnless(os.getenv('QEMU_TEST_ALLOW_UNTRUSTED_CODE'), 'untrusted code')
27    def test_pmon_serial_console(self):
28        self.set_machine('loongson3-virt')
29
30        pmon_path = self.ASSET_PMON.fetch()
31
32        self.vm.set_console()
33        self.vm.add_args('-bios', pmon_path)
34        self.vm.launch()
35        wait_for_console_pattern(self, 'CPU GODSON3 BogoMIPS:')
36
37if __name__ == '__main__':
38    QemuSystemTest.main()
39