aboutsummaryrefslogtreecommitdiff
path: root/tests/avocado/riscv_opensbi.py
blob: e02f0d404affca576fb1296f20a67bd8b7f5c81e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# OpenSBI boot test for RISC-V machines
#
# Copyright (c) 2022, Ventana Micro
#
# This work is licensed under the terms of the GNU GPL, version 2 or
# later.  See the COPYING file in the top-level directory.

from avocado_qemu import QemuSystemTest
from avocado import skip
from avocado_qemu import wait_for_console_pattern

class RiscvOpenSBI(QemuSystemTest):
    """
    :avocado: tags=accel:tcg
    """
    timeout = 5

    def boot_opensbi(self):
        self.vm.set_console()
        self.vm.launch()
        wait_for_console_pattern(self, 'Platform Name')
        wait_for_console_pattern(self, 'Boot HART MEDELEG')

    @skip("requires OpenSBI fix to work")
    def test_riscv32_spike(self):
        """
        :avocado: tags=arch:riscv32
        :avocado: tags=machine:spike
        """
        self.boot_opensbi()

    def test_riscv64_spike(self):
        """
        :avocado: tags=arch:riscv64
        :avocado: tags=machine:spike
        """
        self.boot_opensbi()

    def test_riscv32_sifive_u(self):
        """
        :avocado: tags=arch:riscv32
        :avocado: tags=machine:sifive_u
        """
        self.boot_opensbi()

    def test_riscv64_sifive_u(self):
        """
        :avocado: tags=arch:riscv64
        :avocado: tags=machine:sifive_u
        """
        self.boot_opensbi()

    def test_riscv32_virt(self):
        """
        :avocado: tags=arch:riscv32
        :avocado: tags=machine:virt
        """
        self.boot_opensbi()

    def test_riscv64_virt(self):
        """
        :avocado: tags=arch:riscv64
        :avocado: tags=machine:virt
        """
        self.boot_opensbi()