xref: /qemu/tests/functional/test_aarch64_sbsaref_freebsd.py (revision 55f5bf716a65f67663d0769bcb8c017764b3e53a)
1#!/usr/bin/env python3
2#
3# Functional test that boots a kernel and checks the console
4#
5# Copyright (c) 2023-2024 Linaro Ltd.
6#
7# Authors:
8#   Philippe Mathieu-Daudé
9#   Marcin Juszkiewicz
10#
11# SPDX-License-Identifier: GPL-2.0-or-later
12
13from qemu_test import QemuSystemTest, Asset, skipSlowTest
14from qemu_test import wait_for_console_pattern
15from test_aarch64_sbsaref import fetch_firmware
16
17
18class Aarch64SbsarefFreeBSD(QemuSystemTest):
19
20    ASSET_FREEBSD_ISO = Asset(
21        ('https://download.freebsd.org/releases/arm64/aarch64/ISO-IMAGES/'
22         '14.1/FreeBSD-14.1-RELEASE-arm64-aarch64-bootonly.iso'),
23        '44cdbae275ef1bb6dab1d5fbb59473d4f741e1c8ea8a80fd9e906b531d6ad461')
24
25    # This tests the whole boot chain from EFI to Userspace
26    # We only boot a whole OS for the current top level CPU and GIC
27    # Other test profiles should use more minimal boots
28    def boot_freebsd14(self, cpu=None):
29        fetch_firmware(self)
30
31        img_path = self.ASSET_FREEBSD_ISO.fetch()
32
33        self.vm.set_console()
34        self.vm.add_args(
35            "-drive", f"file={img_path},format=raw,snapshot=on",
36        )
37        if cpu:
38            self.vm.add_args("-cpu", cpu)
39
40        self.vm.launch()
41        wait_for_console_pattern(self, 'Welcome to FreeBSD!')
42
43    def test_sbsaref_freebsd14_cortex_a57(self):
44        self.boot_freebsd14("cortex-a57")
45
46    def test_sbsaref_freebsd14_default_cpu(self):
47        self.boot_freebsd14()
48
49    def test_sbsaref_freebsd14_max_pauth_off(self):
50        self.boot_freebsd14("max,pauth=off")
51
52    @skipSlowTest()  # Test might timeout due to PAuth emulation
53    def test_sbsaref_freebsd14_max_pauth_impdef(self):
54        self.boot_freebsd14("max,pauth-impdef=on")
55
56    @skipSlowTest()  # Test might timeout due to PAuth emulation
57    def test_sbsaref_freebsd14_max(self):
58        self.boot_freebsd14("max")
59
60
61if __name__ == '__main__':
62    QemuSystemTest.main()
63