tests: start the slowest ctest cases first #2478

Merged
tedin7 merged 4 commits from upstream-pr/2486 into main 2026-11-25 21:19:35 +00:00
tedin7 commented 2026-11-25 18:14:29 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T18:14:29Z.


Part of #1149 (no open CI-time issue found; nearest orchestration issue)

What this unblocks: shorter Windows checks per merge.

Sets the CTest COST property on the 25 slowest cases (about 26 to 56 s each in the Windows CI log), so ctest --parallel starts them first and the workers do not wait on a 50 s case at the very end. Scheduling order only: no test, argument, flag or assertion changes, no names added or removed (form_coverage name pins are untouched). Names that do not exist in a configuration are skipped with if(TEST ...). Expected saving: about 60 to 120 s of wall time per ctest job.

Verification:

  • git diff --stat origin/main: CMakeLists.txt only, 40 insertions, 0 deletions.
  • Full configure is not possible on Linux (find_program(DXC_EXECUTABLE) fails before and after this change). I configured the new block alone in a minimal CMake project with startup_debug and other: the generated CTestTestfile has COST "56" on startup_debug and nothing on other; absent names were skipped without error.
  • Coverage proof: add_test lines are untouched; the diff contains no removed lines, so the test name set and commands are identical.
  • Win2025 dev+release: pending Stage-2.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6610808525 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2486). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T18:14:29Z. --- Part of #1149 (no open CI-time issue found; nearest orchestration issue) What this unblocks: shorter Windows checks per merge. Sets the CTest `COST` property on the 25 slowest cases (about 26 to 56 s each in the Windows CI log), so `ctest --parallel` starts them first and the workers do not wait on a 50 s case at the very end. Scheduling order only: no test, argument, flag or assertion changes, no names added or removed (form_coverage name pins are untouched). Names that do not exist in a configuration are skipped with `if(TEST ...)`. Expected saving: about 60 to 120 s of wall time per ctest job. Verification: - `git diff --stat origin/main`: CMakeLists.txt only, 40 insertions, 0 deletions. - Full configure is not possible on Linux (`find_program(DXC_EXECUTABLE)` fails before and after this change). I configured the new block alone in a minimal CMake project with `startup_debug` and `other`: the generated CTestTestfile has `COST "56"` on `startup_debug` and nothing on `other`; absent names were skipped without error. - Coverage proof: `add_test` lines are untouched; the diff contains no removed lines, so the test name set and commands are identical. - Win2025 dev+release: pending Stage-2. AI-assisted; commands listed were executed locally.
ChazY11 commented 2026-11-25 19:04:15 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by ChazY11 on 2026-11-25T18:41:29Z.


The guard that makes this safe is there, and the list checks out against a real configuration

set_tests_properties on a name that does not exist is a hard CMake error, and this list names GPU tests that are absent in some configurations, so the one thing that had to be right is the guard:

foreach(i RANGE 0 ${X2W_SLOW_TEST_COSTS_LAST} 2)
    math(EXPR j "${i} + 1")
    list(GET X2W_SLOW_TEST_COSTS ${i} slow_name)
    list(GET X2W_SLOW_TEST_COSTS ${j} slow_cost)
    if(TEST ${slow_name})                      # <- this
        set_tests_properties(${slow_name} PROPERTIES COST ${slow_cost})
    endif()
endforeach()

if(TEST …) is the right predicate here (if(TARGET) would be wrong — these are tests, not targets). Without it, cmake --preset dev on a host without a GPU or on the Linux job would fail at configure time rather than skipping the entry.

Checked mechanically against a configured build

列表 50 项(名/成本成对: True)
ctest 本配置已知用例 1782 个
列表中本配置不存在: 0
成本全为整数: True
降序排列: True
重复名字: 0

So on this configuration every name resolves, the pairs are well-formed (50 items = 25 name/cost pairs), the costs are integers, and the list is already in descending order — which is what makes the scheduling intent readable. The 0 missing result is not evidence the guard is unnecessary: this configuration has both WARP and hardware adapters, so it registers more tests than the Linux job or a GPU-less host would.

