xref: /qemu/tests/functional/test_aarch64_sbsaref_alpine.py (revision 55f5bf716a65f67663d0769bcb8c017764b3e53a)
19acd3884SThomas Huth#!/usr/bin/env python3
29acd3884SThomas Huth#
39acd3884SThomas Huth# Functional test that boots a kernel and checks the console
49acd3884SThomas Huth#
5*d6f76422SPhilippe Mathieu-Daudé# Copyright (c) 2023-2024 Linaro Ltd.
6*d6f76422SPhilippe Mathieu-Daudé#
7*d6f76422SPhilippe Mathieu-Daudé# Authors:
8*d6f76422SPhilippe Mathieu-Daudé#   Philippe Mathieu-Daudé
9*d6f76422SPhilippe Mathieu-Daudé#   Marcin Juszkiewicz
109acd3884SThomas Huth#
119acd3884SThomas Huth# SPDX-License-Identifier: GPL-2.0-or-later
129acd3884SThomas Huth
134ae633b0SThomas Huthfrom qemu_test import QemuSystemTest, Asset, skipSlowTest
149acd3884SThomas Huthfrom qemu_test import wait_for_console_pattern
159acd3884SThomas Huthfrom test_aarch64_sbsaref import fetch_firmware
169acd3884SThomas Huth
179acd3884SThomas Huth
189acd3884SThomas Huthclass Aarch64SbsarefAlpine(QemuSystemTest):
199acd3884SThomas Huth
209acd3884SThomas Huth    ASSET_ALPINE_ISO = Asset(
219acd3884SThomas Huth        ('https://dl-cdn.alpinelinux.org/'
229acd3884SThomas Huth         'alpine/v3.17/releases/aarch64/alpine-standard-3.17.2-aarch64.iso'),
239acd3884SThomas Huth        '5a36304ecf039292082d92b48152a9ec21009d3a62f459de623e19c4bd9dc027')
249acd3884SThomas Huth
259acd3884SThomas Huth    # This tests the whole boot chain from EFI to Userspace
269acd3884SThomas Huth    # We only boot a whole OS for the current top level CPU and GIC
279acd3884SThomas Huth    # Other test profiles should use more minimal boots
289acd3884SThomas Huth    def boot_alpine_linux(self, cpu=None):
299acd3884SThomas Huth        fetch_firmware(self)
309acd3884SThomas Huth
319acd3884SThomas Huth        iso_path = self.ASSET_ALPINE_ISO.fetch()
329acd3884SThomas Huth
339acd3884SThomas Huth        self.vm.set_console()
349acd3884SThomas Huth        self.vm.add_args(
359acd3884SThomas Huth            "-drive", f"file={iso_path},media=cdrom,format=raw",
369acd3884SThomas Huth        )
379acd3884SThomas Huth        if cpu:
389acd3884SThomas Huth            self.vm.add_args("-cpu", cpu)
399acd3884SThomas Huth
409acd3884SThomas Huth        self.vm.launch()
419acd3884SThomas Huth        wait_for_console_pattern(self, "Welcome to Alpine Linux 3.17")
429acd3884SThomas Huth
439acd3884SThomas Huth    def test_sbsaref_alpine_linux_cortex_a57(self):
449acd3884SThomas Huth        self.boot_alpine_linux("cortex-a57")
459acd3884SThomas Huth
469acd3884SThomas Huth    def test_sbsaref_alpine_linux_default_cpu(self):
479acd3884SThomas Huth        self.boot_alpine_linux()
489acd3884SThomas Huth
499acd3884SThomas Huth    def test_sbsaref_alpine_linux_max_pauth_off(self):
509acd3884SThomas Huth        self.boot_alpine_linux("max,pauth=off")
519acd3884SThomas Huth
529acd3884SThomas Huth    def test_sbsaref_alpine_linux_max_pauth_impdef(self):
539acd3884SThomas Huth        self.boot_alpine_linux("max,pauth-impdef=on")
549acd3884SThomas Huth
554ae633b0SThomas Huth    @skipSlowTest()  # Test might timeout due to PAuth emulation
569acd3884SThomas Huth    def test_sbsaref_alpine_linux_max(self):
579acd3884SThomas Huth        self.boot_alpine_linux("max")
589acd3884SThomas Huth
599acd3884SThomas Huth
609acd3884SThomas Huthif __name__ == '__main__':
619acd3884SThomas Huth    QemuSystemTest.main()
62