tests: cover NativeCopyRanges span merge, split, and coverage #3700

Closed
Ammmae0x wants to merge 1 commit from upstream-pr/3700 into main
Ammmae0x commented 2026-12-01 03:11:05 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Ammmae0x on 2026-12-01T03:11:05Z.


Refs #1149

Portable C++17 unit and mutation tests for x2w_startup::NativeCopyRanges (src/startup_stubs/native_copy_ranges.h), previously untested directly in tests/. No existing file is modified; the header and device code are untouched.

New files (5, +832/-0):

  • tests/native_copy_ranges_check.cpp: 5 cases (empty_and_inverted, adjacent_coalesce, bridge_multi_spans, cpu_write, coverage) covering empty/inverted no-ops on add/cpu_write/coverage; adjacent touching spans merging to [10, 30) in both orders, containment and partial overlap; multi-span bridging ([0, 10), [20, 30), [40, 50) + add(5, 45) -> [0, 50)); cpu_write miss left/right/gap, middle split with both halves asserted, prefix/suffix trims, full single-span erase, and multi-span straddling erase with an untouched tail; coverage none/partial/full across exact boundaries, gaps, and the gap left by a split; plus offsets above 4 GiB and UINT64_MAX endpoints.
  • tests/cmake/native_copy_ranges.cmake: registers native_copy_ranges_check (per-case CTests + native_copy_ranges_all) and 5 WILL_FAIL TRUE header-mutation controls (adjacent merge, middle-split insert, prefix-trim begin update, coverage boundary, multi-span add lower bound).
  • tests/native_copy_ranges_meta_check.py: audits the contract and executes it natively with g++ -std=c++17 -Wall -Wextra -Werror (real test plus every mutation compiled against a real C++ copy; C++ and meta-check mutation sets are 1:1, no model-only mutation; temp dirs removed in finally).
  • tests/checks/python-linux/native_copy_ranges.txt and docs/experiments/native-copy-ranges.md.

Linux results (from origin/main 1a9ccbc4):

  • native_copy_ranges_meta_check.py: PASS: native copy ranges: 5 cases, 5/5 mutations killed (g++)
  • form_coverage_check.py, docs_links_check.py (198 files / 765 links), bidi_controls_check.py (2793 files): pass
  • CMake fragment smoke test in a scratch layout (configure + build + CTest): 11/11 pass (5 per-case + all + 5 WILL_FAIL controls)
  • git diff --check: clean; zero personal paths

Windows execution (MSVC) awaits Windows verification:

ctest --preset dev --no-tests=error -R '^native_copy_ranges' -V

Windows Verification (c937ca2ae98dddf5b1f4e9717004476adc9e9aba)

