On Tue, 14 Jul 2026 09:25:08 +0100 Daniel =?utf-8?B?UC4gQmVycmFuZ8Op?= <[email protected]> wrote: > > On Mon, Jul 13, 2026 at 01:07:22PM -0700, Matheus Tavares Bernardino wrote: > > > > --- /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....
I'll use self.scratch_file, like you suggested below, thanks. > > + > > + > > +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. Our test kernels from systests_standalone.tar.gz expect the files to be in the current working directory. But if changing dir is not advisable, I'll modify the binaries to receive the paths from argv. > > [...] > > + 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 ?!?!?? It access the file through semihost, which exposes host I/O to the guest. This functional test strives to validate that. > > [..] > > + 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") The test[1] checks that qemu's hexagon semihosting can traverse the directory to list the files, so we create a new directory to control exactly which entries will be in it. [1]: https://github.com/qualcomm/qemu-hexagon-testing/blob/c0f407d429dd26b453174a5a61082fe5ffdb8d2a/standalone_systests/src/semihost.c#L240
