tests: fold NativeCopyRanges coverage into startup_native_copy_ranges #3866

Merged
Ammmae0x merged 5 commits from upstream-pr/3866 into main 2026-12-02 20:22:04 +00:00
Ammmae0x commented 2026-12-02 15:37:58 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Ammmae0x on 2026-12-02T15:37:58Z.


Addresses @R0Y00's CHANGES_REQUESTED review: the duplicate suite is gone and only the existing startup_native_copy_ranges suite is extended (Refs #1149).

What changed

All 5 native_copy_ranges_unit files are removed (git rm):

  • docs/experiments/native-copy-ranges-unit.md
  • tests/checks/python-linux/native_copy_ranges_unit.txt
  • tests/cmake/native_copy_ranges_unit.cmake
  • tests/native_copy_ranges_unit_check.cpp
  • tests/native_copy_ranges_unit_meta_check.py

Only the 4 existing startup_native_copy_ranges* files are modified (net diff vs origin/main: 4 files, +185/-28). No src/ change, no other files touched. Merged origin/main 7eebdb44 cleanly (merge commit 8b398f6f).

Newly caught cases (all in the existing suite)

In split_middle() (tests/startup_native_copy_ranges_check.cpp):

  • Left-overhang trim: [10, 20) minus [5, 15) -> [15, 20), plus touching no-ops [0, 15) and [20, 30) on the trimmed span.
  • Multi-span loop early stop: [0, 10), [20, 30), [40, 50) minus [0, 35) leaves [40, 50) untouched (the loop only visits spans beginning before the write ends).
  • Near-UINT64_MAX (kMax = UINT64_MAX): [kMax - 32, kMax - 16) + [kMax - 16, kMax) -> [kMax - 32, kMax) in both insertion orders; middle split by [kMax - 24, kMax - 8) -> [kMax - 32, kMax - 24), [kMax - 8, kMax); empty/inverted adds add(kMax, kMax) / add(kMax, kMax - 1) are no-ops.

In boundary_coverage():

  • Near-UINT64_MAX partial edge (kMax - 17, kMax - 15) on [kMax - 16, kMax) -> partial, and one-byte full suffix (kMax - 1, kMax) -> full.

One correction to the review request as written: it asked to add (0, 11) over [0, 10) -> partial, but that assertion already existed in boundary_coverage() (line 311) and was not duplicated. It is the pin that catches the new coverage_full control below.

Three new mutation controls (9 total, 1:1 in the meta check)

In tests/cmake/startup_native_copy_ranges.cmake (each fails configure loudly if its anchor is gone):

Control Dropped guard Caught by
startup_native_copy_ranges_cpu_write_left_trim_mut cpu_write suffix trim it->begin = end becomes = begin split_middle: left-overhang trim comes back [5, 20) instead of [15, 20)
startup_native_copy_ranges_cpu_write_split_begin_mut cpu_write split insert {end, old.end} becomes {begin, old.end} split_middle: the halves overlap, and touch at UINT64_MAX ([kMax - 24, kMax) vs [kMax - 32, kMax - 24))
startup_native_copy_ranges_coverage_full_mut coverage full test drops && end <= row->end boundary_coverage: (0, 11), (5, 25), (20, 31) all report full instead of partial

tests/startup_native_copy_ranges_meta_check.py now tests all 9 mutations 1:1 (6 existing + 3 new) and supports cl alongside g++ (Linux keeps -std=c++17 -O2 -Wall -Wextra -Werror). docs/experiments/startup-native-copy-ranges.md documents the added cases and controls.

Linux verification (this host)

  • python3 -B tests/startup_native_copy_ranges_meta_check.py — PASS: startup native copy ranges: 6 cases, 9/9 mutations killed (g++)
  • Scratch CMake + ctest -R '^startup_native_copy_ranges' — 16/16 tests passed (6 cases + all + 9 WILL_FAIL TRUE controls, each failing cleanly)
  • tests/form_coverage_check.py — passed
  • tests/docs_links_check.py — passed (248 Markdown files, 942 links)
  • tests/bidi_controls_check.py — passed (2977 files, no bidirectional controls)
  • git diff --check origin/main...HEAD — clean
  • git merge-tree --write-tree origin/main HEAD — exits 0

