tests: cover ffx_provider_loop generation and refusal paths #3741

Manually merged
github merged 1 commit from github-bot/gh-3739 into main 2026-12-01 17:11:26 +00:00 AGit
Owner

@⁠Ammmae0x on GitHub · 2026-12-01 13:29 UTC · original
Ammmae0x:tests/ffx-provider-loop → main · +1127 −0 · 5 files · 1 commits · merged 2026-12-01 17:06 UTC

Refs #1149

Adds comprehensive synthetic AMD64 PE32+ unit, boundary, CLI/refusal, and 1:1 mutation tests for tools/ffx_provider_loop.py (previously 0 Python unit tests), with zero edits to existing files (5 new files only).

tests/ffx_provider_loop_check.py builds a minimal synthetic PE32+ image in memory (no external binaries or DLLs): NOP-filled code regions with the exact instructions generate_loop() reads (LEA rip-relative globals, helper immediate, RET leaf, CALL/JMP substitutions, ffxCreateContext export slices) and a .rdata section with the three uint32 tables, two UTF-16 resource names, export directory, .pdata records, and the heap GUID the device-init CLI needs. It covers the deterministic C++ output structure (exact loop_data_486f0/48838/b79d0 arrays, wchar_t names, scratch_size, helper_size, build/reserve_resource/schedule_upload/run_loop/create_loop_context lowering and jump/call substitutions), boundary values (helper 0/0xffffffff, 0xffffffff/0 table values, names A1_2/123/a), and refusals pinned by exact exception type and message (invalid/non-ASCII/empty resource names, non-PE and truncated images, invalid instructions, RET-less leaf, out-of-range RVAs, slices outside the owned export function, renamed export), plus the device-init CLI positive path and SHA/missing/non-PE/suffix refusals (exit 1, no traceback, no output file). tests/cmake/ffx_provider_loop.cmake registers the check plus 5 WILL_FAIL TRUE --mutate controls; tests/ffx_provider_loop_meta_check.py runs every case individually and together and executes the exact 1:1 set of 5 mutations against real copies of the source.

Linux verification (this head, /tmp/pe-env/bin/python):

  • tests/ffx_provider_loop_check.py: ffx_provider_loop: 135 cases PASS
  • tests/ffx_provider_loop_meta_check.py: ffx_provider_loop: 135 cases, 5/5 mutations killed PASS
  • tests/form_coverage_check.py: passed
  • tests/docs_links_check.py: passed (208 files, 802 links)
  • tests/bidi_controls_check.py: passed (2826 files, no bidirectional controls)
  • Scratch CMake + CTest for the new fragment: 6/6 passed (base check + 5 WILL_FAIL mutation controls)
  • git diff --check clean; git status shows only the 5 new files, zero personal paths

No mingw on this host, so no Windows compile check; WIN-VERIFY run is the arbiter.

AI-assisted.

Windows Verification (c8f766c7)

  • git merge-tree --write-tree upstream/main HEAD -> 242c5aac (exit 0), git diff --check clean
  • Python checks: py_compile, ffx_provider_loop_check.py, ffx_provider_loop_meta_check.py, form_coverage_check.py, docs_links_check.py (209 files, 809 links), bidi_controls_check.py (2829 files) passed
  • Commands:
python -B tests/ffx_provider_loop_meta_check.py
ctest --preset dev --no-tests=error -R "^ffx_provider_loop" --output-on-failure
ctest --preset release --no-tests=error -R "^ffx_provider_loop" --output-on-failure
  • Results: ffx_provider_loop: 135 cases, 5/5 mutations killed PASS; dev 8/8 passed (5.85s, includes existing ffx_provider_loop_hardware/warp and 6 new tests); release 8/8 passed (5.67s). AI-assisted.
