Skip to content

test_spirv_gs_to_compute: skip without llvm-mc and the SPIR-V tools, as the other translator tests do - #1418

Closed
etcetera-yt wants to merge 1 commit into
ItsNotRexed:mainfrom
etcetera-yt:gs-to-compute-requires-tools
Closed

etcetera-yt wants to merge 1 commit into
ItsNotRexed:mainfrom
etcetera-yt:gs-to-compute-requires-tools

Conversation

@etcetera-yt

Copy link
Copy Markdown
Contributor

Claimed in the coordination issue as: new TEST item (claim). No ID assigned yet.

What and why

tests/test_spirv_gs_to_compute.py (d1474ee, SHADER-159) assembles its shaders through conftest's Shader/make_shader, which builds cmd = LLVM_MC + [...] (tests/conftest.py:166). Without an llvm-mc, LLVM_MC is None. Every other translator test file skips then through requires_tools, but this one ended in a TypeError. On main c2967a5, on a Windows machine without llvm-mc:

FAILED tests/test_spirv_gs_to_compute.py::test_rejects_non_geometry - TypeError: unsupported operand ...
ERROR  tests/test_spirv_gs_to_compute.py::test_layout - TypeError ...
ERROR  tests/test_spirv_gs_to_compute.py::test_compute_module - TypeError ...
ERROR  tests/test_spirv_gs_to_compute.py::test_cli_writes_module_and_layout - TypeError ...
1 failed, 640 passed, 434 skipped, 3 errors        (the pytest files, tests/requirements.txt)

All four tests need llvm-mc and the SPIR-V tools, so the module gets pytestmark = requires_tools, as test_image_load_d16_typed.py and test_translate.py have. CI's translator job has the tools, so nothing changes there.

What's left: nothing.

Tested

Windows 10 19045, Python 3.14.7, pytest 9.2.0 (tests/requirements.txt), no llvm-mc or spirv-as/spirv-val installed (the case being fixed). CPU only; the machine's GPU is an NVIDIA GeForce RTX 5060 Ti, driver 621.14.

python -m pytest tests/test_spirv_gs_to_compute.py -q -rs
python -m pytest <every pytest-marked tests/test_*.py> -q
main c2967a5 this branch
test_spirv_gs_to_compute.py 1 failed, 3 errors (TypeError) 4 skipped: needs an llvm-mc built with the amdgcn target, and spirv-as/spirv-val on PATH ...
all pytest files 1 failed, 640 passed, 434 skipped, 3 errors 640 passed, 438 skipped
  • Negative control: with main's file put back, the file gives 1 failed, 3 errors again.

Not tested: the file with llvm-mc present (none here). With the tools, requires_tools is false and the tests run as before; CI covers that.

Checklist

  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (Not applicable: no translator change.)

AI-assisted (Claude Code).

🤖 Generated with Claude Code

…as the other translator tests do

Every test here assembles a shader through conftest's Shader, which
builds 'LLVM_MC + [...]'. Without an llvm-mc (LLVM_MC is None) that is a
TypeError, so on such a machine the file gave 1 failed and 3 errors where
the rest of the suite skips. Mark the module requires_tools, like
test_image_load_d16_typed.py.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@bobcatchris

Copy link
Copy Markdown
Contributor

Independent CPU verification, at head 6be13498 (merge base c2967a5e, current main bb2e1842):

  • Normal toolchain: tests/test_spirv_gs_to_compute.py 4 passed on the PR and 4 passed on current main; compileall -q tools tests clean. No behavior change when the tools are present.
  • No-tools control: with PATH restricted so llvm-mc/spirv-as/spirv-val are absent, the PR cleanly skips 4/4, while main's original test file gives 1 failed, 3 errors — TypeError: unsupported operand type(s) for +: 'NoneType' and 'list' from conftest.Shader. The added pytestmark = requires_tools fixes exactly that path.
  • Synthetic hand-written shaders only; no game data.

The control used main's original test file, not a copy of the PR's corrected test.

@bobcatchris

Copy link
Copy Markdown
Contributor

Independent CPU verification, at head 6be13498 against main bb2e1842 (Windows, Python 3.12).

This machine has llvm-mc (ROCm 5.7) and spirv-as/spirv-val, so the new guard never fires by default and both versions give 4 passed. To exercise the skip path I re-ran the same file with the directories holding those tools removed from PATH:

  • main's tests/test_spirv_gs_to_compute.py: 1 failed, 3 errors — TypeError: unsupported operand type(s) ..., i.e. conftest's Shader with no llvm-mc, exactly the failure the PR describes.
  • with this PR: 4 skipped, exit 0.

So the guard changes nothing when the tools are present and replaces the TypeError with a skip when they are not. Caveat: the missing-tools case was simulated by PATH, not by uninstalling them.

@kapitche

Copy link
Copy Markdown
Contributor

Tested on Linux (WSL2 Ubuntu), Python 3.12, CPU only: pass. Where llvm-mc and spirv-as/val are absent, tests/test_spirv_gs_to_compute.py now gives 4 skipped, with no errors and a reason naming LLVM_MC=None. That fixes the TypeError I hit reviewing #1331. On Windows with the tools present, the same file ran 4 passed (#1331).

@etcetera-yt

Copy link
Copy Markdown
Contributor Author

Thanks @bobcatchris (both runs, with the tools present and without) and @kapitche (Linux). That covers the guard firing and not firing. AI-assisted (Claude Code).

@etcetera-yt

Copy link
Copy Markdown
Contributor Author

Closing as superseded: @undeadhuman37's 8a79601 ("skip tests without llvm-mc") put @requires_tools on each test in this file on main. On main 99f9989 here, with no llvm-mc, the file now gives 5 skipped, the outcome this PR was for, and this branch now conflicts with that change. Thanks again @bobcatchris and @kapitche for testing it. AI-assisted (Claude Code).

@UlteriorMotive00

Copy link
Copy Markdown
Contributor

Tested 6be1349 on Windows 11 Home 10.0.26300, Python 3.14.7, pytest 9.2.0.

tests/test_spirv_gs_to_compute.py this PR main's version of the test
llvm-mc 21.1.8 (LLVM_MC) and Vulkan SDK 1.4.363.0 spirv-as/val on PATH 4 passed
neither available (LLVM_MC unset, PATH without the SDK) 4 skipped, with the reason line naming what's missing 1 failed, 3 errors

AI-assisted (Claude Code). No game files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants