tests: cover shader_compute_request parsing, keys, and validation #3736

Manually merged
github merged 2 commits from github-bot/gh-3734 into gh-pr/3734/base 2026-12-02 05:17:49 +00:00 AGit
Owner

@⁠Ammmae0x on GitHub · 2026-12-01 13:02 UTC · original
Ammmae0x:tests/shader-compute-request → main · +1456 −0 · 5 files · 2 commits · merged 2026-12-02 05:17 UTC

Refs #1149

Portable C++17 unit, refusal, and mutation tests for src/shader_compute_request.cpp, with zero edits to existing files (5 new files only, +1402/-0).

What is covered (10 cases in tests/shader_compute_request_check.cpp, linking only the check plus src/shader_compute_request.cpp):

  • fnv_and_keys: FNV-1a values and the pinned graphics (x2w-startup-shader-29 / rev-28 fallback), compute (x2w-startup-shader-29cs / rev-28cs, length-prefixed parts) and mesh (x2w-startup-mesh-57-4) keys; the graphics key is ambiguous across a part boundary while the compute key is not.
  • pixel_input_format_parse: format/parse round-trip, either field order, the 13-byte binary entry, and all exact errors.
  • rtv_variant: 1..8 formats, the 0xffffffff boundary, FNV-1a key match, and the exact invalid RTV variant request / invalid RTV variant values errors.
  • read_pixel_input, read_graphics, read_graphics_rtv, read_compute: synthetic req_<key> files, revision fallbacks, RTV variants resolving their base request, and the exact refusal strings.
  • validate_compute_shape, compute_wave32, read_container: the 28-byte state block A, the wave32 bit (byte 18, 0x10), and the native-container-1 container key with the 32-byte floor.

Mutation controls (tests/cmake/shader_compute_request.cmake, 5 WILL_FAIL TRUE): graphics revision, pixel-input contradiction, compute .desc code-size offset, wave32 bit, RTV format ceiling. The mutated file is the .cpp itself, so each control links the mutated copy directly. A CMake fragment smoke test in a scratch layout confirmed the fragment parses and all 5 mutant copies differ from the source.

Linux verification (this host, g++ 13.3.0):

  • tests/shader_compute_request_meta_check.py: PASS: shader compute request: 10 cases, 5/5 mutations killed (g++) (real test run all-at-once and per case, every mutation compiled against a real C++ copy, 1:1 with the CMake set, zero model-only mutants; temp dirs removed in finally).
  • tests/form_coverage_check.py, tests/docs_links_check.py (208 files / 802 links), tests/bidi_controls_check.py (2826 files): pass.
  • git diff --check: clean.

Notes:

  • The native g++ compile adds -Wno-error=missing-field-initializers only: the unmodified source triggers -Wmissing-field-initializers at the GraphicsRequest aggregate initialiser in read_graphics_request (the rtv_request/rtv_formats members have no explicit initialiser). Every other warning stays an error and the source is unchanged.
  • The read helper's "truncated compute request" guard is unreachable through the public entry points because both extent checks test desc.size() != 96 first and short-circuit; the suite pins the observable behaviour (a short .desc is refused as "inconsistent compute request") and documents this in docs/experiments/shader-compute-request.md.
  • No mingw on this host, so no Windows compile check; WIN-VERIFY run is the arbiter.

Windows Verification (b5c13ad0)

  • git merge-tree --write-tree upstream/main HEAD -> 971021e0 (exit 0), git diff --check clean
  • Python checks: py_compile, form_coverage_check.py, docs_links_check.py (209 files, 806 links), bidi_controls_check.py (2829 files) passed
  • Commands:
cmake --build --preset dev --target shader_compute_request_check shader_compute_request_graphics_revision_mut shader_compute_request_pixel_contradictory_mut shader_compute_request_compute_extent_code_offset_mut shader_compute_request_wave32_bit_mut shader_compute_request_rtv_format_boundary_mut
ctest --preset dev --no-tests=error -j16 -R "^shader_compute_request" --repeat until-fail:5 --output-on-failure
cmake --build --preset release --target shader_compute_request_check shader_compute_request_graphics_revision_mut shader_compute_request_pixel_contradictory_mut shader_compute_request_compute_extent_code_offset_mut shader_compute_request_wave32_bit_mut shader_compute_request_rtv_format_boundary_mut
ctest --preset release --no-tests=error -j16 -R "^shader_compute_request" --repeat until-fail:5 --output-on-failure
  • Results: dev 16/16 x 5 repetitions passed (1.19s); release 16/16 x 5 repetitions passed (1.12s); shader_compute_request_check: PASS: shader_compute_request: 10/10 cases passed. AI-assisted.
