Skip to content

tests/conftest.py: run spirv-as/spirv-val with bare names in the work folder (non-ANSI TEMP) - #4807

Open
lines9686-rgb wants to merge 1 commit into
ItsNotRexed:mainfrom
lines9686-rgb:tests-spirv-bare-names
Open

lines9686-rgb wants to merge 1 commit into
ItsNotRexed:mainfrom
lines9686-rgb:tests-spirv-bare-names

Conversation

@lines9686-rgb

Copy link
Copy Markdown
Contributor

Item: new TEST item, claimed in #4683 (#4683 (comment)).

tests/conftest.py Shader.validate() handed spirv-as and spirv-val the absolute tmp_path. On Windows they read their command line in the ANSI code page, so a tmp_path under a user name outside it reached them with ? (tmp_ação → tmp_acao, "file does not exist") and every pytest translator test that validates failed. They now run in the work folder with bare file names, the approach #3423 took for rdna2spirv.py's assemble_spirv; output is decoded with errors="replace".

Tested

Windows 11 (ANSI code page 1251), Python 3.12, pytest 9.2, SPIRV-Tools from Vulkan SDK 1.4.357.0, llvm-mc 23.1.6. test_translate, test_mesh_compute, test_spirv_gs_to_compute, test_image_load_d16_typed, test_pc_tail_ubo, test_vs_packed_inputs:

TEMP main 98fa503 this branch
D:\Leonida\tmp_ação 513 failed, 133 passed, 5 errors 11 failed, 635 passed, 5 errors
ASCII folder 651 passed 651 passed

The 11 + 5 left come from those files' own spirv-as calls (test_mesh_compute.py ~line 134, the gs_module fixture in test_spirv_gs_to_compute.py), outside this helper; about 50 other test files and tools/spirv_gs_to_compute.py also pass full paths to SPIRV-Tools. Left for a follow-up. No game files. AI-assisted (Claude Code).

🤖 Generated with Claude Code

… folder

On Windows the SPIRV-Tools read their command line in the ANSI code page, so a
tmp_path under a user name outside it reached them with "?" and every pytest
translator test that validates failed. With %TEMP% at "tmp_ação" on a cp1251 PC:
513 failures across test_translate, test_mesh_compute, test_spirv_gs_to_compute,
test_image_load_d16_typed, test_pc_tail_ubo and test_vs_packed_inputs on main;
11 (plus 5 errors) with this change, all from those files' own spirv-as calls.
Same approach as rdna2spirv.py's assemble_spirv (ItsNotRexed#3423).

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

Copy link
Copy Markdown
Contributor

Verified c0b4abc125861594fccef315962a95c51bc0697d on Windows 11 (ANSI code page 1252), Python 3.15.2, Vulkan SDK 1.4.363.0 / SPIRV-Tools v2026.4. Direct python -I -c repro imported tests/conftest.py and called Shader.validate() on a minimal hand-written compute SPIR-V module with real spirv-as and spirv-val. Both ASCII and 漢字_ temporary-directory prefixes passed. Red control: restored only tests/conftest.py from HEAD^ and reran with 漢字_: spirv-as failed with file does not exist, showing ??_ in the path. The direct repro stubbed pytest decorators only and bypassed the LLVM-dependent fixture constructor; the cited pytest suites were not run (pytest and llvm-mc unavailable on the active environment). Restored HEAD; worktree clean.

AI-assisted (Devin); no game files.

@tupacfan04

Copy link
Copy Markdown
Contributor

APPROVE. The work-folder/bare-name change fixes the real Windows ANSI issue and does not need any test-specific workaround.

I reproduced it directly with conftest.Shader.validate against a work folder containing characters outside the ANSI code page (...\验证-ü):

  • new code: validate() passes;
  • old absolute-path form, same folder: spirv-as exits 1 with error: file does not exist '...\??-? \abs.spvasm'.

The fallback spirv-val --allow-offset-texture-operand path also now uses sv.name, so it gets the same fix, and errors="replace" prevents a decoding failure from masking the real diagnostic. compileall and merge-tree against origin/main (ec34b54f) are clean. I could not run the make_shader pytest fixtures themselves because this machine has no llvm-mc, but the validate path above is the code under test.

