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 Aarch64SbsarefAlpine(QemuSystemTest): 19 20 ASSET_ALPINE_ISO = Asset( 21 ('https://dl-cdn.alpinelinux.org/' 22 'alpine/v3.17/releases/aarch64/alpine-standard-3.17.2-aarch64.iso'), 23 '5a36304ecf039292082d92b48152a9ec21009d3a62f459de623e19c4bd9dc027') 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_alpine_linux(self, cpu=None): 29 fetch_firmware(self) 30 31 iso_path = self.ASSET_ALPINE_ISO.fetch() 32 33 self.vm.set_console() 34 self.vm.add_args( 35 "-drive", f"file={iso_path},media=cdrom,format=raw", 36 ) 37 if cpu: 38 self.vm.add_args("-cpu", cpu) 39 40 self.vm.launch() 41 wait_for_console_pattern(self, "Welcome to Alpine Linux 3.17") 42 43 def test_sbsaref_alpine_linux_cortex_a57(self): 44 self.boot_alpine_linux("cortex-a57") 45 46 def test_sbsaref_alpine_linux_default_cpu(self): 47 self.boot_alpine_linux() 48 49 def test_sbsaref_alpine_linux_max_pauth_off(self): 50 self.boot_alpine_linux("max,pauth=off") 51 52 def test_sbsaref_alpine_linux_max_pauth_impdef(self): 53 self.boot_alpine_linux("max,pauth-impdef=on") 54 55 @skipSlowTest() # Test might timeout due to PAuth emulation 56 def test_sbsaref_alpine_linux_max(self): 57 self.boot_alpine_linux("max") 58 59 60if __name__ == '__main__': 61 QemuSystemTest.main() 62