Commit: c937ca2ae98dddf5b1f4e9717004476adc9e9aba (merge-tree upstream/main HEAD -> d11a189c, exit 0; git diff --check clean)
dev: cmake --build --preset dev --target native_copy_ranges_check ... && ctest --preset dev --no-tests=error -R '^native_copy_ranges' --output-on-failure -> 11/11 passed (0.78s; 5 cases + all + 5/5 mutations killed)
release: cmake --build --preset release --target native_copy_ranges_check ... && ctest --preset release --no-tests=error -R '^native_copy_ranges' --output-on-failure -> 11/11 passed (0.77s; 5 cases + all + 5/5 mutations killed)
Direct binary (dev & release): PASS: native_copy_ranges: 5/5 cases passed
Checks: form_coverage_check.py, docs_links_check.py (199 files, 769 links), bidi_controls_check.py (2796 files) -> passed

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:5578188400 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3700). Originally posted by [Ammmae0x](https://github.com/Ammmae0x) on 2026-12-01T03:11:05Z. --- Refs #1149 Portable C++17 unit and mutation tests for `x2w_startup::NativeCopyRanges` (`src/startup_stubs/native_copy_ranges.h`), previously untested directly in `tests/`. No existing file is modified; the header and device code are untouched. New files (5, +832/-0): - `tests/native_copy_ranges_check.cpp`: 5 cases (`empty_and_inverted`, `adjacent_coalesce`, `bridge_multi_spans`, `cpu_write`, `coverage`) covering empty/inverted no-ops on `add`/`cpu_write`/`coverage`; adjacent touching spans merging to `[10, 30)` in both orders, containment and partial overlap; multi-span bridging (`[0, 10)`, `[20, 30)`, `[40, 50)` + `add(5, 45)` -> `[0, 50)`); `cpu_write` miss left/right/gap, middle split with both halves asserted, prefix/suffix trims, full single-span erase, and multi-span straddling erase with an untouched tail; `coverage` none/partial/full across exact boundaries, gaps, and the gap left by a split; plus offsets above 4 GiB and `UINT64_MAX` endpoints. - `tests/cmake/native_copy_ranges.cmake`: registers `native_copy_ranges_check` (per-case CTests + `native_copy_ranges_all`) and 5 `WILL_FAIL TRUE` header-mutation controls (adjacent merge, middle-split insert, prefix-trim begin update, coverage boundary, multi-span add lower bound). - `tests/native_copy_ranges_meta_check.py`: audits the contract and executes it natively with `g++ -std=c++17 -Wall -Wextra -Werror` (real test plus every mutation compiled against a real C++ copy; C++ and meta-check mutation sets are 1:1, no model-only mutation; temp dirs removed in `finally`). - `tests/checks/python-linux/native_copy_ranges.txt` and `docs/experiments/native-copy-ranges.md`. Linux results (from `origin/main` `1a9ccbc4`): - `native_copy_ranges_meta_check.py`: `PASS: native copy ranges: 5 cases, 5/5 mutations killed (g++)` - `form_coverage_check.py`, `docs_links_check.py` (198 files / 765 links), `bidi_controls_check.py` (2793 files): pass - CMake fragment smoke test in a scratch layout (configure + build + CTest): 11/11 pass (5 per-case + all + 5 `WILL_FAIL` controls) - `git diff --check`: clean; zero personal paths Windows execution (MSVC) awaits Windows verification: ```text ctest --preset dev --no-tests=error -R '^native_copy_ranges' -V ``` ### Windows Verification (`c937ca2ae98dddf5b1f4e9717004476adc9e9aba`) ```text Commit: c937ca2ae98dddf5b1f4e9717004476adc9e9aba (merge-tree upstream/main HEAD -> d11a189c, exit 0; git diff --check clean) dev: cmake --build --preset dev --target native_copy_ranges_check ... && ctest --preset dev --no-tests=error -R '^native_copy_ranges' --output-on-failure -> 11/11 passed (0.78s; 5 cases + all + 5/5 mutations killed) release: cmake --build --preset release --target native_copy_ranges_check ... && ctest --preset release --no-tests=error -R '^native_copy_ranges' --output-on-failure -> 11/11 passed (0.77s; 5 cases + all + 5/5 mutations killed) Direct binary (dev & release): PASS: native_copy_ranges: 5/5 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=c937ca2ae98dddf5b1f4e9717004476adc9e9aba | targets=native_copy_ranges_check native_copy_ranges_add_merge_mut native_copy_ranges_cpu_write_split_mut native_copy_ranges_cpu_write_prefix_trim_mut native_copy_ranges_coverage_boundary_mut native_copy_ranges_add_left_mut | ctest=^native_copy_ranges | release=true -->
Ammmae0x commented 2026-12-01 03:14:52 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Ammmae0x on 2026-12-01T03:14:52Z.


Superseded by merged #3654 (tests/startup_native_copy_ranges_check.cpp already covers src/startup_stubs/native_copy_ranges.h with unit tests, differential fuzzing, and 6 header mutations). Closing to avoid duplicate CI and review load.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7299501460 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3700#issuecomment-7299501460). Originally posted by [Ammmae0x](https://github.com/Ammmae0x) on 2026-12-01T03:14:52Z. --- Superseded by merged #3654 (`tests/startup_native_copy_ranges_check.cpp` already covers src/startup_stubs/native_copy_ranges.h with unit tests, differential fuzzing, and 6 header mutations). Closing to avoid duplicate CI and review load. AI-assisted.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
R0Y00/Xbox2Windows!3700
No description provided.