tests: cover ViewTable bounds, sampled_table_neighbor, and resolve_view_table #3758

Manually merged
github merged 1 commit from github-bot/gh-3756 into gh-pr/3756/base 2026-12-01 17:11:23 +00:00 AGit
Owner

@⁠Ammmae0x on GitHub · 2026-12-01 16:15 UTC · original
Ammmae0x:tests/logical-view-table-unit → main · +1241 −0 · 5 files · 1 commits · merged 2026-12-01 17:05 UTC

Refs #1149.

Standalone portable C++17 unit + 1:1 header-mutation tests for x2w_startup::ViewTable, sampled_table_neighbor, and resolve_view_table (src/startup_stubs/logical_view_table.h), with zero edits to existing files (5 new files only, +1241/-0). tests/startup_logical_view_table_check.cpp, tests/sampled_table_neighbor.cpp, and CMakeLists.txt are untouched; the disjoint logical_view_table_unit prefix keeps test names disjoint.

What landed — commit ddf61d4e, in the logical-view-table-unit worktree from origin/main 959306d4; main clone untouched.

tests/logical_view_table_unit_check.cpp covers 11 cases (CLI --case/<name> + all):

  • record_zero_address: zero address gives no record at any offset/size; default ViewTable{}; zero-byte table gives only the empty record at offset zero.
  • record_bounds: records inside a 128-byte window, exact-end records, an empty record at the exact end (offset == bytes && size == 0 returns address + bytes), offset > bytes refused even when empty, one-byte crossings refused.
  • record_overflow: size > bytes - offset refused even when size <= bytes (96/64, 64/65, 32/97), with exact-boundary records valid; SIZE_MAX/UINT64_MAX sizes and UINT64_MAX offsets refuse without wrapping.
  • neighbor_zero_increment: increment == 0 absent in either direction at any offset, readable never invoked.
  • neighbor_underflow_overflow: backward underflow (offset < increment) absent without invoking readable; offset == increment is not underflow and decodes the first record; forward overflow (offset > UINT64_MAX - increment) absent without invoking readable.
  • neighbor_bounds_readable: a 12-byte record in an 11-byte table, a neighbour at offset == bytes, and a next neighbour past a 24-byte table are absent without invoking readable; readable == false invokes the probe exactly once with the exact pointer and 12 bytes, prev and next.
  • neighbor_valid_words: valid prev/next neighbours decode all three uint32_t words ({10,20,30}, {40,50,60}, {70,80,90}), plus increment-4 prev decoding {30,40,50}.
  • resolve_zero_fields: each zero gpu/cpu/stride/count alone and all together resolve to nothing.
  • resolve_cpu_overflow: cpu > UINT64_MAX - bytes refused; exact top boundary cpu == UINT64_MAX - bytes resolves to the full table; same guard for the largest heap (UINT_MAX * UINT_MAX bytes).
  • resolve_handle_offset: handle < gpu refused (incl. below a top-of-address heap), offset >= bytes refused incl. offset == bytes, offset % stride != 0 refused.
  • resolve_valid_narrowing: base handle {cpu, bytes}, mid-table handles narrow to {cpu + offset, bytes - offset}, and a 64-bit count * stride product above 4 GiB (134217729 x 32 = 4294967328 bytes) resolves and narrows the same way.

Mutation controls — 6 WILL_FAIL TRUE BEFORE PRIVATE CMake header mutations, mirrored 1:1 in the meta check: record_overflow (size guard against bytes not bytes - offset), neighbor_underflow (off-by-one < to <=), neighbor_zero_inc (dropped !increment guard), resolve_cpu_overflow (dropped cpu guard), resolve_align_mod (dropped % stride guard), resolve_narrow_bytes (kept full bytes instead of bytes - offset).

Verification (Linux, this host)

  • Meta check: PASS: logical_view_table_unit: 11 cases, 6/6 mutations killed (g++)
  • Scratch CMake + CTest (fragment configured standalone via symlinked src/tests; full configure needs dxc, unavailable on Linux): 100% tests passed, 0 tests failed out of 18 (11 cases + all + 6 WILL_FAIL controls)
  • form_coverage_check.py: pass; docs_links_check.py: 208 files / 802 links pass; bidi_controls_check.py: 2827 files pass; git diff --check: clean; merge-tree exits 0
  • run_checks_parallel.py (full python-linux suite): all 299 checks passed

