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 ('http://ftp-archive.freebsd.org/pub/FreeBSD-Archive/old-releases/arm64' 22 '/aarch64/ISO-IMAGES/14.1/FreeBSD-14.1-RELEASE-arm64-aarch64-bootonly.iso.xz'), 23 '7313a4495ffd71ab77b49b1e83f571521c32756e1d75bf48bd890e0ab0f75827') 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 self.set_machine('sbsa-ref') 30 31 fetch_firmware(self) 32 img_path = self.uncompress(self.ASSET_FREEBSD_ISO) 33 34 self.vm.set_console() 35 self.vm.add_args( 36 "-drive", f"file={img_path},format=raw,snapshot=on", 37 ) 38 if cpu: 39 self.vm.add_args("-cpu", cpu) 40 41 self.vm.launch() 42 wait_for_console_pattern(self, 'Welcome to FreeBSD!') 43 44 def test_sbsaref_freebsd14_cortex_a57(self): 45 self.boot_freebsd14("cortex-a57") 46 47 def test_sbsaref_freebsd14_default_cpu(self): 48 self.boot_freebsd14() 49 50 def test_sbsaref_freebsd14_max_pauth_off(self): 51 self.boot_freebsd14("max,pauth=off") 52 53 @skipSlowTest() # Test might timeout due to PAuth emulation 54 def test_sbsaref_freebsd14_max_pauth_impdef(self): 55 self.boot_freebsd14("max,pauth-impdef=on") 56 57 @skipSlowTest() # Test might timeout due to PAuth emulation 58 def test_sbsaref_freebsd14_max(self): 59 self.boot_freebsd14("max") 60 61 62if __name__ == '__main__': 63 QemuSystemTest.main() 64