**@⁠Ammmae0x** on GitHub · 2026-12-01 13:02 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3734) `Ammmae0x:tests/shader-compute-request` → `main` · +1456 −0 · 5 files · 2 commits · merged 2026-12-02 05:17 UTC Refs #1149 Portable C++17 unit, refusal, and mutation tests for `src/shader_compute_request.cpp`, with zero edits to existing files (5 new files only, +1402/-0). What is covered (10 cases in `tests/shader_compute_request_check.cpp`, linking only the check plus `src/shader_compute_request.cpp`): - `fnv_and_keys`: FNV-1a values and the pinned graphics (`x2w-startup-shader-29` / rev-28 fallback), compute (`x2w-startup-shader-29cs` / rev-28cs, length-prefixed parts) and mesh (`x2w-startup-mesh-57-4`) keys; the graphics key is ambiguous across a part boundary while the compute key is not. - `pixel_input_format_parse`: format/parse round-trip, either field order, the 13-byte binary entry, and all exact errors. - `rtv_variant`: 1..8 formats, the `0xffffffff` boundary, FNV-1a key match, and the exact `invalid RTV variant request` / `invalid RTV variant values` errors. - `read_pixel_input`, `read_graphics`, `read_graphics_rtv`, `read_compute`: synthetic `req_<key>` files, revision fallbacks, RTV variants resolving their base request, and the exact refusal strings. - `validate_compute_shape`, `compute_wave32`, `read_container`: the 28-byte state block A, the wave32 bit (byte 18, `0x10`), and the `native-container-1` container key with the 32-byte floor. Mutation controls (`tests/cmake/shader_compute_request.cmake`, 5 `WILL_FAIL TRUE`): graphics revision, pixel-input contradiction, compute `.desc` code-size offset, wave32 bit, RTV format ceiling. The mutated file is the `.cpp` itself, so each control links the mutated copy directly. A CMake fragment smoke test in a scratch layout confirmed the fragment parses and all 5 mutant copies differ from the source. Linux verification (this host, g++ 13.3.0): - `tests/shader_compute_request_meta_check.py`: `PASS: shader compute request: 10 cases, 5/5 mutations killed (g++)` (real test run all-at-once and per case, every mutation compiled against a real C++ copy, 1:1 with the CMake set, zero model-only mutants; temp dirs removed in `finally`). - `tests/form_coverage_check.py`, `tests/docs_links_check.py` (208 files / 802 links), `tests/bidi_controls_check.py` (2826 files): pass. - `git diff --check`: clean. Notes: - The native g++ compile adds `-Wno-error=missing-field-initializers` only: the unmodified source triggers `-Wmissing-field-initializers` at the `GraphicsRequest` aggregate initialiser in `read_graphics_request` (the `rtv_request`/`rtv_formats` members have no explicit initialiser). Every other warning stays an error and the source is unchanged. - The `read` helper's `"truncated compute request"` guard is unreachable through the public entry points because both extent checks test `desc.size() != 96` first and short-circuit; the suite pins the observable behaviour (a short `.desc` is refused as `"inconsistent compute request"`) and documents this in `docs/experiments/shader-compute-request.md`. - No mingw on this host, so no Windows compile check; WIN-VERIFY run is the arbiter. <!-- WIN-VERIFY: passed | sha=b5c13ad055b52df5c1e241eb48e10c4b012af03a | targets=shader_compute_request_check shader_compute_request_graphics_revision_mut shader_compute_request_pixel_contradictory_mut shader_compute_request_compute_extent_code_offset_mut shader_compute_request_wave32_bit_mut shader_compute_request_rtv_format_boundary_mut | ctest=^shader_compute_request | release=true --> ### Windows Verification (`b5c13ad0`) - `git merge-tree --write-tree upstream/main HEAD` -> `971021e0` (exit 0), `git diff --check` clean - Python checks: `py_compile`, `form_coverage_check.py`, `docs_links_check.py` (209 files, 806 links), `bidi_controls_check.py` (2829 files) passed - Commands: ```text cmake --build --preset dev --target shader_compute_request_check shader_compute_request_graphics_revision_mut shader_compute_request_pixel_contradictory_mut shader_compute_request_compute_extent_code_offset_mut shader_compute_request_wave32_bit_mut shader_compute_request_rtv_format_boundary_mut ctest --preset dev --no-tests=error -j16 -R "^shader_compute_request" --repeat until-fail:5 --output-on-failure cmake --build --preset release --target shader_compute_request_check shader_compute_request_graphics_revision_mut shader_compute_request_pixel_contradictory_mut shader_compute_request_compute_extent_code_offset_mut shader_compute_request_wave32_bit_mut shader_compute_request_rtv_format_boundary_mut ctest --preset release --no-tests=error -j16 -R "^shader_compute_request" --repeat until-fail:5 --output-on-failure ``` - Results: `dev` 16/16 x 5 repetitions passed (1.19s); `release` 16/16 x 5 repetitions passed (1.12s); `shader_compute_request_check`: `PASS: shader_compute_request: 10/10 cases passed`. AI-assisted.
Refs #1149

Portable C++17 unit, refusal, and mutation tests for
src/shader_compute_request.cpp with zero edits to existing files:
10 cases pinning exact FNV-1a/graphics/compute/mesh keys, pixel-input
and RTV-variant formats with every exact error, and file-backed
graphics/compute/container request reads, plus 5 WILL_FAIL TRUE
mutation controls.

Linux: meta check PASS (10 cases, 5/5 mutations killed, g++);
form/docs/bidi pass (208 files/802 links, 2826 files); git diff
--check clean. Windows verification pending.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-01 13:08:38 +00:00
Author
Owner

@⁠Leyukaka on GitHub · 2026-12-01 14:18 UTC · original · reviewed

Please give each TempDir instance a unique directory. It currently uses a fixed path per case and calls remove_all on that path at setup and teardown. A parallel CTest run can execute shader_compute_request_read_compute, shader_compute_request_all, and the compute extent mutant simultaneously. They all use the same read_compute directory, so one test can remove another test's fixtures.

An atomically created per-instance directory would keep these runs independent. Running the suite with CTest parallelism would verify the fix.

**@⁠Leyukaka** on GitHub · 2026-12-01 14:18 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3734#pullrequestreview-6133104304) · **reviewed** Please give each TempDir instance a unique directory. It currently uses a fixed path per case and calls remove_all on that path at setup and teardown. A parallel CTest run can execute shader_compute_request_read_compute, shader_compute_request_all, and the compute extent mutant simultaneously. They all use the same read_compute directory, so one test can remove another test's fixtures. An atomically created per-instance directory would keep these runs independent. Running the suite with CTest parallelism would verify the fix.
Refs #1149

Fix Leyukaka's P1 review comment on PR #3734: TempDir used a fixed
per-case path and called remove_all on setup, so parallel CTest runs
(shader_compute_request_read_compute, shader_compute_request_all,
shader_compute_request_compute_extent_code_offset_mut) deleted each
other's fixtures. Each instance now claims a unique directory
(process id + steady-clock tick + a per-process counter) atomically
with create_directory, retrying on collision; setup never removes
anything and only the destructor removes the instance's own
directory. The meta check pins the new contract (create_directory,
steady-clock tick, atomic counter, _getpid/getpid, exactly one
remove_all in ~TempDir()) and the experiment note documents it.

Linux: meta check PASS (10 cases, 5/5 mutations killed, g++);
ctest -j8 -R '^shader_compute_request' --repeat-until-fail 5:
16/16 x 5 repeats; form/docs/bidi pass (209 files/806 links,
2829 files); git diff --check clean. Windows verification pending.
Author
Owner

@⁠Ammmae0x on GitHub · 2026-12-01 14:32 UTC · original

@⁠Leyukaka Addressed in b5c13ad0: TempDir in tests/shader_compute_request_check.cpp now creates a unique per-instance path atomically with fs::create_directory (process ID + steady_clock tick + atomic counter, retrying on collision), with setup never removing anything and ~TempDir() removing only its own directory.

Verified under parallel CTest stress on Windows (16/16 tests x 5 repetitions at -j16):

ctest --preset dev --no-tests=error -j16 -R "^shader_compute_request" --repeat until-fail:5 --output-on-failure      # 16/16 x 5 passed (1.19s)
ctest --preset release --no-tests=error -j16 -R "^shader_compute_request" --repeat until-fail:5 --output-on-failure  # 16/16 x 5 passed (1.12s)

AI-assisted.

**@⁠Ammmae0x** on GitHub · 2026-12-01 14:32 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3734#issuecomment-7314438791) @⁠Leyukaka Addressed in `b5c13ad0`: `TempDir` in `tests/shader_compute_request_check.cpp` now creates a unique per-instance path atomically with `fs::create_directory` (process ID + `steady_clock` tick + atomic counter, retrying on collision), with setup never removing anything and `~TempDir()` removing only its own directory. Verified under parallel CTest stress on Windows (`16/16` tests x `5` repetitions at `-j16`): ```text ctest --preset dev --no-tests=error -j16 -R "^shader_compute_request" --repeat until-fail:5 --output-on-failure # 16/16 x 5 passed (1.19s) ctest --preset release --no-tests=error -j16 -R "^shader_compute_request" --repeat until-fail:5 --output-on-failure # 16/16 x 5 passed (1.12s) ``` AI-assisted.
github-bot changed target branch from main to gh-pr/3734/base 2026-12-02 05:17:35 +00:00
github manually merged commit b5c13ad055 into gh-pr/3734/base 2026-12-02 05:17:37 +00:00
Author
Owner

@⁠R0Y00 on GitHub · 2026-12-02 05:16 UTC · original · approved these changes

Confirmed the earlier temporary-directory concern is addressed at b5c13ad0. TempDir now claims paths atomically and cleans up only its own path. I built the base test and all five mutant executables with MSVC Debug, then ran ctest --preset dev --no-tests=error -j16 -R '^shader_compute_request' --repeat until-fail:5 --output-on-failure. All 16 tests passed five times, including all five mutation controls.

**@⁠R0Y00** on GitHub · 2026-12-02 05:16 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3734#pullrequestreview-6145160309) · **approved these changes** Confirmed the earlier temporary-directory concern is addressed at `b5c13ad0`. `TempDir` now claims paths atomically and cleans up only its own path. I built the base test and all five mutant executables with MSVC Debug, then ran `ctest --preset dev --no-tests=error -j16 -R '^shader_compute_request' --repeat until-fail:5 --output-on-failure`. All 16 tests passed five times, including all five mutation controls.
This discussion has been locked. Commenting is limited to contributors.
No description provided.