run_gpu_tests: report a missing spirv-as instead of a traceback (RUN-GPU-SPIRVAS-MISSING) #614

Manually merged
github merged 1 commit from gh-pr/614/head into gh-pr/614/base 2026-11-26 09:11:49 +00:00
Owner

@⁠TuroYT on GitHub · 2026-11-24 09:56 UTC · original
TuroYT:fix/run-gpu-spirvas-missing → main · +46 −2 · 2 files · 1 commits · merged 2026-11-24 12:43 UTC

Claimed in the coordination issue as: RUN-GPU-SPIRVAS-MISSING (#14)

What was wrong. spirv_as in scripts/run_gpu_tests.py (line ~152) ran spirv-as without an OSError handler. With no spirv-as on PATH, the three calls in run_suite (around line 942) ended the run with a raw FileNotFoundError traceback, after the assemble and translate steps.

What changed. spirv_as now turns the OSError into a RuntimeError, the type a failed assembly already raises:

  • FileNotFoundError: spirv-as not found on PATH (use --assembler python to assemble with tools/spirv_asm.py)
  • other OSError: spirv-as could not be started: <strerror>

Nothing else changed. The callers do not catch RuntimeError either (see the gap below).

Tests. Two new tests in tests/test_run_gpu_tests_python_assembler.py for the two messages, plus two guards for the existing behaviour (stubbed successful run, nonzero exit with stderr).

Tested:

  • python3 -I tests/test_run_gpu_tests_python_assembler.py: 10 tests OK. On unfixed main: the two new OSError tests ERROR, the other 8 pass.
  • python3 -I tests/test_run_gpu_tests.py: 64 OK. The other tests/test_run_gpu_*.py files: OK.
  • Reproduction with PATH=/nonexistent: before, FileNotFoundError: [Errno 2] ... 'spirv-as'; after, RuntimeError: spirv-as not found on PATH (use --assembler python to assemble with tools/spirv_asm.py).
  • Fake spirv-as exiting 3: RuntimeError carrying its stderr, as before.
  • Fake spirv-as exiting 0 with empty input: no exception.
  • Real spirv-as with empty input: RuntimeError with spirv-as's own message, as before.
  • Non-executable spirv-as on PATH: spirv-as could not be started: Permission denied.
  • python3 -I scripts/check_no_game_data.py on the two changed files: clean.
  • python3 -m compileall -q scripts tests: clean.

Not tested: a real GPU run; a full run_suite with a built runtime and game work folder; Windows, where spirv-as.exe lookup goes through the same code path but was not run.

Known gap, left for a decision. run_suite does not catch RuntimeError, so a missing spirv-as still ends in a traceback. Its last line is now the readable message, the same as a failed assembly today. Catching it in run_suite would change the exit path for every assembly failure, so it is not in this PR.

AI-assisted (Claude Code).

**@⁠TuroYT** on GitHub · 2026-11-24 09:56 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/614) `TuroYT:fix/run-gpu-spirvas-missing` → `main` · +46 −2 · 2 files · 1 commits · merged 2026-11-24 12:43 UTC Claimed in the coordination issue as: RUN-GPU-SPIRVAS-MISSING (https://git.gtahub.st/github/ubiquitarianism--leonida/issues/14) **What was wrong.** `spirv_as` in `scripts/run_gpu_tests.py` (line ~152) ran `spirv-as` without an `OSError` handler. With no `spirv-as` on PATH, the three calls in `run_suite` (around line 942) ended the run with a raw `FileNotFoundError` traceback, after the assemble and translate steps. **What changed.** `spirv_as` now turns the `OSError` into a `RuntimeError`, the type a failed assembly already raises: - `FileNotFoundError`: `spirv-as not found on PATH (use --assembler python to assemble with tools/spirv_asm.py)` - other `OSError`: `spirv-as could not be started: <strerror>` Nothing else changed. The callers do not catch `RuntimeError` either (see the gap below). **Tests.** Two new tests in `tests/test_run_gpu_tests_python_assembler.py` for the two messages, plus two guards for the existing behaviour (stubbed successful run, nonzero exit with stderr). **Tested:** - `python3 -I tests/test_run_gpu_tests_python_assembler.py`: 10 tests OK. On unfixed `main`: the two new OSError tests ERROR, the other 8 pass. - `python3 -I tests/test_run_gpu_tests.py`: 64 OK. The other `tests/test_run_gpu_*.py` files: OK. - Reproduction with `PATH=/nonexistent`: before, `FileNotFoundError: [Errno 2] ... 'spirv-as'`; after, `RuntimeError: spirv-as not found on PATH (use --assembler python to assemble with tools/spirv_asm.py)`. - Fake `spirv-as` exiting 3: `RuntimeError` carrying its stderr, as before. - Fake `spirv-as` exiting 0 with empty input: no exception. - Real `spirv-as` with empty input: `RuntimeError` with spirv-as's own message, as before. - Non-executable `spirv-as` on PATH: `spirv-as could not be started: Permission denied`. - `python3 -I scripts/check_no_game_data.py` on the two changed files: clean. - `python3 -m compileall -q scripts tests`: clean. **Not tested:** a real GPU run; a full `run_suite` with a built runtime and game work folder; Windows, where `spirv-as.exe` lookup goes through the same code path but was not run. **Known gap, left for a decision.** `run_suite` does not catch `RuntimeError`, so a missing `spirv-as` still ends in a traceback. Its last line is now the readable message, the same as a failed assembly today. Catching it in `run_suite` would change the exit path for every assembly failure, so it is not in this PR. AI-assisted (Claude Code).
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.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:11:47 +00:00
github manually merged commit 078d0144ad into gh-pr/614/base 2026-11-26 09:11:49 +00:00
Author
Owner

@⁠GeorgiyDemo on GitHub · 2026-11-24 11:18 UTC · original

Tested 078d0144 on Apple M5 Pro, macOS 26.7.3 (25G342), with spirv-as removed from PATH:

  • python3 -I tests/test_run_gpu_tests_python_assembler.py: 10 tests OK at this head.
  • I could not reach the changed line from the CLI here. With --assembler auto (the default) and no spirv-as on PATH, run_gpu_tests.py --filter ps_tex falls back to tools/spirv_asm.py and the run completes: 12/12 passed, on main and on this head.
  • With --assembler spirv-as and no spirv-as on PATH, both revisions stop earlier, in rdna2spirv.py, with ERROR: spirv-as not found; install SPIRV-Tools (spirv-as, spirv-val) and put it on PATH, before spirv_as in the runner is called.

So on this setup the new OSError guard is only exercised by the unit tests; that is not a defect in the change, but the traceback it replaces was not reachable by either path here. Binaries from main, no rebuild.

AI-assisted; synthetic fixtures only, no game data.

**@⁠GeorgiyDemo** on GitHub · 2026-11-24 11:18 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/614#issuecomment-7129931242) Tested `078d0144` on Apple M5 Pro, macOS 26.7.3 (25G342), with `spirv-as` removed from `PATH`: - `python3 -I tests/test_run_gpu_tests_python_assembler.py`: 10 tests OK at this head. - I could not reach the changed line from the CLI here. With `--assembler auto` (the default) and no `spirv-as` on `PATH`, `run_gpu_tests.py --filter ps_tex` falls back to `tools/spirv_asm.py` and the run completes: 12/12 passed, on `main` and on this head. - With `--assembler spirv-as` and no `spirv-as` on `PATH`, both revisions stop earlier, in `rdna2spirv.py`, with `ERROR: spirv-as not found; install SPIRV-Tools (spirv-as, spirv-val) and put it on PATH`, before `spirv_as` in the runner is called. So on this setup the new `OSError` guard is only exercised by the unit tests; that is not a defect in the change, but the traceback it replaces was not reachable by either path here. Binaries from `main`, no rebuild. AI-assisted; synthetic fixtures only, no game data.
Author
Owner

@⁠TuroYT on GitHub · 2026-11-24 11:21 UTC · original

Thanks for running it. I checked the code path and you are right: I overstated how reachable this is.

In run_suite, the translator step (rdna2spirv.py) runs unconditionally before the spirv_as calls and the run returns 1 if it fails, so with --assembler spirv-as and no spirv-as on PATH the run already stops there with a readable error. With --assembler auto, resolve_assembler picks the Python assembler when spirv-as is missing. The new OSError handler is only reached if spirv-as disappears between the translator step and the helper-shader step, or if the translator stops needing it. The traceback I described in the claim comes from calling spirv_as() directly with an empty PATH, not from a CLI run.

So this is defence in depth, not a user-visible fix. I could not run the full CLI path here (no built Vulkan test programs), so that part rests on reading the code and on your run. I am fine with this being closed if you would rather not carry the extra branch.

**@⁠TuroYT** on GitHub · 2026-11-24 11:21 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/614#issuecomment-7129985063) Thanks for running it. I checked the code path and you are right: I overstated how reachable this is. In `run_suite`, the translator step (`rdna2spirv.py`) runs unconditionally before the `spirv_as` calls and the run returns 1 if it fails, so with `--assembler spirv-as` and no `spirv-as` on PATH the run already stops there with a readable error. With `--assembler auto`, `resolve_assembler` picks the Python assembler when `spirv-as` is missing. The new `OSError` handler is only reached if `spirv-as` disappears between the translator step and the helper-shader step, or if the translator stops needing it. The traceback I described in the claim comes from calling `spirv_as()` directly with an empty PATH, not from a CLI run. So this is defence in depth, not a user-visible fix. I could not run the full CLI path here (no built Vulkan test programs), so that part rests on reading the code and on your run. I am fine with this being closed if you would rather not carry the extra branch.
Author
Owner

@⁠Dezmonius on GitHub · 2026-11-24 12:25 UTC · original

Independent Windows 10 check of 078d0144 on 21625bc, CPython 3.14.7. All 10 assembler tests and 64 runner tests passed. With the new assembler tests on the old runner, exactly the two new OSError cases failed as expected.

I exercised the late-failure path in run_suite with a synthetic translator-success stub. --assembler auto found a temporary spirv-as.exe on PATH, and the stub removed that file before the helper call. The real Windows subprocess lookup then raised FileNotFoundError (WinError 2) on main and the expected RuntimeError: spirv-as not found on PATH on the PR. A second run retained a deliberately invalid fixture named spirv-as.exe: WinError 216 on main became RuntimeError: spirv-as could not be started on the PR. In both PR cases the current caller still propagates the exception, consistent with the stated scope.

Synthetic fixtures only, no GPU or game files. AI-assisted (Codex).

**@⁠Dezmonius** on GitHub · 2026-11-24 12:25 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/614#issuecomment-7131424513) Independent Windows 10 check of `078d0144` on `21625bc`, CPython 3.14.7. All 10 assembler tests and 64 runner tests passed. With the new assembler tests on the old runner, exactly the two new OSError cases failed as expected. I exercised the late-failure path in `run_suite` with a synthetic translator-success stub. `--assembler auto` found a temporary `spirv-as.exe` on PATH, and the stub removed that file before the helper call. The real Windows subprocess lookup then raised `FileNotFoundError` (WinError 2) on main and the expected `RuntimeError: spirv-as not found on PATH` on the PR. A second run retained a deliberately invalid fixture named `spirv-as.exe`: WinError 216 on main became `RuntimeError: spirv-as could not be started` on the PR. In both PR cases the current caller still propagates the exception, consistent with the stated scope. Synthetic fixtures only, no GPU or game files. AI-assisted (Codex).
This discussion has been locked. Commenting is limited to contributors.
No description provided.