test: each test names its own run_all arguments, skips and modules #1822
No reviewers
Labels
No labels
accessibility
autorelease: pending
autorelease: tagged
bug
dependencies
documentation
duplicate
enhancement
github_actions
good first issue
help wanted
invalid
question
testing wanted
wontfix
No milestone
No assignees
1 participant
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Hookshot!1822
Loading…
Reference in a new issue
No description provided.
Delete branch "runall-declarations"
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?
Every PR that adds a check also adds a line at the top of
ARGS(and oftenSKIP) intests/run_all.py, so two such PRs open at the same time conflict there even when their tests have nothing to do with each other. This moves those lines into the tests themselves, so adding a test no longer touches a shared file.What changed
tests/run_all.pyreads them withastand never imports the test.ARGS,MODULESandSKIP, and the spirv-val and glslang skip loops, moved into the 125 test files they named. The group comments moved with them ((a GPU),(Linux only), the spirv-val and glslang notes, the game note).{placeholder}, an unknown OS, a declaration assigned twice or changed after it is set, or a misspeltRUN_ALL_name stops the run with exit code 2 and prints the file and line. A test that does not parse just declares nothing: it fails when it runs, and so does the byte-compile, as before.tests/test_run_all_declarations.pycovers the reader: valid declarations, malformed ones, unknown placeholders, unknown OSes, the retired tables, and a pass over every test in the repository.Declaring what a new test needs
{name}is a tool the runner finds:cxx,vulkan_headers,spirv_headers,spirv_val,glslang,dotnet. If the tool is missing, the check is skipped, or fails with--strict. The same goes for the compiler after--cc/--cxxand for a missing module, as before.RUN_ALL_SKIPmaps"linux"and/or"windows"to a reason. A check that can run on neither (a GPU, the game) names both.--no-skip, or naming the check, still runs it.PRs opened before this one
They will conflict in
run_all.pyonce, on theARGSlines this PR removes. That can't be avoided, but it is the last such conflict.ARGS,MODULESandSKIPstay inrun_all.py, empty, with a comment saying they are retired. If a resolution (or a merge) keeps the old line in one of them,run_all.pyrefuses to run anything and prints the declaration to put in the test, for example:I chose this over honouring and merging the old tables for a while. Merging would let new entries keep landing in the shared file, which keeps the conflicts this PR is meant to stop. Failing loudly costs a stale PR one small move. Dropping the old tables without a check would have been worse: a test whose arguments all have defaults (
--cxx g++and the like) would then quietly run with the defaults instead of the arguments the PR asked for.test_run_all_declarations.pyalso fails while any of the three tables has an entry.Same checks, same arguments
I ran a throwaway script against
main'srun_all.pyand this one, withsubprocess.run, the tool lookup and the module lookup replaced by recorders. It ranmain()for both OSes (OSforced towindowsfor the second), with every tool present and with none present, each plainly, with--no-skipand with--strict. That is 12 runs, which recorded every command line a check would get, every skip and its reason, and every "not found here" list. The two outputs (9,896 lines, 2,758 command lines) are identical. The only differences are the new test and the check counts that include it. A second script compared the resolved test -> (arguments, modules, skip reason) table for all 295 test files on both OSes: 0 differences.Testing
python -I -B tests/run_all.pyon Linux runs the same checks asmain, with the same failures and the same 9 skips with the same reasons, plus the new test, which passes.Self-review pass before merge.
Equivalence: I checked every
RUN_ALL_*declaration against main'sARGS/MODULES/SKIPtables and the spirv-val / glslang skip loops. 125 test files, 0 differences: the same arguments, placeholders, modules, per-OS skips and reason strings. Main'stests/run_all.pyis byte-identical to this branch's base, so there's nothing to carry over yet.Parser:
read_declarationsusesast.parse+literal_evaland never imports a test, so discovery has no side effects. It rejects misspeltRUN_ALL_names, unknown placeholders/OSes, duplicate assignments,+=, subscripts and non-literals, all with file:line. BOM/CRLF are fine, and--strict/--no-skipbehave as before.For the ~40 open PRs that add a line to
run_all.py: each will get one conflict where theARGSblock is gone. The fix is to move that line into the test file asRUN_ALL_ARGS = [...](orRUN_ALL_SKIP/RUN_ALL_MODULES). If a resolution keeps the old table line,stale_tables()stops the run and prints the line to add. If it just drops it, the test silently runs with its defaults (e.g.--cxx g++), so watch for that when rebasing.Small follow-ups, not blocking:
if/try, orRUN_ALL_ARGS.append(...), is ignored without a message. It could be rejected the same way+=is.All three follow-ups are in
6b54b58:RUN_ALL_name set inside a top-levelifortry, or changed with.append(...),.update(...)ordel, now stops the run with the file and line, like+=and subscripts already did. A function's or class's own names are still left alone.run_all.py test_foo) reads only those tests' declarations, so a bad declaration elsewhere no longer blocks it.does not parse (...), without being run, instead of losing its skip on Windows.tests/test_run_all_declarations.pyhas a test for each (17 pass). The full run is unchanged: the same failures asmain, plus the new tests passing.