From 3d910f1f63e10accf3e5b1b1cb59c757aef819ac Mon Sep 17 00:00:00 2001 From: MoonEyes <14891700+MoonEyes@users.noreply.github.com> Date: Wed, 25 Nov 2026 11:09:49 +0100 Subject: [PATCH] test_lds_src2: feed llvm-mc through stdin, so a WSL LLVM_MC can read it (TEST-LDS-SRC2-MC-STDIN) assemble() wrote the listing to a temporary file and passed its path to llvm-mc. With LLVM_MC set to the WSL form tools/mc_command.py documents (wsl -d Ubuntu -e /usr/lib/llvm-21/bin/llvm-mc), llvm-mc runs inside WSL and cannot open the Windows path, so every EncodingTests subtest failed ("No such file or directory") instead of checking the encodings. It now reads stdin, as tools/shader_disasm.py does; the text is ASCII either way. Co-Authored-By: Claude Opus 5.5 --- tests/semantic/test_lds_src2.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/tests/semantic/test_lds_src2.py b/tests/semantic/test_lds_src2.py index 74adc4f9a2..7c28e9ea9d 100644 --- a/tests/semantic/test_lds_src2.py +++ b/tests/semantic/test_lds_src2.py @@ -22,7 +22,6 @@ import struct import subprocess import sys -import tempfile import unittest sys.dont_write_bytecode = True @@ -88,13 +87,13 @@ def _llvm_mc(): def assemble(cpu, text): - """(returncode, stdout, stderr) of llvm-mc assembling `text` for `cpu`, through a file (no BOM, no pipe).""" - with tempfile.TemporaryDirectory() as tmp: - path = os.path.join(tmp, "in.s") - with open(path, "w", encoding="ascii", newline="\n") as f: - f.write(text) - r = subprocess.run(MC + ["-triple=amdgcn", f"-mcpu={cpu}", "-show-encoding", path], - capture_output=True, text=True, timeout=60) + """(returncode, stdout, stderr) of llvm-mc assembling `text` for `cpu`, read from stdin. + + Not through a temporary file: LLVM_MC can be a WSL command (`wsl -d Ubuntu -e /usr/lib/llvm-21/bin/llvm-mc`, see + tools/mc_command.py), and llvm-mc inside WSL cannot open a Windows path. tools/shader_disasm.py feeds llvm-mc + the same way.""" + r = subprocess.run(MC + ["-triple=amdgcn", f"-mcpu={cpu}", "-show-encoding"], input=text, + capture_output=True, text=True, encoding="ascii", errors="replace", timeout=60) return r.returncode, r.stdout, r.stderr