Two things worth pinning

  1. The ordering property is unasserted. "Slowest first" is the whole point, and nothing checks that the list stays descending. A later edit that inserts a new entry in the middle would silently degrade the schedule with no signal. A three-line check in an existing Python check (read CMakeLists.txt, parse this list, assert costs == sorted(costs, reverse=True) and len(items) % 2 == 0) would make the invariant explicit — I ran exactly that by hand above, so it is cheap.

  2. The costs are measurements with no provenance. The header says "Measured seconds (Windows CI, approx.)" — good — but a stale cost is worse than no cost, because it produces a confidently wrong order. If these came from a specific CI run, naming it (commit or run date) lets the next person decide when to re-measure rather than guessing.

Effect on correctness

None: COST only affects scheduling under --parallel, as the comment says, and no test gains or loses a dependency. The change is safe to merge on that basis; the two notes above are about keeping it honest over time.

AI-assisted; the parse and the ctest -N comparison were run locally on Windows 11 build 26300.9974 (1782 registered tests, 25 cost entries all present).

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7171259734 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2486#issuecomment-7171259734). Originally posted by [ChazY11](https://github.com/ChazY11) on 2026-11-25T18:41:29Z. --- ## The guard that makes this safe is there, and the list checks out against a real configuration `set_tests_properties` on a name that does not exist is a hard CMake error, and this list names GPU tests that are absent in some configurations, so the one thing that had to be right is the guard: ```cmake foreach(i RANGE 0 ${X2W_SLOW_TEST_COSTS_LAST} 2) math(EXPR j "${i} + 1") list(GET X2W_SLOW_TEST_COSTS ${i} slow_name) list(GET X2W_SLOW_TEST_COSTS ${j} slow_cost) if(TEST ${slow_name}) # <- this set_tests_properties(${slow_name} PROPERTIES COST ${slow_cost}) endif() endforeach() ``` `if(TEST …)` is the right predicate here (`if(TARGET)` would be wrong — these are tests, not targets). Without it, `cmake --preset dev` on a host without a GPU or on the Linux job would fail at configure time rather than skipping the entry. ## Checked mechanically against a configured build ```text 列表 50 项(名/成本成对: True) ctest 本配置已知用例 1782 个 列表中本配置不存在: 0 成本全为整数: True 降序排列: True 重复名字: 0 ``` So on this configuration every name resolves, the pairs are well-formed (50 items = 25 name/cost pairs), the costs are integers, and the list is already in descending order — which is what makes the scheduling intent readable. The `0 missing` result is not evidence the guard is unnecessary: this configuration has both WARP and hardware adapters, so it registers more tests than the Linux job or a GPU-less host would. ## Two things worth pinning 1. **The ordering property is unasserted.** "Slowest first" is the whole point, and nothing checks that the list stays descending. A later edit that inserts a new entry in the middle would silently degrade the schedule with no signal. A three-line check in an existing Python check (read `CMakeLists.txt`, parse this list, assert `costs == sorted(costs, reverse=True)` and `len(items) % 2 == 0`) would make the invariant explicit — I ran exactly that by hand above, so it is cheap. 2. **The costs are measurements with no provenance.** The header says "Measured seconds (Windows CI, approx.)" — good — but a stale cost is worse than no cost, because it produces a confidently wrong order. If these came from a specific CI run, naming it (commit or run date) lets the next person decide when to re-measure rather than guessing. ## Effect on correctness None: `COST` only affects scheduling under `--parallel`, as the comment says, and no test gains or loses a dependency. The change is safe to merge on that basis; the two notes above are about keeping it honest over time. AI-assisted; the parse and the `ctest -N` comparison were run locally on Windows 11 build 26300.9974 (1782 registered tests, 25 cost entries all present).
tedin7 commented 2026-11-25 19:04:16 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T18:53:47Z.


