1# Functional tests for the Lemote Fuloong-2E machine.
2#
3# Copyright (c) 2019 Philippe Mathieu-Daudé <f4bug@amsat.org>
4#
5# This work is licensed under the terms of the GNU GPL, version 2 or later.
6# See the COPYING file in the top-level directory.
7#
8# SPDX-License-Identifier: GPL-2.0-or-later
9
10import os
11
12from avocado import skipUnless
13from avocado_qemu import QemuSystemTest
14from avocado_qemu import wait_for_console_pattern
15
16class MipsFuloong2e(QemuSystemTest):
17
18    timeout = 60
19
20    @skipUnless(os.getenv('AVOCADO_ALLOW_UNTRUSTED_CODE'), 'untrusted code')
21    @skipUnless(os.getenv('RESCUE_YL_PATH'), 'RESCUE_YL_PATH not available')
22    def test_linux_kernel_isa_serial(self):
23        """
24        :avocado: tags=arch:mips64el
25        :avocado: tags=machine:fuloong2e
26        :avocado: tags=endian:little
27        :avocado: tags=device:bonito64
28        :avocado: tags=device:via686b
29        """
30        # Recovery system for the Yeeloong laptop
31        # (enough to test the fuloong2e southbridge, accessing its ISA bus)
32        # http://dev.lemote.com/files/resource/download/rescue/rescue-yl
33        kernel_hash = 'ec4d1bd89a8439c41033ca63db60160cc6d6f09a'
34        kernel_path = self.fetch_asset('file://' + os.getenv('RESCUE_YL_PATH'),
35                                       asset_hash=kernel_hash)
36
37        self.vm.set_console()
38        self.vm.add_args('-kernel', kernel_path)
39        self.vm.launch()
40        wait_for_console_pattern(self, 'Linux version 2.6.27.7lemote')
41        cpu_revision = 'CPU revision is: 00006302 (ICT Loongson-2)'
42        wait_for_console_pattern(self, cpu_revision)
43