tests: cover guest shader container parser and identifiers #3701

Manually merged
github merged 1 commit from github-bot/gh-3699 into gh-pr/3699/base 2026-12-02 02:13:50 +00:00 AGit
Owner

@⁠Ammmae0x on GitHub · 2026-12-01 03:08 UTC · original
Ammmae0x:tests/guest-shader-container → main · +2275 −0 · 5 files · 1 commits · merged 2026-12-02 02:08 UTC

Refs #1149

Portable C++17 unit, refusal, and mutation tests for read_guest_shader_container, native_shader_identifier, GuestShaderStage::physical_user_sgpr and GuestShaderStage::full_precision_code (src/guest_shader_container.cpp), with zero edits to existing files (5 new files only, +2275/-0).

What landed (commit a8d65ef8):

  • tests/guest_shader_container_check.cpp: 69 cases, linking only the check plus src/guest_shader_container.cpp (the zlib streams are encoded as stored deflate blocks with an Adler-32 trailer directly in C++, so there is no external zlib dependency). 34 valid paths pin the exact parsed fields: the two V_NOP identifier halves, merged (+8) vs direct (+0) SGPR offsets, full-precision patching, vs/ps/ms/cs stages, HASH, PSV0 mesh stride (max vs threads[0] fallback), ISGN/ISG1/OSGN/OSG1 signatures, XDAT tag 13 filtering, 0xdeadbeefdeadbeef empty FSSM slots, resource/input arrays, and ps export patching (UINT32_MAX skipped, adjacent non-overlapping patches accepted). 35 refusals pin the exact std::runtime_error messages, including native stage size out of range for <16 bytes, >16MiB, and cumulative >64MiB.
  • tests/cmake/guest_shader_container.cmake: registers guest_shader_container_check plus 5 targeted WILL_FAIL TRUE copy mutations (sgpr_offset, identifier_offset, mesh_stride, xdat_tag, fssm_layout).
  • tests/guest_shader_container_meta_check.py: compiles and runs the real C++ check with g++ -std=c++17 and each CMake mutant copy (5/5 killed), cleaning temp dirs in finally.
  • tests/checks/python-linux/guest_shader_container.txt and docs/experiments/guest-shader-container.md.

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

/tmp/pe-env/bin/python -B tests/guest_shader_container_meta_check.py
PASS: guest shader container: 69 cases, 5/5 real C++ mutations killed
/tmp/pe-env/bin/python -B tests/form_coverage_check.py
form coverage checks passed
/tmp/pe-env/bin/python -B tests/docs_links_check.py
Checked 198 Markdown files and 765 links.
 /tmp/pe-env/bin/python -B tests/bidi_controls_check.py
Checked 2793 tracked source, script and build/CI files: no bidirectional controls.
 /tmp/pe-env/bin/python -B tools/run_checks_parallel.py --from-dir tests/checks/python-linux
all 80 checks passed
git diff --check
(clean)

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

Windows Verification (a8d65ef83d123d36eef792cd056bb754d28083f2)

Commit: a8d65ef83d123d36eef792cd056bb754d28083f2 (merge-tree upstream/main HEAD -> 3396c78d, exit 0; git diff --check clean)
dev: cmake --build --preset dev --target guest_shader_container_check ... && ctest --preset dev --no-tests=error -R '^guest_shader_container' --output-on-failure -> 75/75 passed (3.14s; 69 cases + all + 5/5 mutations killed)
release: cmake --build --preset release --target guest_shader_container_check ... && ctest --preset release --no-tests=error -R '^guest_shader_container' --output-on-failure -> 75/75 passed (2.25s; 69 cases + all + 5/5 mutations killed)
Direct binary (dev & release): PASS: guest_shader_container: 69/69 cases passed
Checks: form_coverage_check.py, docs_links_check.py (199 files, 769 links), bidi_controls_check.py (2796 files) -> passed

AI-assisted.

