@samitouri / QOSamiQemu / commits / 260d15c45b

tests/functional/hexagon: add arch_tests functional test

Add new test cases from hexagon-arch-tests to exercise exceptions, guest mode. Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com> Signed-off-by: Brian Cain <brian.cain@oss.qualcomm.com>

Brian Cain committed Jul 16, 2026 at 12:15 UTC 260d15c45b938511ade1992d7ff3efe47b7519bf
4 files changed +64
MAINTAINERS
+1
@@ -1357,6 +1357,7 @@ F: hw/hexagon/
1357 F: include/hw/hexagon/
1358 F: configs/devices/hexagon-softmmu/default.mak
1359 F: docs/system/hexagon/
1360 +F: tests/functional/hexagon/
1361 F: docs/devel/hexagon-sys.rst
1362
1363 LoongArch Machines
tests/functional/hexagon/meson.build new
+5
@@ -0,0 +1,5 @@
1 +# SPDX-License-Identifier: GPL-2.0-or-later
2 +
3 +tests_hexagon_system_thorough = [
4 + 'arch_tests',
5 +]
tests/functional/hexagon/test_arch_tests.py new
+57
@@ -0,0 +1,57 @@
1 +#!/usr/bin/env python3
2 +#
3 +# Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
4 +#
5 +# SPDX-License-Identifier: GPL-2.0-or-later
6 +
7 +from qemu_test import QemuSystemTest, Asset
8 +from qemu_test.cmd import wait_for_console_pattern
9 +
10 +
11 +class ArchTestsUart(QemuSystemTest):
12 + """
13 + Hexagon architecture verification tests
14 +
15 + These are bare-metal tests from hexagon-arch-tests that exercise
16 + system functionality.
17 +
18 + Tests output results via UART.
19 + """
20 + timeout = 60
21 +
22 + ASSET_TARBALL = Asset(
23 + "https://github.com/qualcomm/qemu-hexagon-testing/releases/"
24 + "download/v0.2.5/arch_tests_uart.tar.gz",
25 + "edb4f37b877a3a72a0e10920477458a43b40045d34398fee8cb763fefd342f4f",
26 + )
27 +
28 + def run_uart_test(self, test_name: str,
29 + machine: str = "virt") -> None:
30 + """
31 + Run an arch test binary and verify PASS via UART console output.
32 + """
33 + self.set_machine(machine)
34 + self.archive_extract(self.ASSET_TARBALL)
35 + target_bin = self.scratch_file('arch_tests_uart_package',
36 + 'bin', test_name)
37 + self.vm.set_console()
38 + self.set_vm_arg("-display", "none")
39 + self.set_vm_arg("-kernel", target_bin)
40 + self.vm.launch()
41 + wait_for_console_pattern(self, "PASS")
42 +
43 + def test_exceptions(self) -> None:
44 + """Tests exception delivery for trap instructions, privilege
45 + violations, and verifies SSR cause codes and ELR values.
46 + """
47 + self.run_uart_test("test_exceptions")
48 +
49 + def test_guest_mode(self) -> None:
50 + """Tests guest mode entry/exit via CCR configuration, verifying
51 + GSR fields, GELR, and guest event vector table dispatch.
52 + """
53 + self.run_uart_test("test_guest_mode")
54 +
55 +
56 +if __name__ == "__main__":
57 + QemuSystemTest.main()
tests/functional/meson.build
+1
@@ -14,6 +14,7 @@ subdir('aarch64')
14 subdir('alpha')
15 subdir('arm')
16 subdir('avr')
17 +subdir('hexagon')
18 subdir('hppa')
19 subdir('i386')
20 subdir('loongarch64')