Skip to content

Commit 498d45a

Browse files
committed
scripts: qemu-run: add standard firmware ZTest execution flag
Added the '--test-fw-standard' execution path to the QEMU automation runner. This compiles a fully-functional baseline firmware topology (avoiding the isolated STANDALONE runtime) but still transparently links the ZTest executable blocks so they can trigger via the standard IPC boot hook. Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
1 parent c9f22a1 commit 498d45a

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

scripts/sof-qemu-run.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ def main():
8484
parser.add_argument("--interactive", action="store_true", help="Drop into the interactive QEMU monitor after execution completes instead of quitting natively.")
8585
parser.add_argument("--qemu-d", default="in_asm,nochain,int", help="Options to pass to QEMU's -d flag. Defaults to 'in_asm,nochain,int'.")
8686
parser.add_argument("--ztest", action="store_true", help="Automatically compile the firmware image with ztest_overlay.conf prior to booting.")
87+
parser.add_argument("--test-fw-standard", action="store_true", help="Build a fully standard firmware image but forcibly natively attach test suite blocks into the OS IPC boot handler hook (circumventing standard isolated boot modes).")
8788
parser.add_argument("--rebuild", action="store_true", help="Rebuild the firmware before running; otherwise, assumes firmware is already built.")
8889
parser.add_argument("--timeout", type=float, default=5.0, help="Seconds to wait after the last log event before dumping registers (default: 5.0).")
8990
parser.add_argument("--cores", type=int, default=None, help="Number of SMP cores to emulate in QEMU.")
@@ -143,6 +144,22 @@ def main():
143144
print("\033[32;1m[sof-qemu-run] Compilation Successful.\033[0m\n")
144145
else:
145146
print("\033[32;1m[sof-qemu-run] Skipping compilation/rebuild, using previously generated binaries.\033[0m\n")
147+
elif args.test_fw_standard:
148+
print("\n\033[32;1m[sof-qemu-run] STANDARD FIRMWARE + ZTEST ENABLED: Tests attached to normal IPC boot hook without standalone overlay limits.\033[0m")
149+
if args.rebuild:
150+
print("\033[32;1m[sof-qemu-run] Recompiling standard Zephyr firmware natively alongside unit testing modules...\033[0m")
151+
# Inject standard rimage build directory directly into PATH so `west sign` mathematically authenticates Zephyr.elf into Zephyr.ri directly seamlessly.
152+
sof_workspace = os.environ.get("SOF_WORKSPACE", os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..")))
153+
optional_rimage_path = os.path.join(sof_workspace, "build-rimage")
154+
if os.path.isdir(optional_rimage_path) and optional_rimage_path not in os.environ.get("PATH", ""):
155+
os.environ["PATH"] = f"{optional_rimage_path}{os.pathsep}{os.environ.get('PATH', '')}"
156+
print(f"[sof-qemu-run] Injected Rimage Path: {optional_rimage_path}")
157+
158+
# Force fully-functional topology builds by injecting testing parameters strictly via commandline arguments natively
159+
subprocess.run([west_path, "build", "-d", build_dir, "-p", "auto", "--", "-DCONFIG_SOF_BOOT_TEST=y", "-DCONFIG_ZTEST=y", "-DCONFIG_SOF_USERSPACE_LL=y", "-DCONFIG_COMP_SRC=y", "-DCONFIG_COMP_COPIER=y", "-DCONFIG_COMP_VOLUME=y", "-DCONFIG_COMP_MIXIN_MIXOUT=y", "-DCONFIG_MAX_THREAD_BYTES=4"], check=True)
160+
print("\033[32;1m[sof-qemu-run] Standard Compilation Successful.\033[0m\n")
161+
else:
162+
print("\033[32;1m[sof-qemu-run] Skipping compilation/rebuild, using previously generated binaries.\033[0m\n")
146163

147164
# Determine execution command
148165
runs = []

0 commit comments

Comments
 (0)