**@⁠Ammmae0x** on GitHub · 2026-12-01 03:08 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3699) `Ammmae0x:tests/guest-shader-container` → `main` · +2275 −0 · 5 files · 1 commits · merged 2026-12-02 02:08 UTC Refs #1149 Portable C++17 unit, refusal, and mutation tests for `read_guest_shader_container`, `native_shader_identifier`, `GuestShaderStage::physical_user_sgpr` and `GuestShaderStage::full_precision_code` (`src/guest_shader_container.cpp`), with zero edits to existing files (5 new files only, +2275/-0). What landed (commit `a8d65ef8`): - `tests/guest_shader_container_check.cpp`: 69 cases, linking only the check plus `src/guest_shader_container.cpp` (the zlib streams are encoded as stored deflate blocks with an Adler-32 trailer directly in C++, so there is no external zlib dependency). 34 valid paths pin the exact parsed fields: the two V_NOP identifier halves, merged (+8) vs direct (+0) SGPR offsets, full-precision patching, vs/ps/ms/cs stages, HASH, PSV0 mesh stride (max vs `threads[0]` fallback), ISGN/ISG1/OSGN/OSG1 signatures, XDAT tag 13 filtering, `0xdeadbeefdeadbeef` empty FSSM slots, resource/input arrays, and ps export patching (UINT32_MAX skipped, adjacent non-overlapping patches accepted). 35 refusals pin the exact `std::runtime_error` messages, including native stage size out of range for <16 bytes, >16MiB, and cumulative >64MiB. - `tests/cmake/guest_shader_container.cmake`: registers `guest_shader_container_check` plus 5 targeted WILL_FAIL TRUE copy mutations (sgpr_offset, identifier_offset, mesh_stride, xdat_tag, fssm_layout). - `tests/guest_shader_container_meta_check.py`: compiles and runs the real C++ check with `g++ -std=c++17` and each CMake mutant copy (5/5 killed), cleaning temp dirs in `finally`. - `tests/checks/python-linux/guest_shader_container.txt` and `docs/experiments/guest-shader-container.md`. Verification (Linux, this host, `g++ 13.3.0`): ```text /tmp/pe-env/bin/python -B tests/guest_shader_container_meta_check.py PASS: guest shader container: 69 cases, 5/5 real C++ mutations killed /tmp/pe-env/bin/python -B tests/form_coverage_check.py form coverage checks passed /tmp/pe-env/bin/python -B tests/docs_links_check.py Checked 198 Markdown files and 765 links. /tmp/pe-env/bin/python -B tests/bidi_controls_check.py Checked 2793 tracked source, script and build/CI files: no bidirectional controls. /tmp/pe-env/bin/python -B tools/run_checks_parallel.py --from-dir tests/checks/python-linux all 80 checks passed git diff --check (clean) ``` Caveat: no mingw on this host, so no Windows compile check; WIN-VERIFY run is the arbiter. ### Windows Verification (`a8d65ef83d123d36eef792cd056bb754d28083f2`) ```text Commit: a8d65ef83d123d36eef792cd056bb754d28083f2 (merge-tree upstream/main HEAD -> 3396c78d, exit 0; git diff --check clean) dev: cmake --build --preset dev --target guest_shader_container_check ... && ctest --preset dev --no-tests=error -R '^guest_shader_container' --output-on-failure -> 75/75 passed (3.14s; 69 cases + all + 5/5 mutations killed) release: cmake --build --preset release --target guest_shader_container_check ... && ctest --preset release --no-tests=error -R '^guest_shader_container' --output-on-failure -> 75/75 passed (2.25s; 69 cases + all + 5/5 mutations killed) Direct binary (dev & release): PASS: guest_shader_container: 69/69 cases passed Checks: form_coverage_check.py, docs_links_check.py (199 files, 769 links), bidi_controls_check.py (2796 files) -> passed ``` AI-assisted. <!-- WIN-VERIFY: passed | sha=a8d65ef83d123d36eef792cd056bb754d28083f2 | targets=guest_shader_container_check guest_shader_container_sgpr_offset_mut guest_shader_container_identifier_offset_mut guest_shader_container_mesh_stride_mut guest_shader_container_xdat_tag_mut guest_shader_container_fssm_layout_mut | ctest=^guest_shader_container | release=true -->
Refs #1149

Portable C++17 unit, refusal, and mutation tests for
read_guest_shader_container, native_shader_identifier,
GuestShaderStage::physical_user_sgpr and full_precision_code:
69 cases (34 valid, 35 refusals pinning the exact
std::runtime_error messages) plus 5 WILL_FAIL TRUE mutation
controls, all run on Linux with g++ -std=c++17.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-01 03:12:57 +00:00
github-bot changed target branch from main to gh-pr/3699/base 2026-12-02 02:13:48 +00:00
github manually merged commit a8d65ef83d into gh-pr/3699/base 2026-12-02 02:13:49 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.