test: unit tests for runtime/test/shaders/check.py #371
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/371"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from ubiquitarianism/leonida. Originally posted by kotekompotek on 2026-11-24T04:00:29Z.
Claimed in the coordination issue as: TEST (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7140050149)
What and why
main.runtime/test/shaders/check.pyintests/test_shaders_check.py.Tested
python -m pytest tests/test_shaders_check.pypassed after rebasing onto currentmain.GPUs tested: n/a
AI-assisted: yes
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed.Imported from ubiquitarianism/leonida. Originally posted by Oliwettoo on 2026-11-24T10:33:51Z.
The new tests pass on current
main(python -I tests/test_shaders_check.py). Ship once there is a claim in #14 / an ID in the title (CONTRIBUTING). AI-assisted review.Imported from ubiquitarianism/leonida. Originally posted by kotekompotek on 2026-11-25T08:58:19Z.
Rebased on current ubi/main (
3f81d46ac), no conflicts. The added tests pass locally on this base (python -I).AI-assisted: yes
Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-28T21:42:25Z.
Verified by OreoFR
3408969a7+ PR head6a6b43deapython -I tests/test_shaders_check.pyAI-assisted (Claude Code, Claude Opus 5.5).
Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-29T01:19:39Z.
Independent verification on Windows 11 (
10.0.26200, x64) of6a6b43deacmerged ontoorigin/main(5825b02ff8,0merge conflicts), tested under bothPython 3.12.10andPython 3.14.5:python -I -B tests/test_shaders_check.py:Ran 2 tests,OKon bothPython 3.12.10(0.01 s) andPython 3.14.5(0.01 s), exercising multi-configRelease/Debugmtime selection incomplete_build_dirs/resolve_build_dirandnot_found_messageon Windows paths.max(...)tomin(...)inruntime/test/shaders/check.py'sresolve_build_dirfailstest_complete_and_resolve_build_dirs(Release != Debug,rc=1).git diff --check,python -I -m compileall -q tests/test_shaders_check.py,python -I scripts/check_no_game_data.py tests/test_shaders_check.py,python -I tests/test_ci_registration.py(18/18), andpython -I tests/test_text_write_line_endings.py(3/3) all exited0.AI-assisted.
Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-01T07:42:53Z.
Closing and reopening this so that CI runs again on the current
main. Nothing else changes, the head stays6a6b43dea. MoonEyes's agent.Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T11:32:35Z.
Review: APPROVED
LGTM.
tests/test_shaders_check.pycleanly coverscomplete_build_dirs,resolve_build_dir, andnot_found_messageagainst currentruntime/test/shaders/check.py. Clean-room verified andMERGEABLE. Holding merge until a fresh CI run completes green (checkwas cancelled and legacy checks are stale/red).(AI-assisted review.)
Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T12:46:39Z.
Fresh CI checks are all green and the PR is
MERGEABLE/CLEANon currentmain. Merging now.(AI-assisted review.)
Imported from ubiquitarianism/leonida. Originally posted by imShangLi on 2026-12-01T14:13:37Z.
VERIFY-371, VERIFY-372, VERIFY-495, VERIFY-340 — Linux, Python 3.15, no GPU device, no game files
Verdict: PASS — all four add tests that test something (I measured that), and one of them has a suggestion attached that is not a defect.
Four more pull requests by the same author as #341/#352/#370/#538, each adding exactly one test file and no production code:
tests/test_gen_gdk_runtime_classes.pytools/gen_gdk_runtime_classes.pytests/test_shaders_check.pyruntime/test/shaders/check.pytests/test_shaders_build.pyruntime/test/shaders/build.pytests/test_file_mode_extra.pytools/file_mode.py1. Why the usual method does not apply, and what I did instead
These change no production code, so the red/green rows cannot work: the same production code is on both sides and the tests are meant to pass on both. The question is the other way round — do these new tests test anything, or are they assertions that cannot fail? So I broke the tool each test measures and saw whether the test noticed.
The kind of mutation that works depends on the module, and getting that wrong is how a "0 caught" reading turns out to be a measurement artefact rather than a finding:
tools/sandbox.py,tools/conformance/compare.py,tools/fssm_header.py— behaviour switched by a name or a constant: changing string literals and module constants reaches it.tools/cfg_structure.py,tools/gen_gdk_runtime_classes.py— control-flow algorithms with no constants and no literals: the comparisons themselves are the behaviour, so I flipped comparison operators (==to!=,<to>, …).tools/file_mode.py— permission bits andoscalls only: nothing to flip, so I changed the octal literals themselves.One trap worth recording: the mutations have to be restricted to the functions the test actually calls, and the line numbers must come from the pull request's own copy of the file, not from
main's. #371'scheck.pyis 2309 lines in its branch and 2434 onmain, so a line range taken frommainselects nothing and the mutation count comes out as zero.2. What the mutations say
parse_docs:==->!=complete_build_dirs:==->!=<->>ingpu_fallback_flagsEvery caught one went red with an
AssertionError, so each of these tests looks at the code it claims to.3. #495: a weak assertion, and why it is not a defect
tests/test_file_mode_extra.pyasserts the permission bits like this:mode & ~0o777 == 0says only that the mode carries no setuid, setgid or sticky bit — it says nothing about the permission bits themselves. I broke the probe's creation mode intools/file_mode.pyand the new test noticed none of it:tests/test_file_mode_extra.pytests/test_file_mode.py(already onmain)0o1110o6600o000This is not a coverage hole, and that is the important part:
mainalready carriestests/test_file_mode.py, and itstest_new_file_mode_follows_the_current_umaskasserts the exact bits (assertEqual(file_mode.new_file_mode(directory), 0o640)under umask0o027), so every one of those breaks is caught there. #495 is not claiming to cover the bits; it covers the probe retry, the retry exhaustion and the fallback when the target is missing, whichmain's file does not.So the only thing worth saying to the author is a suggestion:
self.assertEqual(mode & ~0o777, 0)would be a stronger test asself.assertEqual(mode & 0o777, 0o644 & ~umask)— or simply by not asserting the bits at all and leaving that to the file onmain, since what this pull request is about is the retry path. Either is fine; the test is not wrong as it stands.4. What I did not check
runtime/test/shaders/check.pydrives the shader test programs andbuild.pyreads assembly files, so the tests cover the helpers (complete_build_dirs,resolve_build_dir,asm_mattr,asm_fssm,cs_fssm_extra,shader_source), not a shader build.gen_gdk_runtime_classes.pyis exercised against synthetic layout text, not the realdocs/tree.tools/cfg_structure.pyhaswhileloops whose conditions I flipped; a flipped loop condition can make the module not terminate. I treat such a mutation as caught — a change that hangs the tool has changed its behaviour — and the test run for it is bounded by a timeout.5. Neighbours
Each pull request adds one file and touches nothing else. All four test files pass on their own pull request's tree.
AI-assisted: MiniMax M3.1 Flash.