Thanks. Both points are addressed in ce0dd308e.

  • Ordering is now enforced at configure time: the loop stops with FATAL_ERROR if the list has an odd length, a non-integer cost, or a cost larger than the one before it.
  • Provenance is now in the header comment: costs come from the Windows CI ctest log taken when the list was added (2026-11-25, main at a6c8d80dc), with a note to re-measure when the order looks wrong.

Commands run locally (Linux, minimal CMake project that include()s the exact block from CMakeLists.txt, with startup_debug and other registered):

  • Unchanged list: configure passes, generated CTestTestfile has COST "56" on startup_debug only.
  • startup_debug 56 changed to 10: configure fails with "must be in descending cost order".
  • Last cost removed (odd length): configure fails with "must hold name/cost pairs".
  • git diff --check: clean.

Win2025 dev+release on the new head is still pending.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7171549664 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2486#issuecomment-7171549664). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T18:53:47Z. --- Thanks. Both points are addressed in ce0dd308e. - Ordering is now enforced at configure time: the loop stops with `FATAL_ERROR` if the list has an odd length, a non-integer cost, or a cost larger than the one before it. - Provenance is now in the header comment: costs come from the Windows CI ctest log taken when the list was added (2026-11-25, main at a6c8d80dc), with a note to re-measure when the order looks wrong. Commands run locally (Linux, minimal CMake project that `include()`s the exact block from `CMakeLists.txt`, with `startup_debug` and `other` registered): - Unchanged list: configure passes, generated CTestTestfile has `COST "56"` on `startup_debug` only. - `startup_debug 56` changed to `10`: configure fails with "must be in descending cost order". - Last cost removed (odd length): configure fails with "must hold name/cost pairs". - `git diff --check`: clean. Win2025 dev+release on the new head is still pending. AI-assisted; commands listed were executed locally.
tedin7 commented 2026-11-25 20:04:43 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T19:27:03Z.


Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit ce0dd308eb3ff5379db617f789f0e29bad1bbc50:

  • Debug (--preset dev):
    • Build (cmake --build --preset dev -- -j 2): 593.91s (configure 2.15s)
    • Test (ctest --preset dev -R '^(startup_debug|startup_run_ps1|cpu_aot_xchg)' --parallel 2 --no-tests=error --output-on-failure): 3/3 passed (101.88s: startup_run_ps1 15.31s, startup_debug 66.75s, cpu_aot_xchg 86.31s)
  • Release /O2 (--preset release):
    • Build (cmake --build --preset release -- -j 2): 669.82s (configure 3.68s)
    • Test (ctest --preset release -R '^(startup_debug|startup_run_ps1|cpu_aot_xchg)' --parallel 2 --no-tests=error --output-on-failure): 3/3 passed (46.96s: startup_run_ps1 8.02s, cpu_aot_xchg 31.16s, startup_debug 46.84s)
  • sccache: -15/-34 hits; wall 1331.0s
