tests: cover ViewHeapSelection and ComputeTables state and bounds #3757

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

@⁠Ammmae0x on GitHub · 2026-12-01 16:13 UTC · original
Ammmae0x:tests/list-compute-root-unit → main · +1231 −0 · 5 files · 1 commits · merged 2026-12-01 17:05 UTC

Refs #1149.

Standalone portable C++17 unit, boundary, and 1:1 header-mutation tests for x2w_startup::ViewHeapSelection and x2w_startup::ComputeTables in src/startup_stubs/list_compute_root.h, with zero edits to existing files (5 new files only, +1231/-0; disjoint list_compute_root_unit prefix, tests/startup_compute_root.cpp and CMakeLists.txt untouched).

ViewHeapSelection::note() (9 cases): defaults; logical == desktop (and below) selects nothing vs logical == desktop + 1 selecting the graphics heap only; a shader-visible note updates compute without clobbering graphics and vice versa; both sides from one note; a later note replacing the selected heaps.

ComputeTables (11 cases): initial signature() == nullptr with empty slots 0..15; valid sets at 0 and 15 and an overwrite at 7; the same signature or heap, and nullptr over an unset signature, keeping the tables; a different signature, nullptr over a set signature, or a different view heap clearing all 16 slots while keeping out_of_range_count() and the active signature; set_table at 16 and UINT_MAX refused and counted, table() past the range returning {0, 0}, and the refusal count surviving a signature change.

Mutation controls: 6 WILL_FAIL TRUE CMake header-copy controls (heap_strict_gt, compute_shader_visible, sig_change_clear, heap_change_clear, param_upper_bound, out_of_range_counter) mirrored 1:1 in tests/list_compute_root_unit_meta_check.py, which compiles and runs the real C++ check with g++ (or cl) and every mutant against a real C++ copy.

Caught in development: the compute_shader_visible mutant left shader_visible unused, tripping -Werror=unused-parameter, so its replacement keeps it via (void)shader_visible; loosening the parameter bound (>= to >) let set_table(16) write past the 16-entry array and abort under the stack protector, which CTest does not invert for WILL_FAIL, so that bound is mutated from the valid side instead (>= max_parameters - 1, caught by tables_set_table_ends).

Verification (Linux, this host, g++ -std=c++17):

/tmp/pe-env/bin/python -B tests/list_compute_root_unit_meta_check.py
PASS: list_compute_root_unit: 20 cases, 6/6 mutations killed (g++)

Scratch CMake + CTest (standalone configure of the fragment, via symlinked src/tests; the full configure needs DXC, unavailable on Linux):

ctest --test-dir /tmp/lcr-scratch/build --no-tests=error -R '^list_compute_root_unit'
100% tests passed, 0 tests failed out of 27

That is 20 per-case tests, list_compute_root_unit_all, and the 6 WILL_FAIL TRUE mutation controls. form_coverage_check.py passes, docs_links_check.py passes (208 files, 802 links), bidi_controls_check.py passes (2827 files), git diff --check is clean, merge-tree exits 0, and the full python-linux suite (tools/run_checks_parallel.py, from the CI workflow) passes with this check included:

all 299 checks passed

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

Windows Verification (30d19cba)

  • git merge-tree --write-tree upstream/main HEAD -> 3f8e3423 (exit 0), git diff --check upstream/main...HEAD clean
  • Repo checks: py_compile, form_coverage_check.py, docs_links_check.py (209 files, 806 links), bidi_controls_check.py (2830 files), list_compute_root_unit_meta_check.py (cl: 20 cases, 6/6 mutations killed) passed
  • Commands:
cmake --build --preset dev --target list_compute_root_unit_check list_compute_root_unit_heap_strict_gt_mut list_compute_root_unit_compute_shader_visible_mut list_compute_root_unit_sig_change_clear_mut list_compute_root_unit_heap_change_clear_mut list_compute_root_unit_param_upper_bound_mut list_compute_root_unit_out_of_range_counter_mut
ctest --preset dev --no-tests=error -j16 -R "^list_compute_root_unit" --output-on-failure
cmake --build --preset release --target list_compute_root_unit_check list_compute_root_unit_heap_strict_gt_mut list_compute_root_unit_compute_shader_visible_mut list_compute_root_unit_sig_change_clear_mut list_compute_root_unit_heap_change_clear_mut list_compute_root_unit_param_upper_bound_mut list_compute_root_unit_out_of_range_counter_mut
ctest --preset release --no-tests=error -j16 -R "^list_compute_root_unit" --output-on-failure
  • Results: dev 27/27 passed (1.10s); release 27/27 passed (0.93s); direct list_compute_root_unit_check.exe (dev & release): PASS: list_compute_root_unit: 20/20 cases passed. AI-assisted.
