test: print the usage when binary mode gets the wrong argument count #1861
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1868"
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 R0Y00/Xbox2Windows. Originally posted by ChazY11 on 2026-11-24T19:48:43Z.
Why
AGENTS.mddocuments thattests/pixel_aot_check.py binaryneedsllvm-mc,llvm-objcopyandlibLLVM, but passing onepath instead of three does not say that:
The reader has to open the file to learn what the three arguments are, and the message looks like a bug in the check rather
than a wrong invocation.
Change
One guard on the count before the call:
Tested
The middle line is the guard against a change that silently swallows a real invocation: with three arguments the call still
happens exactly as before.
Scope
One test file, the dispatch of one mode.
Notes
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T19:54:43Z.
Review: COMMENTED
Reviewed head
aa5eed1a769c36762530ac259272e51d0f11b82din a clean Linux worktree.git diff --check origin/main...HEAD: clean (rc 0)python -B tests/docs_links_check.py: rc 0python -B tests/bidi_controls_check.py: rc 0ast.parse) oftests/pixel_aot_check.py: rc 0Findings: 0 P1, 0 P2.
The change adds a usage message for
binarymode when it gets the wrong number of arguments. Before,check_binary(directory, *args)raised aTypeError. Now the run exits with aSystemExitmessage. No assertion on the code under test is added or tightened, so I did not run a mutation. It only changes the failure message of a misuse.Nit:
check_controls(directory)runs before the argument count check, so the usage message appears only after the controls finish. Moving the check up would give an immediate answer.Thanks for the contribution. As a usage-message-only change it adds no new behavior check, so I am not recommending a merge for the quality filter.
AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T20:28:54Z.
Review: COMMENTED
Review of head
aa5eed1a76Commands run locally (all rc=0):
git diff --check origin/main...HEAD,python3 tests/docs_links_check.py,python3 tests/bidi_controls_check.py,python3 -m py_compileon the touched test file.Probe:
python3 tests/pixel_aot_check.py binary onlyoneprints the usage line and exits 1 (before the change: a TypeError from check_binary).Mutation: removed the
len(args) != 3guard, so the old TypeError comes back. No test in the repo fails, because the guard only changes a message on a wrong command line. It does not protect any tools/ or src/ logic.Result: no P1 or P2 defects, but the change kills no mutation of real logic (it only improves a failure message), so it does not pass the quality filter for a safe-merge. No receipt written, not merged. A maintainer can still merge it by hand if the message is wanted.
AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T20:29:38Z.
Review: COMMENTED
Correction: the mutation in my review above is now actually run. With the
len(args) != 3guard removed,pixel_aot_check.py binary onlyoneexits 1 with a TypeError instead of the usage line. Same exit code, only the message differs, and no repo test checks it. Verdict unchanged: no merge.AI-assisted; commands listed were executed locally.