test: print the usage when binary mode gets the wrong argument count #1861

Merged
ChazY11 merged 1 commit from upstream-pr/1868 into main 2026-11-24 21:12:50 +00:00
ChazY11 commented 2026-11-24 19:48:43 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by ChazY11 on 2026-11-24T19:48:43Z.


Why

AGENTS.md documents that tests/pixel_aot_check.py binary needs llvm-mc, llvm-objcopy and libLLVM, but passing one
path instead of three does not say that:

$ out/pe-env/Scripts/python.exe -B tests/pixel_aot_check.py binary C:\no\such\llvm-mc.exe
TypeError: check_binary() missing 2 required positional arguments: 'objcopy' and 'library'

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:

if mode == "binary":
    if len(args) != 3:
        raise SystemExit("usage: pixel_aot_check.py binary <llvm-mc> <llvm-objcopy> <libLLVM>")
    check_binary(directory, *args)

Tested

binary with one argument      usage: pixel_aot_check.py binary <llvm-mc> <llvm-objcopy> <libLLVM>   exit 1
binary with three (fake)      proceeds into check_binary and fails loading 'c', as it should        exit 1
no arguments (controls)       exit 0

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

  • AI-assisted.
<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6590069684 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1868). Originally posted by [ChazY11](https://github.com/ChazY11) on 2026-11-24T19:48:43Z. --- ## Why `AGENTS.md` documents that `tests/pixel_aot_check.py binary` needs `llvm-mc`, `llvm-objcopy` and `libLLVM`, but passing one path instead of three does not say that: ```text $ out/pe-env/Scripts/python.exe -B tests/pixel_aot_check.py binary C:\no\such\llvm-mc.exe TypeError: check_binary() missing 2 required positional arguments: 'objcopy' and 'library' ``` 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: ```python if mode == "binary": if len(args) != 3: raise SystemExit("usage: pixel_aot_check.py binary <llvm-mc> <llvm-objcopy> <libLLVM>") check_binary(directory, *args) ``` ## Tested ```text binary with one argument usage: pixel_aot_check.py binary <llvm-mc> <llvm-objcopy> <libLLVM> exit 1 binary with three (fake) proceeds into check_binary and fails loading 'c', as it should exit 1 no arguments (controls) exit 0 ``` 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 - AI-assisted.
tedin7 commented 2026-11-24 20:01:11 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T19:54:43Z.

Review: COMMENTED


Reviewed head aa5eed1a769c36762530ac259272e51d0f11b82d in a clean Linux worktree.

  • git diff --check origin/main...HEAD: clean (rc 0)
  • python -B tests/docs_links_check.py: rc 0
  • python -B tests/bidi_controls_check.py: rc 0
  • Syntax check (ast.parse) of tests/pixel_aot_check.py: rc 0

Findings: 0 P1, 0 P2.

The change adds a usage message for binary mode when it gets the wrong number of arguments. Before, check_binary(directory, *args) raised a TypeError. Now the run exits with a SystemExit message. 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.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6046330373 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1868#pullrequestreview-6046330373). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T19:54:43Z. **Review:** COMMENTED --- Reviewed head `aa5eed1a769c36762530ac259272e51d0f11b82d` in a clean Linux worktree. - `git diff --check origin/main...HEAD`: clean (rc 0) - `python -B tests/docs_links_check.py`: rc 0 - `python -B tests/bidi_controls_check.py`: rc 0 - Syntax check (`ast.parse`) of `tests/pixel_aot_check.py`: rc 0 **Findings: 0 P1, 0 P2.** The change adds a usage message for `binary` mode when it gets the wrong number of arguments. Before, `check_binary(directory, *args)` raised a `TypeError`. Now the run exits with a `SystemExit` message. 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.
tedin7 commented 2026-11-24 21:01:00 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T20:28:54Z.

Review: COMMENTED


Review of head aa5eed1a76

Commands 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_compile on the touched test file.

Probe: python3 tests/pixel_aot_check.py binary onlyone prints the usage line and exits 1 (before the change: a TypeError from check_binary).
Mutation: removed the len(args) != 3 guard, 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.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6046856614 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1868#pullrequestreview-6046856614). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T20:28:54Z. **Review:** COMMENTED --- Review of head aa5eed1a769c36762530ac259272e51d0f11b82d Commands 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_compile` on the touched test file. Probe: `python3 tests/pixel_aot_check.py binary onlyone` prints the usage line and exits 1 (before the change: a TypeError from check_binary). Mutation: removed the `len(args) != 3` guard, 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.
tedin7 commented 2026-11-24 21:01:00 +00:00 (Migrated from github.com)

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) != 3 guard removed, pixel_aot_check.py binary onlyone exits 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.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6046868707 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1868#pullrequestreview-6046868707). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T20:29:38Z. **Review:** COMMENTED --- Correction: the mutation in my review above is now actually run. With the `len(args) != 3` guard removed, `pixel_aot_check.py binary onlyone` exits 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.
upstream-sync closed this pull request 2026-11-24 21:27:25 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
R0Y00/Xbox2Windows!1861
No description provided.