test: one source cutter for the checks (tests/srccut.py), 79 checks moved to it #27
No reviewers
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
area/renderer
area/saves
area/upscaling
good first issue
gpu/amd
gpu/igpu
gpu/intel
gpu/nvidia
help wanted
kind
bug
kind
chore
kind
docs
kind
feature
kind
performance
kind
question
needs measurements
platform/linux
platform/steam-deck
platform/windows
preview
priority
critical
priority
high
priority
low
status
blocked
status
confirmed
status
duplicate
status
invalid
status
needs-info
status
wontfix
testing wanted
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!27
Loading…
Reference in a new issue
No description provided.
Delete branch "dyst/Longshot:test/srccut"
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?
Why
123 checks carry their own copy of a brace counter (
def block) to cut a function out of a source file; the copies count braces inside strings, character literals and comments too, and when a function is renamed or reshaped they stop with a bareValueErrororIndexErrorthat doesn't say which source or marker (the trap AGENTS.md warns about, "Tests read the source"). This gives the checks one cutter and moves 79 of them to it, each shown to cut exactly what it cut before.What changed
tests/srccut.py(standard library):block(text, marker): from the marker to the brace that closes the first{after it (_closing_brace()), counting braces outside string and character literals (raw strings too, and C++14 digit separators), comments and preprocessor lines;between(text, start, end), andfind();CutError;unique=Falsetakes the first on purpose);SRCCUT_CHECK_NAIVE=1also cuts each block the old way (_naive()) and stops if the two differ: what a migration runs to show it changed nothing.blockfrom it in place of their own copy, one commit per source file they read (vk_menu.cpp,vk_draw.cpp,vk_memory.cpp,vk_texture.cpp,longshot_env.h,hos_main.c, ...). Only exact copies of the plain counter moved; each takessys.path.insert(0, ...)for its own folder, sincepython -Ileaves it off the path.tests/test_srccut.py: braces in strings, character literals, raw strings, comments and preprocessor lines; a fixture the old counter cut wrongly; a missing marker and a repeated one name the source;between; an unclosed block; the comparison with the old counter.test_audio_voice_biquad.pycuts withtest_audio_deadline.py'sblock, which is srccut's now: its marker for the filter loop is the onerender_voicewrites with its brace on the line (the second commit; the cut is the same as before, checked against the old counter).blockisn't the plain counter (a start offset; positions returned): left as they were;unique=False;function,body,between, ...): later, by source file.Flags and settings
SRCCUT_CHECK_NAIVEsrccut.blockalso cuts the old way and stops if the two cuts differMeasurements
main:
000f19fb(2026-11-13)this PR: test/srccut @ 39951d5f
Hardware: Ryzen 9 3900X, 64 GB, Windows 11 (RTX 3080; no game run: these are game-free checks)
Scene: none: game-free. The 79 checks this moves, by name
Method: two interleaved rounds of the 79 through
run_all.py --jobs 12(main, this PR, this PR withSRCCUT_CHECK_NAIVE=1: every cut also made the old way and compared), the PC otherwise quiet and the bench lock held. Times by the script's clockHow to reproduce:
python -I -B tests/run_all.py <the 79 names>on each, and withSRCCUT_CHECK_NAIVE=1on this branch000f19fbSRCCUT_CHECK_NAIVE=1: no cut differs)80 moved on the GitHub version;
test_linux_update_skip.pyis gone from main since #13, andtest_builder_update_back.py, which it moved too, since #181.Rebased since onto main
0c74253d: its four commits since000f19fbare #177 (a log line's level, in the renderer's logging), #192, #193 and #194 (the README, the website, the Discord status), none in the runner or the checks measured here, so the numbers hold.Testing
Tested: the runs above;
tests/run_all.py, the whole suite, on this branch and on main0c74253d, Windows (483 passed and 6 failed on main, 484 passed and 6 failed here, no failure main doesn't have: test_check_third_party, test_display_pointer, test_fpx_sticky, test_release, test_spawn_emit and test_texture_staging_publication fail on main too (the last since #177; #202 fixes it));tests/test_srccut.py(new).Not tested: in the game (tests only); on Linux (the cutter is plain Python). The checks that were not moved (3 + 13 + 51) were not changed.
Needs other testers: None
Screenshots
Nothing on screen.
Risk and rollback
Only the checks change. A moved check could cut a different piece of source than before (the new cutter skips braces in literals and comments, which the old one counted);
SRCCUT_CHECK_NAIVE=1showed none of the 80 does today. A marker that now appears twice in a source stops its check where the old counter took the first silently. Reverting the commits is enough.Reviewer notes
Carried over from https://github.com/NotRexed/Hookshot/pull/2914 with the move to Longshot: the same change on Longshot's
main, with its rename applied. Its review and discussion are there.The dev-loop proposal's D2 (https://github.com/NotRexed/Hookshot/pull/2636). A follow-up after https://github.com/NotRexed/Hookshot/pull/2887:
run_all.py --changedruns a test helper's importers (srccut's) rather than every check.The checks were run on the GitHub version; this branch is the same change with the rename applied (the same files and line counts). Forgejo runs no checks, and they were not run again here. The moved checks and
test_srccut.pywere run, not the wholerun_all.py.Issues
See https://github.com/NotRexed/Hookshot/pull/2636 (D2).
Checklist
For everyone
type(scope): description).main.python -I -B tests/run_all.pyrun and passing (any failure that also fails onmainis named above).third_party/untouched (a new folder with aPROVENANCE.mdinstead).If applicable
Assisted-by:/Co-Authored-By:trailers.mainand passing here.tests/that reads changed source updated in this PR, not weakened.🤖 Generated with Claude Code
test: one source cutter for the checks (tests/srccut.py), 80 checks moved to itto WIP: test: one source cutter for the checks (tests/srccut.py), 80 checks moved to itBack to WIP under #48's process: this was carried over before the new template. Its description will be brought to the template and measured on Longshot (main against this PR, at named commits) when it's wanted for review; ask here if you'd like it sooner.
Description brought to Longshot's PR template (#48). Still WIP: its numbers are from the GitHub version, and it isn't rebased on current main; it gets measured on Longshot (main against this PR, at named commits) before it is marked ready.
Description moved to the template's Testing section and whole checklist (#72): what was tested, what wasn't, and what needs other testers (their test requests to open while this is WIP).
The description follows the template after #76 and #106: If applicable keeps only the boxes that apply (one that applies and isn't done yet stays unticked while this is WIP), the Flags table has the template's seven columns (Goal is now Recommendation), and GitHub references are full URLs. Nothing else changed.
d8111645c2cd56b3b820Rebased onto main
0c74253d, where #13 and #181 removed two of the 80 moved checks (so 79), and a second commit: test_audio_voice_biquad cuts with test_audio_deadline's block, srccut's now, and its marker is made unique (the same cut, checked against the old counter). Measured on Longshot: the 79 pass on main, here, and with SRCCUT_CHECK_NAIVE=1, with no change in time. Whole suite on this head and on main: no failure main doesn't have. Ready for review.WIP: test: one source cutter for the checks (tests/srccut.py), 80 checks moved to itto WIP: test: one source cutter for the checks (tests/srccut.py), 79 checks moved to itWIP: test: one source cutter for the checks (tests/srccut.py), 79 checks moved to itto test: one source cutter for the checks (tests/srccut.py), 79 checks moved to itView command line instructions
Checkout
From your project repository, check out a new branch and test the changes.