[PATCH 7/7] tests/functional/hexagon: add arch_tests functional test

Brian Cain posted 7 patches 2 months ago
Maintainers: Brian Cain <brian.cain@oss.qualcomm.com>, Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>, Paolo Bonzini <pbonzini@redhat.com>, Thomas Huth <th.huth+qemu@posteo.eu>, "Philippe Mathieu-Daudé" <philmd@mailo.com>, "Daniel P. Berrangé" <berrange@redhat.com>, Fabiano Rosas <farosas@suse.de>, Laurent Vivier <lvivier@redhat.com>
There is a newer version of this series
[PATCH 7/7] tests/functional/hexagon: add arch_tests functional test
Posted by Brian Cain 2 months ago
Add new test cases from hexagon-arch-tests to exercise exceptions,
guest mode, interrupt steering, etc.

Signed-off-by: Brian Cain <brian.cain@oss.qualcomm.com>
---
 MAINTAINERS                                 |  1 +
 tests/functional/hexagon/meson.build        |  5 ++
 tests/functional/hexagon/test_arch_tests.py | 65 +++++++++++++++++++++
 tests/functional/meson.build                |  1 +
 4 files changed, 72 insertions(+)
 create mode 100644 tests/functional/hexagon/meson.build
 create mode 100755 tests/functional/hexagon/test_arch_tests.py

diff --git a/MAINTAINERS b/MAINTAINERS
index 8201e487000..a9b134b323e 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1361,6 +1361,7 @@ F: hw/hexagon/
 F: include/hw/hexagon/
 F: configs/devices/hexagon-softmmu/default.mak
 F: docs/system/hexagon/
+F: tests/functional/hexagon/
 F: docs/devel/hexagon-sys.rst
 
 LoongArch Machines
diff --git a/tests/functional/hexagon/meson.build b/tests/functional/hexagon/meson.build
new file mode 100644
index 00000000000..2b5a1a8f264
--- /dev/null
+++ b/tests/functional/hexagon/meson.build
@@ -0,0 +1,5 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+tests_hexagon_system_thorough = [
+  'arch_tests',
+]
diff --git a/tests/functional/hexagon/test_arch_tests.py b/tests/functional/hexagon/test_arch_tests.py
new file mode 100755
index 00000000000..008822d5e5b
--- /dev/null
+++ b/tests/functional/hexagon/test_arch_tests.py
@@ -0,0 +1,65 @@
+#!/usr/bin/env python3
+#
+# Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
+#
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+import os
+from qemu_test import QemuSystemTest, Asset
+from qemu_test.cmd import wait_for_console_pattern
+
+
+class ArchTestsUart(QemuSystemTest):
+    """
+    Hexagon architecture verification tests
+
+    These are bare-metal tests from hexagon-arch-tests that exercise
+    system functionality.
+
+    Tests output results via UART.
+    """
+    timeout = 60
+
+    ASSET_TARBALL = Asset(
+        "https://github.com/qualcomm/qemu-hexagon-testing/releases/"
+        "download/v0.2.5/arch_tests_uart.tar.gz",
+        "edb4f37b877a3a72a0e10920477458a43b40045d34398fee8cb763fefd342f4f",
+    )
+
+    def run_uart_test(self, test_name: str,
+                      machine: str = "virt") -> None:
+        """
+        Run an arch test binary and verify PASS via UART console output.
+        """
+        self.set_machine(machine)
+        self.archive_extract(self.ASSET_TARBALL)
+        target_bin = os.path.join(self.workdir,
+                                  'arch_tests_uart_package',
+                                  'bin', test_name)
+        self.vm.set_console()
+        self.set_vm_arg("-display", "none")
+        self.set_vm_arg("-kernel", target_bin)
+        self.vm.launch()
+        wait_for_console_pattern(self, "PASS")
+
+    def test_exceptions(self) -> None:
+        """Tests exception delivery for trap instructions, privilege
+        violations, and verifies SSR cause codes and ELR values.
+        """
+        self.run_uart_test("test_exceptions")
+
+    def test_guest_mode(self) -> None:
+        """Tests guest mode entry/exit via CCR configuration, verifying
+        GSR fields, GELR, and guest event vector table dispatch.
+        """
+        self.run_uart_test("test_guest_mode")
+
+    def test_int_steering(self) -> None:
+        """Tests interrupt steering via priority-based routing to
+        specific threads using STID priority and iassignw.
+        """
+        self.run_uart_test("test_int_steering")
+
+
+if __name__ == "__main__":
+    QemuSystemTest.main()
diff --git a/tests/functional/meson.build b/tests/functional/meson.build
index c158197c4b7..c7362dd00ef 100644
--- a/tests/functional/meson.build
+++ b/tests/functional/meson.build
@@ -14,6 +14,7 @@ subdir('aarch64')
 subdir('alpha')
 subdir('arm')
 subdir('avr')
+subdir('hexagon')
 subdir('hppa')
 subdir('i386')
 subdir('loongarch64')
