blob: 54a1412c5972d39ae15435e5a8fd702c60d2d9e7 [file]
#!/usr/bin/env python3
#
# Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
#
# SPDX-License-Identifier: GPL-2.0-or-later
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 = self.scratch_file('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")
if __name__ == "__main__":
QemuSystemTest.main()