WIP: test: one source cutter for the checks (tests/srccut.py), 80 checks moved to it #27
No reviewers
Labels
No labels
accessibility
autorelease: pending
autorelease: tagged
bug
dependencies
documentation
duplicate
enhancement
github_actions
good first issue
help wanted
invalid
needs measurements
question
testing wanted
wontfix
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 80 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.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
Nothing to measure in the game: the change is to the checks only; nothing the game runs changes.
What was run, on the GitHub version (NotRexed/Hookshot#2914), not on Longshot:
main: each run asmainhas it and as moved withSRCCUT_CHECK_NAIVE=1, with its declared tools (the Builder's clang, the Vulkan headers): 80 of 80 pass both ways, no cut differs.tests/test_srccut.py(new).Testing
Tested: the runs under Measurements (on the GitHub version) and the game-free checks this description names.
Not tested: in the game (tests only). 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 NotRexed/Hookshot#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 (NotRexed/Hookshot#2636). A follow-up after NotRexed/Hookshot#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 NotRexed/Hookshot#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.docs/tested-configurations.mdfor each measured run.MKWVK_API_VERSIONbumped (gpu/vk/vk_api.h'sMkwVkHostorMkwVkRendererchanged).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).
View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.