<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7172313753 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2486#issuecomment-7172313753). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T19:27:03Z. --- Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit `ce0dd308eb3ff5379db617f789f0e29bad1bbc50`: - **Debug (`--preset dev`)**: - Build (`cmake --build --preset dev -- -j 2`): `593.91s` (configure `2.15s`) - Test (`ctest --preset dev -R '^(startup_debug|startup_run_ps1|cpu_aot_xchg)' --parallel 2 --no-tests=error --output-on-failure`): **3/3 passed** (`101.88s`: `startup_run_ps1` `15.31s`, `startup_debug` `66.75s`, `cpu_aot_xchg` `86.31s`) - **Release `/O2` (`--preset release`)**: - Build (`cmake --build --preset release -- -j 2`): `669.82s` (configure `3.68s`) - Test (`ctest --preset release -R '^(startup_debug|startup_run_ps1|cpu_aot_xchg)' --parallel 2 --no-tests=error --output-on-failure`): **3/3 passed** (`46.96s`: `startup_run_ps1` `8.02s`, `cpu_aot_xchg` `31.16s`, `startup_debug` `46.84s`) - `sccache`: -15/-34 hits; wall `1331.0s`
tedin7 commented 2026-11-25 21:01:34 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T20:53:07Z.


Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit 99199941f08ac87ca41ff6be3c098272ce630b8b:

  • Debug (--preset dev):
    • Build (cmake --build --preset dev -- -j 2): 87.88s (configure 1.99s)
    • Test (ctest --preset dev -R '^(startup_debug|startup_run_ps1|cpu_aot_xchg)' --parallel 2 --no-tests=error --output-on-failure): 3/3 passed (70.31s: startup_run_ps1 9.46s, cpu_aot_xchg 58.55s, startup_debug 70.18s)
  • Release /O2 (--preset release):
    • Build (cmake --build --preset release -- -j 2): 82.81s (configure 1.94s)
    • Test (ctest --preset release -R '^(startup_debug|startup_run_ps1|cpu_aot_xchg)' --parallel 2 --no-tests=error --output-on-failure): 3/3 passed (58.41s: startup_run_ps1 8.82s, cpu_aot_xchg 37.50s, startup_debug 58.29s)
  • sccache: 193/398 hits; wall 242.9s
<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7174320011 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2486#issuecomment-7174320011). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T20:53:07Z. --- Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit `99199941f08ac87ca41ff6be3c098272ce630b8b`: - **Debug (`--preset dev`)**: - Build (`cmake --build --preset dev -- -j 2`): `87.88s` (configure `1.99s`) - Test (`ctest --preset dev -R '^(startup_debug|startup_run_ps1|cpu_aot_xchg)' --parallel 2 --no-tests=error --output-on-failure`): **3/3 passed** (`70.31s`: `startup_run_ps1` `9.46s`, `cpu_aot_xchg` `58.55s`, `startup_debug` `70.18s`) - **Release `/O2` (`--preset release`)**: - Build (`cmake --build --preset release -- -j 2`): `82.81s` (configure `1.94s`) - Test (`ctest --preset release -R '^(startup_debug|startup_run_ps1|cpu_aot_xchg)' --parallel 2 --no-tests=error --output-on-failure`): **3/3 passed** (`58.41s`: `startup_run_ps1` `8.82s`, `cpu_aot_xchg` `37.50s`, `startup_debug` `58.29s`) - `sccache`: 193/398 hits; wall `242.9s`
chatgpt-codex-connector[bot commented 2026-11-25 21:01:35 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-25T20:53:25Z.


Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-25T20:55:29.427919Z 9919994 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7174326929 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2486#issuecomment-7174326929). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/chatgpt-codex-connector%5Bbot%5D) on 2026-11-25T20:53:25Z. --- <!-- codex-pull-request-review-summary --> <!-- codex-review-state:v1 {"code_review":{"commit_sha":"99199941f08ac87ca41ff6be3c098272ce630b8b","has_any_findings":false,"has_unresolved_findings":false,"status":"completed"},"security_review":{"commit_sha":null,"has_any_findings":null,"has_unresolved_findings":null,"status":null}} --> <details> <summary><strong>Codex Review Summary</strong>: ✅ Completed</summary> This comment shows the latest Codex review activity on this pull request. | Review | Status | Commit | Review trigger | | --- | --- | --- | --- | | 📝 **Code Review** | ✅ **Completed** <relative-time datetime="2026-11-25T20:55:29.427919Z">2026-11-25T20:55:29.427919Z</relative-time> | `9919994` | Draft marked ready | <details> <summary>ℹ️ About Codex in GitHub</summary> <br/> [Your team has set up Codex to review pull requests in this repo](https://chatgpt.com/codex/cloud/settings/general). Reviews are triggered when you - Open a pull request for review - Mark a draft as ready - Comment "@codex review" or "@codex security review". Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. </details> </details>
upstream-sync closed this pull request 2026-11-25 22:01:56 +00:00
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!2478
No description provided.