tooling: harden bink_descriptors_aot CLI and add unit suite #1943
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1950"
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 Ammmae0x on 2026-11-24T22:01:55Z.
Change
Wrap
tools/bink_descriptors_aot.pyCLI execution in an explicitmain(argv=None)entry point that exits cleanly (status1, no Python traceback) onOSError,ValueError, andpefile.PEFormatError, and register a synthetic AMD64 PE32+ unit and refusal suite intests/bink_descriptors_aot_check.py(run viaCMakeLists.txtasbink_descriptors_aot_check).tests/bink_descriptors_aot_check.py): synthesizes an AMD64 PE32+ DLL exportinggroup_init,group_append(with oneint3capacity breakpoint), andframe_planes(with fivecall r9sites and.pdataunwind metadata) to verifygenerate(package=False, frame_planes=False/True),frame_body(..., bind_group=False/True), andmain(argv)/ subprocess CLI output..cppoutput) on missing (0) or duplicate (2)int3sites ingroup_append,!= 5(0,4,6)call r9sites inframe_planes,--packageSHA-256 mismatch againstBINK_SHA256, missingframe_planesexport or.pdata, non-AMD64 / non-PE32+ images, non-.cppor input-aliasing output paths, and missing/corrupt input files.AI-assisted.
Verification
ctest --preset dev -Nandctest --preset release -N:1238total tests in both presets (bink_descriptors_aot_checkregistered as test#1224).cpu_bink_heap_provider,cpu_bink_heap,cpu_bink_heap_lifted,cpu_bink_descriptors,cpu_bink_descriptors_liftedin bothdevandrelease(0errors).ctest --preset dev --no-tests=error -R "^(bink_descriptors_aot_check|bink_heap_aot_check|cpu_aot_bink_heap|cpu_aot_bink_group|cpu_bink_descriptors|cpu_bink_frame_planes)$" -V:6/6passed (cpu_aot_bink_heap,cpu_aot_bink_group,cpu_bink_descriptors,cpu_bink_frame_planes,bink_heap_aot_check12 tests,bink_descriptors_aot_check9 tests).ctest --preset release --no-tests=error -R "^(bink_descriptors_aot_check|bink_heap_aot_check|cpu_aot_bink_heap|cpu_aot_bink_group|cpu_bink_descriptors|cpu_bink_frame_planes)$" -V:6/6passed.python -B tests/bink_descriptors_aot_check.py -v:9/9tests passed.python -B tests/form_coverage_check.py,python -B tests/docs_links_check.py, andpython -B tests/bidi_controls_check.py: all exited0.Evidence and follow-up
All fixtures in
tests/bink_descriptors_aot_check.pyare constructed synthetically in memory with zero external or game-specific inputs.Checklist
Imported from R0Y00/Xbox2Windows. Originally posted by ChazY11 on 2026-11-24T22:17:53Z.
Ran it and broke eight paths — all caught, including the generator guards the description claims
Windows 11 build 26300.9974:
CLI side (
main()and its guard), each reverted:except (OSError, ValueError, pefile.PEFormatError)→except (KeyboardInterrupt,)parser.exit(1, …)→parser.exit(0, …)if False:That the two halves fail separately is the thing I check first in this family of PRs, because in #1933 the same-file case passed
with its guard removed (a later
generate()error produced the same exit code). Here either half on its own fails the suite, sothe message text must be asserted, not just the status.
The generator's own refusals are pinned too
The description lists refusals that live in
generate(), not in the CLI, so I mutated those as well:tools/bink_descriptors_aot.pyif len(calls) != 5:→if False:(frame plane sites)if len(stops) != 1:→if False:(capacity breakpoint)checked_image(image, BINK_SHA256) if package→ plainpefile.PE(...)(hash check skipped)The third is the one worth having: a
--packagerun that stops verifyingBINK_SHA256would still produce plausible output, andonly a test that feeds a mismatching hash and requires a refusal notices.
One observation, not a defect
The synthetic image reproduces the exact counts the tool demands (one
int3, fivecall r9), which is what makes the negativecontrols meaningful — a 4- or 6-site image must be refused. If the real package ever changes those counts, this suite will refuse
it loudly rather than silently translating a different shape, which is the correct failure direction for an AOT generator.
What I did not do
Nothing was linked or run against the real package:
BINK_SHA256and the image are synthetic here. That matches the description'sscope, and the honest limitation is the same one the earlier PRs in this series carry — the translated ranges are only exercised
through a fabricated PE.
Verdict
Reviewed. Eight mutations, eight failures, and both the CLI boundary and the generator's refusals are covered by the new suite.
Notes