tests: cover standin_exports catalog builders and validation #3737

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

@⁠Ammmae0x on GitHub · 2026-12-01 13:12 UTC · original
Ammmae0x:tests/standin-exports → main · +1040 −0 · 4 files · 1 commits · merged 2026-12-01 17:06 UTC

Refs #1149

Portable unit, error-path and mutation tests for tools/standin_exports.py, with zero edits to existing files (tools/standin_exports.py untouched). Four new files only, +1040/-0, from origin/main 5a1644ad.

What landed

  • tests/standin_exports_check.py: runnable directly and with --mutate . Real-repo load_catalogs coverage across all DEFAULT_DEFS stems (xmem, d3d12_xs, acphal, chad, xapu, xcrdapi, xg_xs, gameinput), xgameruntime.dll and an unknown DLL: valid STATUSES, xmem/gameinput complete ordinals (ordinals_source set, absent ordinal -> absent) vs incomplete-ordinal DLLs (ordinals_source None, absent ordinal -> unmeasured), _D3D_DATA DATA exports in d3d12_xs resolving to src/d3d12_xs_iids.cpp:1, xgameruntime.dll implemented rows plus XGameRuntimeShimGetLog/ClearLog, and export_coverage shape for implemented/trap/absent/unmeasured/unknown.
  • Synthetic temporary repository trees covering every parser helper and its exact ValueError messages: invalid source/DEF UTF-8 encoding (plus UTF-8 BOM acceptance), _direct_exports / _direct_exports_with_includes (malformed direct export, duplicate export, backslash continuation lines skipped, relative vs src/ header lookup, cyclic include termination), _runtime_catalog (library declaration, missing thunk table, malformed row, unterminated table, unknown macro state -> unmeasured), _reviewed_sources (missing reviewed export, X2W_TRAP_EXPORT extraction), and _def_catalog / load_catalogs (NONAME ordinal-only exports, incomplete ordinal list disabling ordinals_source, OSError fallback yielding an empty Catalog()).
  • No bare exception-type-only assertions and no broad except: every refusal pins the exact exception type and message substring. Every temporary directory is removed in a finally block.
  • tests/cmake/standin_exports.cmake: registers standin_exports_check (CTest ^standin_exports).
  • tests/checks/python-linux/standin_exports.txt and docs/experiments/standin-exports.md.

Mutation note: the task lists five copy-mutations, but its fifth item splits into two distinct guards (malformed runtime row regex loosened, OSError fallback dropped), so the self-contained harness runs six copy-mutations of tools/standin_exports.py in a temporary sandbox, each loaded as a separate module and run against its control case: duplicate export guard dropped, incomplete ordinal list still marking absent ordinals, unknown runtime state mapped to implemented, _D3D_DATA classification dropped, malformed runtime row regex loosened (fullmatch -> match), OSError fallback dropped. All six are killed.

Linux checks (this host, /tmp/pe-env/bin/python -B)

  • tests/standin_exports_check.py: standin_exports: 470 cases, 6/6 mutations killed PASS
  • tests/standin_exports_check.py --mutate : each reports killed
  • tests/form_coverage_check.py: form coverage checks passed
  • tests/docs_links_check.py: Checked 208 Markdown files and 802 links
  • tests/bidi_controls_check.py: Checked 2826 tracked source, script and build/CI files: no bidirectional controls
  • git diff --check: clean

No mingw on this host, so no Windows compile check; Windows verification is the arbiter.

Windows Verification (b052036f)

  • git merge-tree --write-tree upstream/main HEAD -> e5a282c8 (exit 0), git diff --check clean
  • Python checks: py_compile, standin_exports_check.py, form_coverage_check.py, docs_links_check.py (209 files, 809 links), bidi_controls_check.py (2828 files) passed
  • Commands:
python -B tests/standin_exports_check.py
ctest --preset dev --no-tests=error -R "^standin_exports" --output-on-failure
ctest --preset release --no-tests=error -R "^standin_exports" --output-on-failure
  • Results: standin_exports: 470 cases, 6/6 mutations killed PASS; dev 1/1 passed (0.39s, total 0.55s); release 1/1 passed (0.40s, total 0.56s). AI-assisted.