**@⁠Ammmae0x** on GitHub · 2026-12-01 16:13 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3755) `Ammmae0x:tests/list-compute-root-unit` → `main` · +1231 −0 · 5 files · 1 commits · merged 2026-12-01 17:05 UTC Refs #1149. Standalone portable C++17 unit, boundary, and 1:1 header-mutation tests for `x2w_startup::ViewHeapSelection` and `x2w_startup::ComputeTables` in `src/startup_stubs/list_compute_root.h`, with zero edits to existing files (5 new files only, +1231/-0; disjoint `list_compute_root_unit` prefix, `tests/startup_compute_root.cpp` and `CMakeLists.txt` untouched). **`ViewHeapSelection::note()`** (9 cases): defaults; `logical == desktop` (and below) selects nothing vs `logical == desktop + 1` selecting the graphics heap only; a shader-visible note updates compute without clobbering graphics and vice versa; both sides from one note; a later note replacing the selected heaps. **`ComputeTables`** (11 cases): initial `signature() == nullptr` with empty slots `0..15`; valid sets at 0 and 15 and an overwrite at 7; the same signature or heap, and `nullptr` over an unset signature, keeping the tables; a different signature, `nullptr` over a set signature, or a different view heap clearing all 16 slots while keeping `out_of_range_count()` and the active signature; `set_table` at 16 and `UINT_MAX` refused and counted, `table()` past the range returning `{0, 0}`, and the refusal count surviving a signature change. **Mutation controls**: 6 `WILL_FAIL TRUE` CMake header-copy controls (`heap_strict_gt`, `compute_shader_visible`, `sig_change_clear`, `heap_change_clear`, `param_upper_bound`, `out_of_range_counter`) mirrored 1:1 in `tests/list_compute_root_unit_meta_check.py`, which compiles and runs the real C++ check with `g++` (or `cl`) and every mutant against a real C++ copy. Caught in development: the `compute_shader_visible` mutant left `shader_visible` unused, tripping `-Werror=unused-parameter`, so its replacement keeps it via `(void)shader_visible`; loosening the parameter bound (`>=` to `>`) let `set_table(16)` write past the 16-entry array and abort under the stack protector, which CTest does not invert for `WILL_FAIL`, so that bound is mutated from the valid side instead (`>= max_parameters - 1`, caught by `tables_set_table_ends`). **Verification (Linux, this host, `g++ -std=c++17`)**: ```text /tmp/pe-env/bin/python -B tests/list_compute_root_unit_meta_check.py PASS: list_compute_root_unit: 20 cases, 6/6 mutations killed (g++) ``` Scratch CMake + CTest (standalone configure of the fragment, via symlinked `src`/`tests`; the full configure needs DXC, unavailable on Linux): ```text ctest --test-dir /tmp/lcr-scratch/build --no-tests=error -R '^list_compute_root_unit' 100% tests passed, 0 tests failed out of 27 ``` That is 20 per-case tests, `list_compute_root_unit_all`, and the 6 `WILL_FAIL TRUE` mutation controls. `form_coverage_check.py` passes, `docs_links_check.py` passes (208 files, 802 links), `bidi_controls_check.py` passes (2827 files), `git diff --check` is clean, merge-tree exits 0, and the full `python-linux` suite (`tools/run_checks_parallel.py`, from the CI workflow) passes with this check included: ```text all 299 checks passed ``` No mingw on this host, so no Windows compile check; WIN-VERIFY run is the arbiter. <!-- WIN-VERIFY: passed | sha=30d19cba293a48b243ef9fc6ae70be798dd3fb65 | targets=list_compute_root_unit_check list_compute_root_unit_heap_strict_gt_mut list_compute_root_unit_compute_shader_visible_mut list_compute_root_unit_sig_change_clear_mut list_compute_root_unit_heap_change_clear_mut list_compute_root_unit_param_upper_bound_mut list_compute_root_unit_out_of_range_counter_mut | ctest=^list_compute_root_unit | release=true --> ### Windows Verification (`30d19cba`) - `git merge-tree --write-tree upstream/main HEAD` -> `3f8e3423` (exit 0), `git diff --check upstream/main...HEAD` clean - Repo checks: `py_compile`, `form_coverage_check.py`, `docs_links_check.py` (209 files, 806 links), `bidi_controls_check.py` (2830 files), `list_compute_root_unit_meta_check.py` (`cl`: `20 cases, 6/6 mutations killed`) passed - Commands: ```text cmake --build --preset dev --target list_compute_root_unit_check list_compute_root_unit_heap_strict_gt_mut list_compute_root_unit_compute_shader_visible_mut list_compute_root_unit_sig_change_clear_mut list_compute_root_unit_heap_change_clear_mut list_compute_root_unit_param_upper_bound_mut list_compute_root_unit_out_of_range_counter_mut ctest --preset dev --no-tests=error -j16 -R "^list_compute_root_unit" --output-on-failure cmake --build --preset release --target list_compute_root_unit_check list_compute_root_unit_heap_strict_gt_mut list_compute_root_unit_compute_shader_visible_mut list_compute_root_unit_sig_change_clear_mut list_compute_root_unit_heap_change_clear_mut list_compute_root_unit_param_upper_bound_mut list_compute_root_unit_out_of_range_counter_mut ctest --preset release --no-tests=error -j16 -R "^list_compute_root_unit" --output-on-failure ``` - Results: `dev` 27/27 passed (1.10s); `release` 27/27 passed (0.93s); direct `list_compute_root_unit_check.exe` (`dev` & `release`): `PASS: list_compute_root_unit: 20/20 cases passed`. AI-assisted.
Refs #1149.

Standalone portable C++17 unit, boundary, and 1:1 header-mutation
tests for x2w_startup::ViewHeapSelection and ComputeTables in
src/startup_stubs/list_compute_root.h, with zero edits to existing
files (5 new files only, disjoint list_compute_root_unit prefix).
ViewHeapSelection: defaults, logical == desktop vs +1 for the
graphics heap, shader-visible updates to compute without
clobbering graphics and vice versa. ComputeTables: initial
signature nullptr with empty slots 0..15, valid sets at 0/15 and
overwrite at 7, same signature/heap and nullptr-over-unset keeping
tables, signature/heap changes clearing all 16 slots while keeping
out_of_range_count() and the active signature, set_table at 16 and
UINT_MAX refused and counted with table() past the range returning
an empty table. 6 WILL_FAIL TRUE CMake header-mutation controls
mirrored 1:1 in the meta check.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-01 16:18:03 +00:00
github manually merged commit 5994e514f3 into main 2026-12-01 17:05:17 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.