@samitouri / QOSamiQemu / commits / 49105fa010

tests/functional: add Arm VBSA uefi conformance test

The VBSA test is a subset of the wider Arm architecture compliance suites (ACS) which validate machines meet particular minimum set of requirements. The VBSA is for virtual machines so it makes sense we should check the -M virt machine is compliant. Fortunately there are prebuilt binaries published via github so all we need to do is build an EFI partition and place things in the right place. There are some additional Linux based tests which are left for later. Reviewed-by: Mohamed Mediouni <mohamed@unpredictable.fr> Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> Message-ID: <20260226185303.1920021-8-alex.bennee@linaro.org> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

Alex Bennée committed Feb 26, 2026 at 18:53 UTC 49105fa01059c100332a583816ba97562e181586
2 files changed +107
tests/functional/aarch64/meson.build
+1
@@ -46,6 +46,7 @@ tests_aarch64_system_thorough = [
46 'tuxrun',
47 'virt',
48 'virt_gpu',
49 + 'virt_vbsa',
50 'xen',
51 'xlnx_versal',
52 ]
tests/functional/aarch64/test_virt_vbsa.py new
+106
@@ -0,0 +1,106 @@
1 +#!/usr/bin/env python3
2 +#
3 +# Functional test that runs the Arm VBSA conformance tests.
4 +#
5 +# Copyright (c) 2026 Linaro Ltd.
6 +#
7 +# Author:
8 +# Alex Bennée <alex.bennee@linaro.org>
9 +#
10 +# SPDX-License-Identifier: GPL-2.0-or-later
11 +
12 +import shutil
13 +from subprocess import check_call, DEVNULL
14 +
15 +from qemu_test import QemuSystemTest, Asset
16 +from qemu_test import get_qemu_img, skipIfMissingCommands
17 +from qemu_test import wait_for_console_pattern
18 +from qemu_test import exec_command_and_wait_for_pattern as ec_and_wait
19 +
20 +
21 +@skipIfMissingCommands("mformat", "mcopy", "mmd")
22 +class Aarch64VirtMachine(QemuSystemTest):
23 + KERNEL_COMMON_COMMAND_LINE = 'printk.time=0 '
24 + timeout = 360
25 +
26 + def wait_for_console_pattern(self, success_message, vm=None):
27 + wait_for_console_pattern(self, success_message,
28 + failure_message='FAILED',
29 + vm=vm)
30 +
31 + ASSET_VBSA_EFI = Asset(
32 + 'https://github.com/ARM-software/sysarch-acs/raw/refs/heads/main'
33 + '/prebuilt_images/VBSA/v25.12_VBSA_0.7.0/Vbsa.efi',
34 + '80f37d2fb86d152d95dec4d05ff099c9e47ee8a89314268e08056b0e1359e1fa')
35 +
36 + ASSET_BSA_SHELL = Asset(
37 + 'https://github.com/ARM-software/sysarch-acs/raw/refs/heads/main'
38 + '/prebuilt_images/VBSA/v25.12_VBSA_0.7.0/Shell.efi',
39 + 'e526604f0d329b481c6a1f62f7a0db8ea24ce8178b2c6abda8e247425f38775c')
40 +
41 + def test_aarch64_vbsa_uefi_tests(self):
42 + """
43 + Launch the UEFI based VBSA test from an EFI file-system
44 + """
45 +
46 + self.vm.set_console()
47 +
48 + # virt machine wi
49 + self.set_machine('virt')
50 + self.vm.add_args('-M', 'virt,gic-version=max,virtualization=on')
51 + self.vm.add_args('-cpu', 'max', '-m', '1024')
52 +
53 + # We will use the QEMU firmware blobs to boot
54 + code_path = self.build_file('pc-bios', 'edk2-aarch64-code.fd')
55 + vars_source = self.build_file('pc-bios', 'edk2-arm-vars.fd')
56 + vars_path = self.scratch_file('vars.fd')
57 + shutil.copy(vars_source, vars_path)
58 +
59 + self.vm.add_args('-drive',
60 + f'if=pflash,format=raw,readonly=on,file={code_path}')
61 + self.vm.add_args('-drive', f'if=pflash,format=raw,file={vars_path}')
62 +
63 + # Build an EFI FAT32 file-system for the UEFI tests
64 + vbsa_efi = self.ASSET_VBSA_EFI.fetch()
65 + bsa_shell = self.ASSET_BSA_SHELL.fetch()
66 +
67 + img_path = self.scratch_file('vbsa.img')
68 + qemu_img = get_qemu_img(self)
69 + check_call([qemu_img, 'create', '-f', 'raw', img_path, '64M'],
70 + stdout=DEVNULL, stderr=DEVNULL)
71 +
72 + check_call(['mformat', '-i', img_path, '-v', 'VBSA', '::'],
73 + stdout=DEVNULL, stderr=DEVNULL)
74 +
75 + check_call(['mmd', '-i', img_path, '::/EFI'],
76 + stdout=DEVNULL, stderr=DEVNULL)
77 +
78 + check_call(['mmd', '-i', img_path, '::/EFI/BOOT'],
79 + stdout=DEVNULL, stderr=DEVNULL)
80 +
81 + check_call(['mcopy', '-i', img_path, bsa_shell,
82 + '::/EFI/BOOT/BOOTAA64.EFI'],
83 + stdout=DEVNULL, stderr=DEVNULL)
84 +
85 + check_call(['mcopy', '-i', img_path, vbsa_efi, '::/Vbsa.efi'],
86 + stdout=DEVNULL, stderr=DEVNULL)
87 +
88 + self.vm.add_args('-drive',
89 + f'file={img_path},format=raw,if=none,id=drive0')
90 + self.vm.add_args('-device', 'virtio-blk-pci,drive=drive0')
91 +
92 + self.vm.launch()
93 +
94 + # wait for EFI prompt
95 + self.wait_for_console_pattern('Shell>')
96 +
97 + # Start the VBSA tests
98 + ec_and_wait(self, "FS0:Vbsa.efi", 'VBSA Architecture Compliance Suite')
99 +
100 + # could we parse the summary somehow?
101 +
102 + self.wait_for_console_pattern('VBSA tests complete. Reset the system.')
103 +
104 +
105 +if __name__ == '__main__':
106 + QemuSystemTest.main()