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 13import os 14 15from qemu_test import QemuSystemTest, Asset, skipSlowTest 16from qemu_test import wait_for_console_pattern 17from unittest import skipUnless 18from test_aarch64_sbsaref import fetch_firmware 19 20 21class Aarch64SbsarefAlpine(QemuSystemTest): 22 23 ASSET_ALPINE_ISO = Asset( 24 ('https://dl-cdn.alpinelinux.org/' 25 'alpine/v3.17/releases/aarch64/alpine-standard-3.17.2-aarch64.iso'), 26 '5a36304ecf039292082d92b48152a9ec21009d3a62f459de623e19c4bd9dc027') 27 28 # This tests the whole boot chain from EFI to Userspace 29 # We only boot a whole OS for the current top level CPU and GIC 30 # Other test profiles should use more minimal boots 31 def boot_alpine_linux(self, cpu=None): 32 fetch_firmware(self) 33 34 iso_path = self.ASSET_ALPINE_ISO.fetch() 35 36 self.vm.set_console() 37 self.vm.add_args( 38 "-drive", f"file={iso_path},media=cdrom,format=raw", 39 ) 40 if cpu: 41 self.vm.add_args("-cpu", cpu) 42 43 self.vm.launch() 44 wait_for_console_pattern(self, "Welcome to Alpine Linux 3.17") 45 46 def test_sbsaref_alpine_linux_cortex_a57(self): 47 self.boot_alpine_linux("cortex-a57") 48 49 def test_sbsaref_alpine_linux_default_cpu(self): 50 self.boot_alpine_linux() 51 52 def test_sbsaref_alpine_linux_max_pauth_off(self): 53 self.boot_alpine_linux("max,pauth=off") 54 55 def test_sbsaref_alpine_linux_max_pauth_impdef(self): 56 self.boot_alpine_linux("max,pauth-impdef=on") 57 58 @skipSlowTest() # Test might timeout due to PAuth emulation 59 def test_sbsaref_alpine_linux_max(self): 60 self.boot_alpine_linux("max") 61 62 63if __name__ == '__main__': 64 QemuSystemTest.main() 65