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 13import time 14 15from unittest import skipUnless 16from qemu_test import QemuSystemTest, Asset 17from qemu_test import wait_for_console_pattern 18 19class MipsLoongson3v(QemuSystemTest): 20 timeout = 60 21 22 ASSET_PMON = Asset( 23 ('https://github.com/loongson-community/pmon/' 24 'releases/download/20210112/pmon-3avirt.bin'), 25 'fcdf6bb2cb7885a4a62f31fcb0d5e368bac7b6cea28f40c6dfa678af22fea20a') 26 27 @skipUnless(os.getenv('QEMU_TEST_ALLOW_UNTRUSTED_CODE'), 'untrusted code') 28 def test_pmon_serial_console(self): 29 self.set_machine('loongson3-virt') 30 31 pmon_path = self.ASSET_PMON.fetch() 32 33 self.vm.set_console() 34 self.vm.add_args('-bios', pmon_path) 35 self.vm.launch() 36 wait_for_console_pattern(self, 'CPU GODSON3 BogoMIPS:') 37 38if __name__ == '__main__': 39 QemuSystemTest.main() 40