Caveat: no mingw on this host, so no Windows compile check; WIN-VERIFY run is the arbiter. Windows verification pending on ddf61d4e (MSVC CTest ^logical_view_table_unit).

Windows Verification (ddf61d4e)

  • git merge-tree --write-tree upstream/main HEAD -> d0e1e584 (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), logical_view_table_unit_meta_check.py (cl: 11 cases, 6/6 mutations killed) passed
  • Commands:
cmake --build --preset dev --target logical_view_table_unit_check logical_view_table_unit_record_overflow_mut logical_view_table_unit_neighbor_underflow_mut logical_view_table_unit_neighbor_zero_inc_mut logical_view_table_unit_resolve_cpu_overflow_mut logical_view_table_unit_resolve_align_mod_mut logical_view_table_unit_resolve_narrow_bytes_mut
ctest --preset dev --no-tests=error -j16 -R "^logical_view_table_unit" --output-on-failure
cmake --build --preset release --target logical_view_table_unit_check logical_view_table_unit_record_overflow_mut logical_view_table_unit_neighbor_underflow_mut logical_view_table_unit_neighbor_zero_inc_mut logical_view_table_unit_resolve_cpu_overflow_mut logical_view_table_unit_resolve_align_mod_mut logical_view_table_unit_resolve_narrow_bytes_mut
ctest --preset release --no-tests=error -j16 -R "^logical_view_table_unit" --output-on-failure
  • Results: dev 18/18 passed (1.03s); release 18/18 passed (0.99s); direct logical_view_table_unit_check.exe (dev & release): PASS: logical_view_table_unit: 11/11 cases passed. AI-assisted.
