From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Matheus Tavares Bernardino <matheus.bernardino@oss.qualcomm.com>
Cc: qemu-devel@nongnu.org, brian.cain@oss.qualcomm.com,
pierrick.bouvier@oss.qualcomm.com, marco.liebel@oss.qualcomm.com,
philmd@oss.qualcomm.com, ale@rev.ng, anjo@rev.ng,
"Thomas Huth" <th.huth+qemu@posteo.eu>,
"Philippe Mathieu-Daudé" <philmd@mailo.com>
Subject: Re: [PATCH 14/14] tests/functional: Add hexagon semihosting systests
Date: Tue, 14 Jul 2026 09:25:08 +0100 [thread overview]
Message-ID: <alXyZCtBmMecWdf1@redhat.com> (raw)
In-Reply-To: <da280da8fec576b2cc59e7bf48a2845312ee50cc.1783973054.git.matheus.bernardino@oss.qualcomm.com>
On Mon, Jul 13, 2026 at 01:07:22PM -0700, Matheus Tavares Bernardino wrote:
> From: Brian Cain <brian.cain@oss.qualcomm.com>
>
> Signed-off-by: Brian Cain <brian.cain@oss.qualcomm.com>
> Signed-off-by: Matheus Tavares Bernardino <matheus.bernardino@oss.qualcomm.com>
> ---
> tests/functional/hexagon/meson.build | 9 ++
> tests/functional/hexagon/test_systests.py | 133 ++++++++++++++++++++++
> tests/functional/meson.build | 1 +
> 3 files changed, 143 insertions(+)
> create mode 100644 tests/functional/hexagon/meson.build
> create mode 100644 tests/functional/hexagon/test_systests.py
>
> diff --git a/tests/functional/hexagon/meson.build b/tests/functional/hexagon/meson.build
> new file mode 100644
> index 00000000000..6cd684b0df7
> --- /dev/null
> +++ b/tests/functional/hexagon/meson.build
> @@ -0,0 +1,9 @@
> +# SPDX-License-Identifier: GPL-2.0-or-later
> +
> +test_hexagon_timeouts = {
> + 'systests': 180,
> +}
> +
> +tests_hexagon_system_thorough = [
> + 'systests',
> +]
> diff --git a/tests/functional/hexagon/test_systests.py b/tests/functional/hexagon/test_systests.py
> new file mode 100644
> index 00000000000..b20b9fc56cc
Test files should have execute permissions.
> --- /dev/null
> +++ b/tests/functional/hexagon/test_systests.py
> @@ -0,0 +1,133 @@
> +#!/usr/bin/env python3
> +#
> +# Copyright(c) Qualcomm Innovation Center, Inc. All Rights Reserved.
> +#
> +# SPDX-License-Identifier: GPL-2.0-or-later
> +
> +import os
> +import re
> +import time
> +import unittest
> +
> +from qemu_test import QemuSystemTest, Asset, wait_for_console_pattern
> +
> +
> +_TARBALL_BIN_PATH = os.path.join(
> + "systests_standalone_package",
> + "StandaloneSysTests_6.4.0.2_v68",
> + "bin",
> +)
Don't use os.path.join to refer to files needed by the test
suite - always use one of the helper methods on the QemuBaseTest
class....
> +
> +
> +class SysTestsStandaloneTests(QemuSystemTest):
> + SYSTEST_TIMEOUT_SEC = 30
> +
> + ASSET_TARBALL = Asset(
> + "https://github.com/qualcomm/qemu-hexagon-testing/releases/download/v0.2.9/systests_standalone.tar.gz",
> + "db961ea3fcc389b478b3d5c2f3bac60bec87e7f3d7efef5e58a9ae8ee78d0e40",
> + )
> +
> + def setUp(self):
> + super().setUp()
> + self.archive_extract(self.ASSET_TARBALL)
> + self.bin_dir = os.path.join(self.workdir, _TARBALL_BIN_PATH)
...so also skip this...
> + self._orig_cwd = os.getcwd()
> + os.chdir(self.workdir)
> + self.addCleanup(os.chdir, self._orig_cwd)
Don't change directory during tests - use properly qualified paths
to files.
> +
> + def tearDown(self):
> + if hasattr(self, "_orig_cwd"):
> + os.chdir(self._orig_cwd)
> + super().tearDown()
> +
> + def binary(self, name):
> + """Return the full path to binary *name* inside bin_dir."""
> + return os.path.join(self.bin_dir, name)
This should be just:
return self.scratch_file("systests_standalone_package",
"StandaloneSysTests_6.4.0.2_v68", "bin", name)
> +
> + def run_exit_zero(self, binary_name, *extra_args, machine="V66G_1024"):
> + """Launch *binary_name* and assert it exits with code 0.
> +
> + :param binary_name: name of the binary inside bin_dir.
> + :param extra_args: optional pairs of (flag, value) strings passed
> + to set_vm_arg(), e.g. ('-append', 'myarg').
> + :param machine: QEMU machine type (default "V66G_1024").
> + """
> + self.set_machine(machine)
> + self.set_vm_arg("-display", "none")
> + self.set_vm_arg("-kernel", self.binary(binary_name))
> + for flag, value in zip(extra_args[::2], extra_args[1::2]):
> + self.set_vm_arg(flag, value)
> + self.vm.launch()
> + self.vm.wait(timeout=60.0)
> + self.assertEqual(self.vm.exitcode(), 0,
> + f"Test {binary_name} exited with "
> + f"code {self.vm.exitcode()}, expected 0")
> +
> + def run_console_pattern(self, binary_name, pattern, *extra_args,
> + machine="V66G_1024"):
> + """Launch *binary_name* and wait for *pattern* on the semihosting console.
> +
> + :param binary_name: name of the binary inside bin_dir.
> + :param pattern: string pattern to wait for via wait_for_console_pattern.
> + :param extra_args: optional pairs of (flag, value) strings passed
> + to set_vm_arg(), e.g. ('-append', 'myarg').
> + :param machine: QEMU machine type (default "V66G_1024").
> + """
> + self.set_machine(machine)
> + self.set_vm_arg("-display", "none")
> + self.set_vm_arg("-kernel", self.binary(binary_name))
> + for flag, value in zip(extra_args[::2], extra_args[1::2]):
> + self.set_vm_arg(flag, value)
> + self.vm.set_console(semihosting=True)
> + self.vm.launch()
> + try:
> + wait_for_console_pattern(self, pattern)
> + finally:
> + self.vm.kill()
> +
> + def test_fopen(self):
> + """fopen reads a file passed via --append and verifies its contents."""
> + with open(os.path.join(self.workdir, "dummy.so"), "w") as f:
self.scratch_file("dummy.so")
> + f.write("valid\n")
> + self.run_exit_zero("fopen", "-append", "dummy.so")
How is this working ? You've created a file dummy.so on the host OS,
and you're passing a filename "dummy.so" to -append which is a kernel
arg. The implication is the kenrel opens this file, but how is the guest
kernel accessing the file from the host ?!?!??
> +
> + def test_ftrunc(self):
> + """ftrunc truncates _testfile_ftrunc from 6 bytes to 1 byte."""
> + ftrunc_path = os.path.join(self.workdir, "_testfile_ftrunc")
self.scratch_file("_testfile_ftrunc")
> + with open(ftrunc_path, "w") as f:
> + f.write("valid\n")
> + # Sleep 1 s so mtime change is observable
> + time.sleep(1)
> + self.run_exit_zero("ftrunc")
> + self.assertEqual(
> + os.path.getsize(ftrunc_path),
> + 1,
> + "_testfile_ftrunc should be 1 byte after ftrunc",
> + )
> +
> + def test_dirent(self):
> + """dirent lists a directory passed via --append; output must be
> + '. .. fileA fileB'."""
> + dirent_dir = os.path.join(self.workdir, "_dirent_testdir")
self.scratch_file("_dirent_testdir")
> + os.makedirs(dirent_dir, exist_ok=True)
> + open(os.path.join(dirent_dir, "fileA"), "w").close()
> + open(os.path.join(dirent_dir, "fileB"), "w").close()
self.scratch_file("_dirent_testdir", "fileA")
> + self.run_console_pattern(
> + "dirent", ". .. fileA fileB", "-append", "_dirent_testdir"
Again I'm wondering how the guest OS accesses _dirent_testdir which
is a location on the host OS ?
> + )
> +
> + def test_access(self):
> + """access checks R_OK|W_OK on _testfile_access."""
> + with open(os.path.join(self.workdir, "_testfile_access"), "w") as f:
> + f.write("valid\n")
self.scratch_file("_testfile_access")
> + self.run_exit_zero("access")
> +
> + def test_semihost(self):
> + semihost_dir = os.path.join(self.workdir, "_semihost_dir")
> + os.makedirs(semihost_dir, exist_ok=True)
> + open(os.path.join(semihost_dir, "fileA"), "w").close()
> + open(os.path.join(semihost_dir, "fileB"), "w").close()
The intermediate dir feels redunddant - why not just create fileA & fileB
directly ? ie
self.scratch_file("fileA")
self.scratch_file("fileB")
> + self.run_console_pattern("semihost", "PASS", "-append", "arg1", "arg2")
> +
> +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.37.2
>
With regards,
Daniel
--
|: https://berrange.com ~~ https://hachyderm.io/@berrange :|
|: https://libvirt.org ~~ https://entangle-photo.org :|
|: https://pixelfed.art/berrange ~~ https://fstop138.berrange.com :|
next prev parent reply other threads:[~2026-07-14 8:25 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-13 20:07 [PATCH 00/14] hexagon: add semihosting support Matheus Tavares Bernardino
2026-07-13 20:07 ` [PATCH 01/14] target/hexagon: fix get_phys_addr_debug with in-page offset Matheus Tavares Bernardino
2026-07-13 21:41 ` Pierrick Bouvier
2026-07-13 20:07 ` [PATCH 02/14] target/hexagon: fix PC advancement for non-COF TB terminators Matheus Tavares Bernardino
2026-07-13 21:53 ` Pierrick Bouvier
2026-07-13 20:07 ` [PATCH 03/14] target/hexagon: add aux functions for guest mem load/store Matheus Tavares Bernardino
2026-07-13 21:58 ` Pierrick Bouvier
2026-07-14 10:17 ` Matheus Tavares Bernardino
2026-07-13 20:07 ` [PATCH 04/14] hexagon: cpu_helper: add reg reading/writing helpers Matheus Tavares Bernardino
2026-07-13 22:00 ` Pierrick Bouvier
2026-07-13 20:07 ` [PATCH 05/14] semihosting: add callback to set error Matheus Tavares Bernardino
2026-07-13 22:01 ` Pierrick Bouvier
2026-07-14 9:50 ` Daniel Henrique Barboza
2026-07-14 10:00 ` Matheus Tavares Bernardino
2026-07-13 20:07 ` [PATCH 06/14] semihosting: add APIs for chardev-aware guest fd routing Matheus Tavares Bernardino
2026-07-13 22:04 ` Pierrick Bouvier
2026-07-13 20:07 ` [PATCH 07/14] target/hexagon: add semihosting support Matheus Tavares Bernardino
2026-07-13 22:11 ` Pierrick Bouvier
2026-07-14 10:13 ` Matheus Tavares Bernardino
2026-07-13 20:07 ` [PATCH 08/14] semihosting: add ftruncate helper (to be used for hexagon) Matheus Tavares Bernardino
2026-07-13 22:12 ` Pierrick Bouvier
2026-07-13 20:07 ` [PATCH 09/14] target/hexagon: add main arch-specific semihosting operations Matheus Tavares Bernardino
2026-07-13 22:20 ` Pierrick Bouvier
2026-07-14 10:10 ` Matheus Tavares Bernardino
2026-07-13 20:07 ` [PATCH 10/14] target/hexagon: add COREDUMP semihosting operation Matheus Tavares Bernardino
2026-07-13 22:22 ` Pierrick Bouvier
2026-07-13 20:07 ` [PATCH 11/14] target/hexagon: add OPEN/READ/CLOSE_DIR semihosting operations Matheus Tavares Bernardino
2026-07-13 22:33 ` Pierrick Bouvier
2026-07-13 20:07 ` [PATCH 12/14] target/hexagon: Add an errno mapping Matheus Tavares Bernardino
2026-07-13 22:23 ` Pierrick Bouvier
2026-07-13 20:07 ` [PATCH 13/14] python/machine: support routing semihosting output to the test console Matheus Tavares Bernardino
2026-07-13 22:23 ` Pierrick Bouvier
2026-07-13 20:07 ` [PATCH 14/14] tests/functional: Add hexagon semihosting systests Matheus Tavares Bernardino
2026-07-13 22:28 ` Pierrick Bouvier
2026-07-14 10:28 ` Matheus Tavares Bernardino
2026-07-14 8:25 ` Daniel P. Berrangé [this message]
2026-07-14 18:58 ` Matheus Tavares Bernardino
2026-07-13 21:51 ` [PATCH 00/14] hexagon: add semihosting support Pierrick Bouvier
2026-07-14 18:55 ` Brian Cain
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alXyZCtBmMecWdf1@redhat.com \
--to=berrange@redhat.com \
--cc=ale@rev.ng \
--cc=anjo@rev.ng \
--cc=brian.cain@oss.qualcomm.com \
--cc=marco.liebel@oss.qualcomm.com \
--cc=matheus.bernardino@oss.qualcomm.com \
--cc=philmd@mailo.com \
--cc=philmd@oss.qualcomm.com \
--cc=pierrick.bouvier@oss.qualcomm.com \
--cc=qemu-devel@nongnu.org \
--cc=th.huth+qemu@posteo.eu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.