The full Python Linux suite was not waited on locally in this round; GitHub Actions runs the full workflow on push. No Windows CTest / MSVC run on this Linux host, so Windows verification stays the arbiter. Do not merge.

Windows Verification (d3cb0e78)

  • Clean git merge-tree --write-tree upstream/main HEAD and git diff --check.
  • MSVC dev: cmake --preset dev, built all 10 targets (startup_native_copy_ranges_check + 9 _mut targets), ctest --preset dev --no-tests=error -R '^startup_native_copy_ranges' --output-on-failure passed 16/16 (1.15s); direct startup_native_copy_ranges_check.exe printed PASS: startup_native_copy_ranges: 6/6 cases passed.
  • MSVC release: cmake --preset release, built all 10 targets, ctest --preset release --no-tests=error -R '^startup_native_copy_ranges' --output-on-failure passed 16/16 (0.92s).
  • Native cl meta check: python -B tests/startup_native_copy_ranges_meta_check.py printed PASS: startup native copy ranges: 6 cases, 9/9 mutations killed (cl).
  • Repo static checks on Windows: tests/docs_links_check.py (248 files, 942 links) and tests/bidi_controls_check.py (2977 files) passed.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:5609721623 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3866). Originally posted by [Ammmae0x](https://github.com/Ammmae0x) on 2026-12-02T15:37:58Z. --- Addresses @R0Y00's CHANGES_REQUESTED review: the duplicate suite is gone and only the existing `startup_native_copy_ranges` suite is extended (Refs #1149). ## What changed All 5 `native_copy_ranges_unit` files are removed (`git rm`): - `docs/experiments/native-copy-ranges-unit.md` - `tests/checks/python-linux/native_copy_ranges_unit.txt` - `tests/cmake/native_copy_ranges_unit.cmake` - `tests/native_copy_ranges_unit_check.cpp` - `tests/native_copy_ranges_unit_meta_check.py` Only the 4 existing `startup_native_copy_ranges*` files are modified (net diff vs `origin/main`: 4 files, +185/-28). No `src/` change, no other files touched. Merged `origin/main` `7eebdb44` cleanly (merge commit `8b398f6f`). ## Newly caught cases (all in the existing suite) In `split_middle()` (`tests/startup_native_copy_ranges_check.cpp`): - Left-overhang trim: `[10, 20)` minus `[5, 15) -> [15, 20)`, plus touching no-ops `[0, 15)` and `[20, 30)` on the trimmed span. - Multi-span loop early stop: `[0, 10), [20, 30), [40, 50)` minus `[0, 35)` leaves `[40, 50)` untouched (the loop only visits spans beginning before the write ends). - Near-`UINT64_MAX` (`kMax = UINT64_MAX`): `[kMax - 32, kMax - 16) + [kMax - 16, kMax) -> [kMax - 32, kMax)` in both insertion orders; middle split by `[kMax - 24, kMax - 8) -> [kMax - 32, kMax - 24), [kMax - 8, kMax)`; empty/inverted adds `add(kMax, kMax)` / `add(kMax, kMax - 1)` are no-ops. In `boundary_coverage()`: - Near-`UINT64_MAX` partial edge `(kMax - 17, kMax - 15)` on `[kMax - 16, kMax) -> partial`, and one-byte full suffix `(kMax - 1, kMax) -> full`. One correction to the review request as written: it asked to add `(0, 11)` over `[0, 10) -> partial`, but that assertion already existed in `boundary_coverage()` (line 311) and was not duplicated. It is the pin that catches the new `coverage_full` control below. ## Three new mutation controls (9 total, 1:1 in the meta check) In `tests/cmake/startup_native_copy_ranges.cmake` (each fails configure loudly if its anchor is gone): | Control | Dropped guard | Caught by | | --- | --- | --- | | `startup_native_copy_ranges_cpu_write_left_trim_mut` | `cpu_write` suffix trim `it->begin = end` becomes `= begin` | `split_middle`: left-overhang trim comes back `[5, 20)` instead of `[15, 20)` | | `startup_native_copy_ranges_cpu_write_split_begin_mut` | `cpu_write` split insert `{end, old.end}` becomes `{begin, old.end}` | `split_middle`: the halves overlap, and touch at `UINT64_MAX` (`[kMax - 24, kMax)` vs `[kMax - 32, kMax - 24)`) | | `startup_native_copy_ranges_coverage_full_mut` | `coverage` full test drops `&& end <= row->end` | `boundary_coverage`: `(0, 11)`, `(5, 25)`, `(20, 31)` all report `full` instead of `partial` | `tests/startup_native_copy_ranges_meta_check.py` now tests all 9 mutations 1:1 (6 existing + 3 new) and supports `cl` alongside `g++` (Linux keeps `-std=c++17 -O2 -Wall -Wextra -Werror`). `docs/experiments/startup-native-copy-ranges.md` documents the added cases and controls. ## Linux verification (this host) - `python3 -B tests/startup_native_copy_ranges_meta_check.py` — `PASS: startup native copy ranges: 6 cases, 9/9 mutations killed (g++)` - Scratch CMake + `ctest -R '^startup_native_copy_ranges'` — `16/16 tests passed` (6 cases + `all` + 9 `WILL_FAIL TRUE` controls, each failing cleanly) - `tests/form_coverage_check.py` — passed - `tests/docs_links_check.py` — passed (248 Markdown files, 942 links) - `tests/bidi_controls_check.py` — passed (2977 files, no bidirectional controls) - `git diff --check origin/main...HEAD` — clean - `git merge-tree --write-tree origin/main HEAD` — exits 0 The full Python Linux suite was not waited on locally in this round; GitHub Actions runs the full workflow on push. No Windows CTest / MSVC run on this Linux host, so Windows verification stays the arbiter. Do not merge. ## Windows Verification (`d3cb0e78`) - Clean `git merge-tree --write-tree upstream/main HEAD` and `git diff --check`. - MSVC `dev`: `cmake --preset dev`, built all 10 targets (`startup_native_copy_ranges_check` + 9 `_mut` targets), `ctest --preset dev --no-tests=error -R '^startup_native_copy_ranges' --output-on-failure` passed `16/16` (`1.15s`); direct `startup_native_copy_ranges_check.exe` printed `PASS: startup_native_copy_ranges: 6/6 cases passed`. - MSVC `release`: `cmake --preset release`, built all 10 targets, `ctest --preset release --no-tests=error -R '^startup_native_copy_ranges' --output-on-failure` passed `16/16` (`0.92s`). - Native `cl` meta check: `python -B tests/startup_native_copy_ranges_meta_check.py` printed `PASS: startup native copy ranges: 6 cases, 9/9 mutations killed (cl)`. - Repo static checks on Windows: `tests/docs_links_check.py` (248 files, 942 links) and `tests/bidi_controls_check.py` (2977 files) passed. AI-assisted. <!-- WIN-VERIFY: passed | sha=d3cb0e784905c7bf70d8d382eb883becde30f016 | ctest=^startup_native_copy_ranges | dev=16/16 | release=16/16 | cl_meta=6cases_9of9 -->
R0Y00 commented 2026-12-02 15:45:12 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-12-02T15:45:12Z.

Review: CHANGES_REQUESTED


Independent MSVC Debug ctest --preset dev --no-tests=error -R '^native_copy_ranges_unit' --output-on-failure passed 15/15, including the six mutation executables. The overlap remains: #3654 already checks empty/reversed spans, adjacency, bridge, split, trims and coverage, with differential fuzzing and six header mutations. This was also the reason #3700 was closed. A distinct CTest prefix avoids name collisions while both suites still compile and run the same coverage in CI. Please add only the new assertions and any uniquely distinguishing controls to the existing check. In particular, show which near-UINT64_MAX cases or mutation failures are newly caught.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6154168172 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3866#pullrequestreview-6154168172). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-12-02T15:45:12Z. **Review:** CHANGES_REQUESTED --- Independent MSVC Debug `ctest --preset dev --no-tests=error -R '^native_copy_ranges_unit' --output-on-failure` passed 15/15, including the six mutation executables. The overlap remains: #3654 already checks empty/reversed spans, adjacency, bridge, split, trims and coverage, with differential fuzzing and six header mutations. This was also the reason #3700 was closed. A distinct CTest prefix avoids name collisions while both suites still compile and run the same coverage in CI. Please add only the new assertions and any uniquely distinguishing controls to the existing check. In particular, show which near-`UINT64_MAX` cases or mutation failures are newly caught.
Ammmae0x commented 2026-12-02 16:33:37 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Ammmae0x on 2026-12-02T16:33:37Z.


@R0Y00 Addressed your review in d3cb0e78 (tests: fold NativeCopyRanges coverage into startup_native_copy_ranges):

  • Removed all five duplicate native_copy_ranges_unit* files; only the four existing startup_native_copy_ranges* files are touched (+185/-28, src/ unchanged).
  • Added only non-overlapping cases in tests/startup_native_copy_ranges_check.cpp: left-overhang trim + touching no-ops + early-stop multi-span write + explicit near-UINT64_MAX touching coalesces and split (split_middle), plus near-UINT64_MAX partial/full boundary checks (boundary_coverage, keeping existing (0, 11) on line 311 unduplicated).
  • Added 3 uniquely distinguishing WILL_FAIL TRUE controls (cpu_write_left_trim_mut, cpu_write_split_begin_mut, coverage_full_mut -> 9 total) in tests/cmake/startup_native_copy_ranges.cmake and tests/startup_native_copy_ranges_meta_check.py (with cl support alongside g++).
  • Windows verification on d3cb0e78: MSVC dev CTest 16/16 (1.15s), release CTest 16/16 (0.92s), python -B tests/startup_native_copy_ranges_meta_check.py 6 cases, 9/9 mutations killed (cl). Ready for re-review!

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7352123845 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3866#issuecomment-7352123845). Originally posted by [Ammmae0x](https://github.com/Ammmae0x) on 2026-12-02T16:33:37Z. --- @R0Y00 Addressed your review in `d3cb0e78` (`tests: fold NativeCopyRanges coverage into startup_native_copy_ranges`): - Removed all five duplicate `native_copy_ranges_unit*` files; only the four existing `startup_native_copy_ranges*` files are touched (`+185/-28`, `src/` unchanged). - Added only non-overlapping cases in `tests/startup_native_copy_ranges_check.cpp`: left-overhang trim + touching no-ops + early-stop multi-span write + explicit near-`UINT64_MAX` touching coalesces and split (`split_middle`), plus near-`UINT64_MAX` partial/full boundary checks (`boundary_coverage`, keeping existing `(0, 11)` on line 311 unduplicated). - Added 3 uniquely distinguishing `WILL_FAIL TRUE` controls (`cpu_write_left_trim_mut`, `cpu_write_split_begin_mut`, `coverage_full_mut` -> 9 total) in `tests/cmake/startup_native_copy_ranges.cmake` and `tests/startup_native_copy_ranges_meta_check.py` (with `cl` support alongside `g++`). - Windows verification on `d3cb0e78`: MSVC `dev` CTest `16/16` (`1.15s`), `release` CTest `16/16` (`0.92s`), `python -B tests/startup_native_copy_ranges_meta_check.py` `6 cases, 9/9 mutations killed (cl)`. Ready for re-review! AI-assisted.
R0Y00 commented 2026-12-02 16:42:09 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-12-02T16:42:09Z.

Review: APPROVED


Reviewed d3cb0e78. The new near-UINT64_MAX and split/trim assertions now run in the existing fixture, and its original differential fuzz check remains. Independent Windows/MSVC Debug ctest --preset dev --no-tests=error -j 1 -R '^startup_native_copy_ranges' passed 16/16, including all nine mutation controls.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6155112014 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3866#pullrequestreview-6155112014). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-12-02T16:42:09Z. **Review:** APPROVED --- Reviewed d3cb0e78. The new near-UINT64_MAX and split/trim assertions now run in the existing fixture, and its original differential fuzz check remains. Independent Windows/MSVC Debug `ctest --preset dev --no-tests=error -j 1 -R '^startup_native_copy_ranges'` passed 16/16, including all nine mutation controls.
R0Y00 commented 2026-12-02 19:32:42 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-12-02T19:32:42Z.

Review: APPROVED


Revalidated 8c50c14f after GitHub Update branch brought the #3883 fix into this PR. The four owned files are unchanged from d3cb0e78. Independent MSVC Debug ctest --preset dev --no-tests=error --output-on-failure -j 1 -R '^startup_native_copy_ranges' passed 16/16, including all nine mutation controls. The old Windows job's only failure was startup_indirect_mesh_lease_warp_dual-trace finding no req_*.m86; the new check is running on the fixed baseline.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6157516623 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3866#pullrequestreview-6157516623). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-12-02T19:32:42Z. **Review:** APPROVED --- Revalidated 8c50c14f after GitHub Update branch brought the #3883 fix into this PR. The four owned files are unchanged from d3cb0e78. Independent MSVC Debug `ctest --preset dev --no-tests=error --output-on-failure -j 1 -R '^startup_native_copy_ranges'` passed 16/16, including all nine mutation controls. The old Windows job's only failure was `startup_indirect_mesh_lease_warp_dual-trace` finding no `req_*.m86`; the new check is running on the fixed baseline.
R0Y00 commented 2026-12-02 19:37:58 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-12-02T19:37:58Z.

Review: COMMENTED


The updated Windows job passed, including the previously failing dual-trace WARP fixture. The remaining Linux job fails on standin_exports_check.py with d3d12_xs entries 84 != 83; I independently reproduced that failure on main. #3885 updates the export inventory. I'll recheck this branch when that fix lands.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6157600247 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3866#pullrequestreview-6157600247). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-12-02T19:37:58Z. **Review:** COMMENTED --- The updated Windows job passed, including the previously failing dual-trace WARP fixture. The remaining Linux job fails on `standin_exports_check.py` with `d3d12_xs entries 84 != 83`; I independently reproduced that failure on main. #3885 updates the export inventory. I'll recheck this branch when that fix lands.
R0Y00 commented 2026-12-02 20:05:08 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-12-02T20:05:08Z.

Review: APPROVED


Revalidated 3a696326 after GitHub Update branch brought #3885 into the baseline. The PR's own files are unchanged. Independent Windows/MSVC Debug ctest --preset dev --no-tests=error --output-on-failure -j 1 -R '^startup_native_copy_ranges' passed 16/16, including nine mutation controls. python -B tests/standin_exports_check.py passed all 476 checks and six mutation controls.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6158025571 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3866#pullrequestreview-6158025571). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-12-02T20:05:08Z. **Review:** APPROVED --- Revalidated 3a696326 after GitHub Update branch brought #3885 into the baseline. The PR's own files are unchanged. Independent Windows/MSVC Debug `ctest --preset dev --no-tests=error --output-on-failure -j 1 -R '^startup_native_copy_ranges'` passed 16/16, including nine mutation controls. `python -B tests/standin_exports_check.py` passed all 476 checks and six mutation controls.
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!3866
No description provided.