**@⁠Ammmae0x** on GitHub · 2026-12-01 16:15 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3756) `Ammmae0x:tests/logical-view-table-unit` → `main` · +1241 −0 · 5 files · 1 commits · merged 2026-12-01 17:05 UTC Refs #1149. Standalone portable C++17 unit + 1:1 header-mutation tests for `x2w_startup::ViewTable`, `sampled_table_neighbor`, and `resolve_view_table` (`src/startup_stubs/logical_view_table.h`), with zero edits to existing files (5 new files only, +1241/-0). `tests/startup_logical_view_table_check.cpp`, `tests/sampled_table_neighbor.cpp`, and `CMakeLists.txt` are untouched; the disjoint `logical_view_table_unit` prefix keeps test names disjoint. **What landed** — commit `ddf61d4e`, in the `logical-view-table-unit` worktree from `origin/main` `959306d4`; main clone untouched. `tests/logical_view_table_unit_check.cpp` covers 11 cases (CLI `--case`/`<name>` + all): - `record_zero_address`: zero address gives no record at any offset/size; default `ViewTable{}`; zero-byte table gives only the empty record at offset zero. - `record_bounds`: records inside a 128-byte window, exact-end records, an empty record at the exact end (`offset == bytes && size == 0` returns `address + bytes`), `offset > bytes` refused even when empty, one-byte crossings refused. - `record_overflow`: `size > bytes - offset` refused even when `size <= bytes` (96/64, 64/65, 32/97), with exact-boundary records valid; `SIZE_MAX`/`UINT64_MAX` sizes and `UINT64_MAX` offsets refuse without wrapping. - `neighbor_zero_increment`: `increment == 0` absent in either direction at any offset, readable never invoked. - `neighbor_underflow_overflow`: backward underflow (`offset < increment`) absent without invoking readable; `offset == increment` is not underflow and decodes the first record; forward overflow (`offset > UINT64_MAX - increment`) absent without invoking readable. - `neighbor_bounds_readable`: a 12-byte record in an 11-byte table, a neighbour at `offset == bytes`, and a next neighbour past a 24-byte table are absent without invoking readable; `readable == false` invokes the probe exactly once with the exact pointer and 12 bytes, prev and next. - `neighbor_valid_words`: valid prev/next neighbours decode all three `uint32_t` words (`{10,20,30}`, `{40,50,60}`, `{70,80,90}`), plus increment-4 prev decoding `{30,40,50}`. - `resolve_zero_fields`: each zero `gpu`/`cpu`/`stride`/`count` alone and all together resolve to nothing. - `resolve_cpu_overflow`: `cpu > UINT64_MAX - bytes` refused; exact top boundary `cpu == UINT64_MAX - bytes` resolves to the full table; same guard for the largest heap (`UINT_MAX * UINT_MAX` bytes). - `resolve_handle_offset`: `handle < gpu` refused (incl. below a top-of-address heap), `offset >= bytes` refused incl. `offset == bytes`, `offset % stride != 0` refused. - `resolve_valid_narrowing`: base handle `{cpu, bytes}`, mid-table handles narrow to `{cpu + offset, bytes - offset}`, and a 64-bit `count * stride` product above 4 GiB (134217729 x 32 = 4294967328 bytes) resolves and narrows the same way. **Mutation controls** — 6 `WILL_FAIL TRUE` `BEFORE PRIVATE` CMake header mutations, mirrored 1:1 in the meta check: `record_overflow` (size guard against `bytes` not `bytes - offset`), `neighbor_underflow` (off-by-one `<` to `<=`), `neighbor_zero_inc` (dropped `!increment` guard), `resolve_cpu_overflow` (dropped `cpu` guard), `resolve_align_mod` (dropped `% stride` guard), `resolve_narrow_bytes` (kept full `bytes` instead of `bytes - offset`). **Verification (Linux, this host)** - Meta check: `PASS: logical_view_table_unit: 11 cases, 6/6 mutations killed (g++)` - Scratch CMake + CTest (fragment configured standalone via symlinked src/tests; full configure needs dxc, unavailable on Linux): `100% tests passed, 0 tests failed out of 18` (11 cases + `all` + 6 `WILL_FAIL` controls) - `form_coverage_check.py`: pass; `docs_links_check.py`: 208 files / 802 links pass; `bidi_controls_check.py`: 2827 files pass; `git diff --check`: clean; merge-tree exits 0 - `run_checks_parallel.py` (full python-linux suite): `all 299 checks passed` Caveat: no mingw on this host, so no Windows compile check; WIN-VERIFY run is the arbiter. Windows verification pending on `ddf61d4e` (MSVC CTest `^logical_view_table_unit`). <!-- WIN-VERIFY: passed | sha=ddf61d4e7606fb301335045e6730c287457aa634 | targets=logical_view_table_unit_check logical_view_table_unit_record_overflow_mut logical_view_table_unit_neighbor_underflow_mut logical_view_table_unit_neighbor_zero_inc_mut logical_view_table_unit_resolve_cpu_overflow_mut logical_view_table_unit_resolve_align_mod_mut logical_view_table_unit_resolve_narrow_bytes_mut | ctest=^logical_view_table_unit | release=true --> ### Windows Verification (`ddf61d4e`) - `git merge-tree --write-tree upstream/main HEAD` -> `d0e1e584` (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), `logical_view_table_unit_meta_check.py` (`cl`: `11 cases, 6/6 mutations killed`) passed - Commands: ```text cmake --build --preset dev --target logical_view_table_unit_check logical_view_table_unit_record_overflow_mut logical_view_table_unit_neighbor_underflow_mut logical_view_table_unit_neighbor_zero_inc_mut logical_view_table_unit_resolve_cpu_overflow_mut logical_view_table_unit_resolve_align_mod_mut logical_view_table_unit_resolve_narrow_bytes_mut ctest --preset dev --no-tests=error -j16 -R "^logical_view_table_unit" --output-on-failure cmake --build --preset release --target logical_view_table_unit_check logical_view_table_unit_record_overflow_mut logical_view_table_unit_neighbor_underflow_mut logical_view_table_unit_neighbor_zero_inc_mut logical_view_table_unit_resolve_cpu_overflow_mut logical_view_table_unit_resolve_align_mod_mut logical_view_table_unit_resolve_narrow_bytes_mut ctest --preset release --no-tests=error -j16 -R "^logical_view_table_unit" --output-on-failure ``` - Results: `dev` 18/18 passed (1.03s); `release` 18/18 passed (0.99s); direct `logical_view_table_unit_check.exe` (`dev` & `release`): `PASS: logical_view_table_unit: 11/11 cases passed`. AI-assisted.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-01 16:18:06 +00:00
github-bot changed target branch from main to gh-pr/3756/base 2026-12-01 17:11:22 +00:00
github manually merged commit ddf61d4e76 into gh-pr/3756/base 2026-12-01 17:11:23 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.