diff options
| author | Romain PINSOLLE <romain.pins@gmail.com> | 2026-11-24 10:55:40 +0100 |
|---|---|---|
| committer | Romain PINSOLLE <romain.pins@gmail.com> | 2026-11-24 10:55:40 +0100 |
| commit | 078d0144ada566d48b93f7dd15174d83c6043c07 (patch) | |
| tree | 4b578051f635ecbd1eac1abad66eeff1d22945e3 /scripts/run_gpu_tests.py | |
| parent | 21625bca8c675c62f9dbffc318ce6a59d57faf31 (diff) | |
run_gpu_tests: report a missing spirv-as instead of a traceback (RUN-GPU-SPIRVAS-MISSING)
spirv_as ran spirv-as without handling OSError, so a missing spirv-as
ended the run with a raw FileNotFoundError after the assemble and
translate steps. It now raises the RuntimeError a failed assembly
already raises, with "spirv-as not found on PATH" (or the OSError text
for other failures to start the tool).
Tests cover the missing-tool and other-OSError messages, a stubbed
successful run, and a nonzero exit with stderr.
Diffstat (limited to 'scripts/run_gpu_tests.py')
| -rw-r--r-- | scripts/run_gpu_tests.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/scripts/run_gpu_tests.py b/scripts/run_gpu_tests.py index a075c876a..936ae639c 100644 --- a/scripts/run_gpu_tests.py +++ b/scripts/run_gpu_tests.py | |||
| @@ -149,8 +149,13 @@ def spirv_as(asm_text: str, out_spv: str, assembler: str = "spirv-as") -> None: | |||
| 149 | with open(out_spv, "wb") as f: | 149 | with open(out_spv, "wb") as f: |
| 150 | f.write(spv_bytes) | 150 | f.write(spv_bytes) |
| 151 | return | 151 | return |
| 152 | p = subprocess.run(["spirv-as", "--target-env", "vulkan1.2", "-o", out_spv, "-"], | 152 | try: |
| 153 | input=asm_text, capture_output=True, text=True) | 153 | p = subprocess.run(["spirv-as", "--target-env", "vulkan1.2", "-o", out_spv, "-"], |
| 154 | input=asm_text, capture_output=True, text=True) | ||
| 155 | except FileNotFoundError: | ||
| 156 | raise RuntimeError("spirv-as not found on PATH (use --assembler python to assemble with tools/spirv_asm.py)") from None | ||
| 157 | except OSError as exc: | ||
| 158 | raise RuntimeError(f"spirv-as could not be started: {exc.strerror or exc}") from None | ||
| 154 | if p.returncode != 0: | 159 | if p.returncode != 0: |
| 155 | raise RuntimeError(f"spirv-as failed for {out_spv}:\n{p.stderr}") | 160 | raise RuntimeError(f"spirv-as failed for {out_spv}:\n{p.stderr}") |
| 156 | 161 | ||