-- 
2.34.1

Re: [PATCH 7/7] tests/functional/hexagon: add arch_tests functional test
Posted by Pierrick Bouvier 2 months ago
On 7/14/2026 8:51 AM, Brian Cain wrote:
> Add new test cases from hexagon-arch-tests to exercise exceptions,
> guest mode, interrupt steering, etc.
> 
> Signed-off-by: Brian Cain <brian.cain@oss.qualcomm.com>
> ---
>  MAINTAINERS                                 |  1 +
>  tests/functional/hexagon/meson.build        |  5 ++
>  tests/functional/hexagon/test_arch_tests.py | 65 +++++++++++++++++++++
>  tests/functional/meson.build                |  1 +
>  4 files changed, 72 insertions(+)
>  create mode 100644 tests/functional/hexagon/meson.build
>  create mode 100755 tests/functional/hexagon/test_arch_tests.py
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 8201e487000..a9b134b323e 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -1361,6 +1361,7 @@ F: hw/hexagon/
>  F: include/hw/hexagon/
>  F: configs/devices/hexagon-softmmu/default.mak
>  F: docs/system/hexagon/
> +F: tests/functional/hexagon/
>  F: docs/devel/hexagon-sys.rst
>  
>  LoongArch Machines
> diff --git a/tests/functional/hexagon/meson.build b/tests/functional/hexagon/meson.build
> new file mode 100644
> index 00000000000..2b5a1a8f264
> --- /dev/null
> +++ b/tests/functional/hexagon/meson.build
> @@ -0,0 +1,5 @@
> +# SPDX-License-Identifier: GPL-2.0-or-later
> +
> +tests_hexagon_system_thorough = [
> +  'arch_tests',
> +]
> diff --git a/tests/functional/hexagon/test_arch_tests.py b/tests/functional/hexagon/test_arch_tests.py
> new file mode 100755
> index 00000000000..008822d5e5b
> --- /dev/null
> +++ b/tests/functional/hexagon/test_arch_tests.py
> @@ -0,0 +1,65 @@
> +#!/usr/bin/env python3
> +#
> +# Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
> +#
> +# SPDX-License-Identifier: GPL-2.0-or-later
> +
> +import os
> +from qemu_test import QemuSystemTest, Asset
> +from qemu_test.cmd import wait_for_console_pattern
> +
> +
> +class ArchTestsUart(QemuSystemTest):
> +    """
> +    Hexagon architecture verification tests
> +
> +    These are bare-metal tests from hexagon-arch-tests that exercise
> +    system functionality.
> +
> +    Tests output results via UART.
> +    """
> +    timeout = 60
> +
> +    ASSET_TARBALL = Asset(
> +        "https://github.com/qualcomm/qemu-hexagon-testing/releases/"
> +        "download/v0.2.5/arch_tests_uart.tar.gz",
> +        "edb4f37b877a3a72a0e10920477458a43b40045d34398fee8cb763fefd342f4f",
> +    )
> +
> +    def run_uart_test(self, test_name: str,
> +                      machine: str = "virt") -> None:
> +        """
> +        Run an arch test binary and verify PASS via UART console output.
> +        """
> +        self.set_machine(machine)
> +        self.archive_extract(self.ASSET_TARBALL)
> +        target_bin = os.path.join(self.workdir,
> +                                  'arch_tests_uart_package',
> +                                  'bin', test_name)
> +        self.vm.set_console()
> +        self.set_vm_arg("-display", "none")
> +        self.set_vm_arg("-kernel", target_bin)
> +        self.vm.launch()
> +        wait_for_console_pattern(self, "PASS")
> +
> +    def test_exceptions(self) -> None:
> +        """Tests exception delivery for trap instructions, privilege
> +        violations, and verifies SSR cause codes and ELR values.
> +        """
> +        self.run_uart_test("test_exceptions")
> +
> +    def test_guest_mode(self) -> None:
> +        """Tests guest mode entry/exit via CCR configuration, verifying
> +        GSR fields, GELR, and guest event vector table dispatch.
> +        """
> +        self.run_uart_test("test_guest_mode")
> +
> +    def test_int_steering(self) -> None:
> +        """Tests interrupt steering via priority-based routing to
> +        specific threads using STID priority and iassignw.
> +        """
> +        self.run_uart_test("test_int_steering")
> +
> +
> +if __name__ == "__main__":
> +    QemuSystemTest.main()
> diff --git a/tests/functional/meson.build b/tests/functional/meson.build
> index c158197c4b7..c7362dd00ef 100644
> --- a/tests/functional/meson.build
> +++ b/tests/functional/meson.build
> @@ -14,6 +14,7 @@ subdir('aarch64')
>  subdir('alpha')
>  subdir('arm')
>  subdir('avr')
> +subdir('hexagon')
>  subdir('hppa')
>  subdir('i386')
>  subdir('loongarch64')

With the same comment that Daniel did on semihosting series:

Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>

Regards,
Pierrick