**@⁠Ammmae0x** on GitHub · 2026-12-01 13:29 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3739) `Ammmae0x:tests/ffx-provider-loop` → `main` · +1127 −0 · 5 files · 1 commits · merged 2026-12-01 17:06 UTC Refs #1149 Adds comprehensive synthetic AMD64 PE32+ unit, boundary, CLI/refusal, and 1:1 mutation tests for `tools/ffx_provider_loop.py` (previously 0 Python unit tests), with zero edits to existing files (5 new files only). `tests/ffx_provider_loop_check.py` builds a minimal synthetic PE32+ image in memory (no external binaries or DLLs): NOP-filled code regions with the exact instructions `generate_loop()` reads (LEA rip-relative globals, helper immediate, RET leaf, CALL/JMP substitutions, `ffxCreateContext` export slices) and a `.rdata` section with the three uint32 tables, two UTF-16 resource names, export directory, `.pdata` records, and the heap GUID the device-init CLI needs. It covers the deterministic C++ output structure (exact `loop_data_486f0`/`48838`/`b79d0` arrays, `wchar_t` names, `scratch_size`, `helper_size`, `build`/`reserve_resource`/`schedule_upload`/`run_loop`/`create_loop_context` lowering and jump/call substitutions), boundary values (helper `0`/`0xffffffff`, `0xffffffff`/`0` table values, names `A1_2`/`123`/`a`), and refusals pinned by exact exception type and message (invalid/non-ASCII/empty resource names, non-PE and truncated images, invalid instructions, RET-less leaf, out-of-range RVAs, slices outside the owned export function, renamed export), plus the device-init CLI positive path and SHA/missing/non-PE/suffix refusals (exit 1, no traceback, no output file). `tests/cmake/ffx_provider_loop.cmake` registers the check plus 5 `WILL_FAIL TRUE` `--mutate` controls; `tests/ffx_provider_loop_meta_check.py` runs every case individually and together and executes the exact 1:1 set of 5 mutations against real copies of the source. Linux verification (this head, `/tmp/pe-env/bin/python`): - `tests/ffx_provider_loop_check.py`: `ffx_provider_loop: 135 cases PASS` - `tests/ffx_provider_loop_meta_check.py`: `ffx_provider_loop: 135 cases, 5/5 mutations killed PASS` - `tests/form_coverage_check.py`: passed - `tests/docs_links_check.py`: passed (208 files, 802 links) - `tests/bidi_controls_check.py`: passed (2826 files, no bidirectional controls) - Scratch CMake + CTest for the new fragment: 6/6 passed (base check + 5 WILL_FAIL mutation controls) - `git diff --check` clean; `git status` shows only the 5 new files, zero personal paths No mingw on this host, so no Windows compile check; WIN-VERIFY run is the arbiter. AI-assisted. <!-- WIN-VERIFY: passed | sha=c8f766c7072aec81cd8aa2273881d873f3b259d3 | targets=none | ctest=^ffx_provider_loop | release=true --> ### Windows Verification (`c8f766c7`) - `git merge-tree --write-tree upstream/main HEAD` -> `242c5aac` (exit 0), `git diff --check` clean - Python checks: `py_compile`, `ffx_provider_loop_check.py`, `ffx_provider_loop_meta_check.py`, `form_coverage_check.py`, `docs_links_check.py` (209 files, 809 links), `bidi_controls_check.py` (2829 files) passed - Commands: ```text python -B tests/ffx_provider_loop_meta_check.py ctest --preset dev --no-tests=error -R "^ffx_provider_loop" --output-on-failure ctest --preset release --no-tests=error -R "^ffx_provider_loop" --output-on-failure ``` - Results: `ffx_provider_loop`: `135 cases, 5/5 mutations killed PASS`; `dev` 8/8 passed (5.85s, includes existing `ffx_provider_loop_hardware`/`warp` and 6 new tests); `release` 8/8 passed (5.67s). AI-assisted.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-01 13:31:42 +00:00
github manually merged commit c7344c33ed into main 2026-12-01 17:11:26 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.