**@⁠Ammmae0x** on GitHub · 2026-12-01 13:12 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3735) `Ammmae0x:tests/standin-exports` → `main` · +1040 −0 · 4 files · 1 commits · merged 2026-12-01 17:06 UTC Refs #1149 Portable unit, error-path and mutation tests for tools/standin_exports.py, with zero edits to existing files (tools/standin_exports.py untouched). Four new files only, +1040/-0, from origin/main 5a1644ad. What landed - tests/standin_exports_check.py: runnable directly and with --mutate <name>. Real-repo load_catalogs coverage across all DEFAULT_DEFS stems (xmem, d3d12_xs, acphal, chad, xapu, xcrdapi, xg_xs, gameinput), xgameruntime.dll and an unknown DLL: valid STATUSES, xmem/gameinput complete ordinals (ordinals_source set, absent ordinal -> absent) vs incomplete-ordinal DLLs (ordinals_source None, absent ordinal -> unmeasured), _D3D_DATA DATA exports in d3d12_xs resolving to src/d3d12_xs_iids.cpp:1, xgameruntime.dll implemented rows plus XGameRuntimeShimGetLog/ClearLog, and export_coverage shape for implemented/trap/absent/unmeasured/unknown. - Synthetic temporary repository trees covering every parser helper and its exact ValueError messages: invalid source/DEF UTF-8 encoding (plus UTF-8 BOM acceptance), _direct_exports / _direct_exports_with_includes (malformed direct export, duplicate export, backslash continuation lines skipped, relative vs src/ header lookup, cyclic include termination), _runtime_catalog (library declaration, missing thunk table, malformed row, unterminated table, unknown macro state -> unmeasured), _reviewed_sources (missing reviewed export, X2W_TRAP_EXPORT extraction), and _def_catalog / load_catalogs (NONAME ordinal-only exports, incomplete ordinal list disabling ordinals_source, OSError fallback yielding an empty Catalog()). - No bare exception-type-only assertions and no broad except: every refusal pins the exact exception type and message substring. Every temporary directory is removed in a finally block. - tests/cmake/standin_exports.cmake: registers standin_exports_check (CTest ^standin_exports). - tests/checks/python-linux/standin_exports.txt and docs/experiments/standin-exports.md. Mutation note: the task lists five copy-mutations, but its fifth item splits into two distinct guards (malformed runtime row regex loosened, OSError fallback dropped), so the self-contained harness runs six copy-mutations of tools/standin_exports.py in a temporary sandbox, each loaded as a separate module and run against its control case: duplicate export guard dropped, incomplete ordinal list still marking absent ordinals, unknown runtime state mapped to implemented, _D3D_DATA classification dropped, malformed runtime row regex loosened (fullmatch -> match), OSError fallback dropped. All six are killed. Linux checks (this host, /tmp/pe-env/bin/python -B) - tests/standin_exports_check.py: standin_exports: 470 cases, 6/6 mutations killed PASS - tests/standin_exports_check.py --mutate <each of the six names>: each reports killed - tests/form_coverage_check.py: form coverage checks passed - tests/docs_links_check.py: Checked 208 Markdown files and 802 links - tests/bidi_controls_check.py: Checked 2826 tracked source, script and build/CI files: no bidirectional controls - git diff --check: clean No mingw on this host, so no Windows compile check; Windows verification is the arbiter. <!-- WIN-VERIFY: passed | sha=b052036f46457b7910c15e1d652c611cbd59ae40 | targets=none | ctest=^standin_exports | release=true --> ### Windows Verification (`b052036f`) - `git merge-tree --write-tree upstream/main HEAD` -> `e5a282c8` (exit 0), `git diff --check` clean - Python checks: `py_compile`, `standin_exports_check.py`, `form_coverage_check.py`, `docs_links_check.py` (209 files, 809 links), `bidi_controls_check.py` (2828 files) passed - Commands: ```text python -B tests/standin_exports_check.py ctest --preset dev --no-tests=error -R "^standin_exports" --output-on-failure ctest --preset release --no-tests=error -R "^standin_exports" --output-on-failure ``` - Results: `standin_exports`: `470 cases, 6/6 mutations killed PASS`; `dev` 1/1 passed (0.39s, total 0.55s); `release` 1/1 passed (0.40s, total 0.56s). AI-assisted.
Refs #1149

Portable unit, error-path and mutation tests for tools/standin_exports.py
with zero edits to existing files: real-repo load_catalogs coverage
across all DEFAULT_DEFS stems, xgameruntime.dll and an unknown DLL;
synthetic temporary trees covering every parser helper and its exact
ValueError messages; and a self-contained harness running six
copy-mutations of tools/standin_exports.py in a temporary sandbox,
all killed.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-01 13:14:20 +00:00
github manually merged commit 8872841951 into main 2026-12-01 17:11:26 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.