No blocking issues.

AI-assisted review, no game files, no game data.

@KkelebekK

Copy link
Copy Markdown

Reviewed and tested c0b4abc1 (alone and merged with main 3faac557), CPU only: Linux, Python 3.14.10, pytest 9.2.0, SPIRV-Tools v2026.4, llvm-mc 23.1.4. Merges cleanly with main.

No blocking issues. Non-blocking: nothing in CI protects the bare-name form. If validate() goes back to absolute paths, every test still passes on an ASCII or Linux temp folder, and #4850's Unicode-path tests cover only its own direct calls.

AI-assisted.

@bobcatchris

Copy link
Copy Markdown
Contributor

Independent macOS code read and test run at head c0b4abc. Shader.validate() now runs spirv-as/spirv-val with cwd=self.workdir and bare file names, matching how rdna2spirv.py assembles, so a temp path outside the Windows ANSI code page cannot reach the tools as ? characters; errors="replace" keeps a bad tool message from raising in the assertion. The three call sites (plain validate, the maintenance8 retry and its usage-text skip) all use the same runner, so the fallback path is covered too. Broad pytest on macOS: 6980 passed, 154 skipped, 8,083 subtests; the only failures are the two known ones already on main (find_hash_lookup joaat subtests and the TEST-1010 decoder parity case). No issue introduced by this change; no game data, synthetic shaders only.

AI-assisted.

@kapitche

kapitche commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Tested c0b4abc merged with main 3faac55 (merge result 7a62ebf) on Windows 11 (10.0.26200, ANSI code page cp1252) / Python 3.13.1, pytest 9.x (pip-installed into a scratch dir), spirv-as/spirv-val and llvm-mc from the repo's tools folder on PATH: pass, with a note on scope.

  • The PR has no new tests; it changes the Shader helper in tests/conftest.py. With TEMP set to a folder whose name has CJK letters (not representable in cp1252), over test_u16_high_half.py, test_mesh_compute.py and test_spirv_gs_to_compute.py (71 tests): PR conftest 44 passed, 22 failed, 5 errors; main's conftest 33 passed, 33 failed, 5 errors. The 11 that the PR fixes are test_mesh_compute.py::test_module_is_compute[*] (10) and test_spirv_gs_to_compute.py::test_compute_module (error text on main: file does not exist '...cr7_4807_tmp_???\...').
  • With an ASCII TEMP the same 71 tests pass with either conftest (71/71), so the change does not alter the normal case.
  • The remaining 22 failures and 5 errors are the same problem in tests that call spirv-as/spirv-val themselves with full paths and so don't go through the helper (test_u16_high_half.py:80, test_mesh_compute.py test_vertex_shader_validates, test_spirv_gs_to_compute.py lines 72, 137, 146, and others; about two dozen test files call spirv-as directly). They fail identically on main, so they are outside this PR, but a non-ANSI user name still has red tests after it.
  • A first run of 8 shader test files (691 tests) under the same non-ANSI TEMP with the PR's conftest gave 664 passed, 22 failed, 5 errors; the same 22+5 as above.
  • Not run on Linux (no spirv tools on that box).

@memorypressure

Copy link
Copy Markdown

Verified against main 3faac55: clean merge, and the semantic suites that drive this conftest path pass under the pinned pytest — test_alu_add3 24, test_alu_sub 22, test_control_flow_branches 33 — with spirv-as/spirv-val invoked by bare name inside the work folder, so the changed calls genuinely execute; the maintenance8 revalidate fallback was updated consistently. Stdlib-only, and the cwd-relative invocation is the right shape for the Windows ANSI-code-page motive. The branch reports no CI checks. AI-assisted: yes. Tested on Linux (RTX 5080 host, CPU-only run).

@Atomic258

Copy link
Copy Markdown
Contributor

Tested c0b4abc on Windows Server 2022, CPython 3.13.12: pass

  • pytest suite smoke (tests/test_amd_swizzle.py) -> 10 passed - conftest change doesn't break collection

git diff --check clean; python -m compileall -q exit 0. No game files, no GPU. AI-assisted (Devin).

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.

7 participants