tests: read the kept trap log with sharing in startup_view_heap #1994

Merged
JB2WIN merged 1 commit from upstream-pr/2001 into main 2026-11-24 23:30:10 +00:00
JB2WIN commented 2026-11-24 22:54:56 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by JB2WIN on 2026-11-24T22:54:56Z.


Problem

startup_view_heap_hardware fails on main on adapters that refuse the full shader-visible view heap. It fails at the second check, which counts the shortcut line in X2W_TRAP_LOG:

x2w-d3d12 Device::CreateDescriptorHeap: shortcut - title asked for 1245184 shader-visible view descriptors, this driver accepts 1000000; the rest stay in title memory
shortcut logged -1 times, expected 1

-1 means the test could not open the log. Built on the release preset, on an NVIDIA GeForce RTX 3080 (driver 32.0.16.2124) with Windows 11 build 26200, the test passes at the first parent of the #1757 merge (cd5508e9), fails at the merge 447c38df, and still fails at 1d825c18.

Cause. #1757 keeps the trap log open for appending (src/startup_stubs/trap.h, CreateFileW(..., FILE_APPEND_DATA, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, ...)). The test reads the file with _wfopen_s, and files opened with fopen_s/_wfopen_s are not shareable. The open therefore fails while the stand-in still holds its handle. Before #1757 the stand-in closed the file after every line, so the test could open it.

WARP accepts 1,245,184 descriptors directly, so startup_view_heap_warp is skipped. That is why CI did not show this.

Change

count_shortcut_lines now opens the log with _wfsopen(path, L"rb", _SH_DENYNO). Nothing else changes: no production code, and the same expectation of exactly one line.

Test

Run on the same machine, dev preset, at 1ebfe511 plus this commit:

ctest --preset dev --no-tests=error -R '^(startup_view_heap_|startup_local_log)'
  • startup_view_heap_hardware passes: "oversized heap accepted; shortcut logged once; 1245184 requested". Without this commit it fails as shown above.
  • startup_view_heap_warp is skipped (77): the adapter accepts the request.
  • startup_local_log and its three controls pass.

AI-assisted (Claude Code).

🤖 Generated with Claude Code

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6593052911 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2001). Originally posted by [JB2WIN](https://github.com/JB2WIN) on 2026-11-24T22:54:56Z. --- ## Problem `startup_view_heap_hardware` fails on `main` on adapters that refuse the full shader-visible view heap. It fails at the second check, which counts the shortcut line in `X2W_TRAP_LOG`: ```text x2w-d3d12 Device::CreateDescriptorHeap: shortcut - title asked for 1245184 shader-visible view descriptors, this driver accepts 1000000; the rest stay in title memory shortcut logged -1 times, expected 1 ``` -1 means the test could not open the log. Built on the release preset, on an NVIDIA GeForce RTX 3080 (driver 32.0.16.2124) with Windows 11 build 26200, the test passes at the first parent of the #1757 merge (`cd5508e9`), fails at the merge `447c38df`, and still fails at `1d825c18`. **Cause.** #1757 keeps the trap log open for appending (`src/startup_stubs/trap.h`, `CreateFileW(..., FILE_APPEND_DATA, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, ...)`). The test reads the file with `_wfopen_s`, and files opened with `fopen_s`/`_wfopen_s` are not shareable. The open therefore fails while the stand-in still holds its handle. Before #1757 the stand-in closed the file after every line, so the test could open it. WARP accepts 1,245,184 descriptors directly, so `startup_view_heap_warp` is skipped. That is why CI did not show this. ## Change `count_shortcut_lines` now opens the log with `_wfsopen(path, L"rb", _SH_DENYNO)`. Nothing else changes: no production code, and the same expectation of exactly one line. ## Test Run on the same machine, `dev` preset, at `1ebfe511` plus this commit: ```powershell ctest --preset dev --no-tests=error -R '^(startup_view_heap_|startup_local_log)' ``` - `startup_view_heap_hardware` passes: "oversized heap accepted; shortcut logged once; 1245184 requested". Without this commit it fails as shown above. - `startup_view_heap_warp` is skipped (77): the adapter accepts the request. - `startup_local_log` and its three controls pass. AI-assisted (Claude Code). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
tedin7 commented 2026-11-24 23:03:31 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T22:58:22Z.

Review: COMMENTED


Review of head 2c1dcdd62d86e11289d073a75ac3d8c1274dbb1f (1 file, tests/startup_view_heap_check.cpp, +5/-2).

Read the whole diff. It swaps _wfopen_s for _wfsopen(..., _SH_DENYNO) when the test reads the trap log, so the read works while the stand-ins keep the log open for appending. No CMake change, no new dependency, clean-room. P1: 0. P2: 0.

Commands executed locally:

  • python3 tests/docs_links_check.py: PASS
  • python3 tests/bidi_controls_check.py: PASS
  • git diff --check origin/main...HEAD: PASS
  • git merge-tree --write-tree --name-only origin/main HEAD: clean, no conflicts
  • Win2025 (x2w_pipe.py win2025 2001 --wait 900), Debug (dev) and Release /O2: both build and exit 0, but startup_view_heap_warp reports 0/1 passed and SKIPPED (exit 77) in both. WARP accepts the full descriptor request directly, so the shortcut path and the changed count_shortcut_lines are never reached.

Mutation check: not possible here. The changed code only runs on an adapter that refuses the full request. On WARP the test skips, so a mutation such as _SH_DENYNO -> _SH_DENYRW (the original failure) cannot be killed. A skip is not a pass, so I am not merging.

CI at review time: Linux checks pass, Build and test on Windows still pending, /O2 skipping.

Result: no defects found, no merge. To merge, show the changed read path running, for example on an adapter that refuses the full request, or a CI log where the shortcut line is counted.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6048729507 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2001#pullrequestreview-6048729507). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T22:58:22Z. **Review:** COMMENTED --- Review of head `2c1dcdd62d86e11289d073a75ac3d8c1274dbb1f` (1 file, tests/startup_view_heap_check.cpp, +5/-2). Read the whole diff. It swaps `_wfopen_s` for `_wfsopen(..., _SH_DENYNO)` when the test reads the trap log, so the read works while the stand-ins keep the log open for appending. No CMake change, no new dependency, clean-room. P1: 0. P2: 0. Commands executed locally: - `python3 tests/docs_links_check.py`: PASS - `python3 tests/bidi_controls_check.py`: PASS - `git diff --check origin/main...HEAD`: PASS - `git merge-tree --write-tree --name-only origin/main HEAD`: clean, no conflicts - Win2025 (`x2w_pipe.py win2025 2001 --wait 900`), Debug (`dev`) and Release `/O2`: both build and exit 0, but `startup_view_heap_warp` reports 0/1 passed and SKIPPED (exit 77) in both. WARP accepts the full descriptor request directly, so the shortcut path and the changed `count_shortcut_lines` are never reached. Mutation check: not possible here. The changed code only runs on an adapter that refuses the full request. On WARP the test skips, so a mutation such as `_SH_DENYNO` -> `_SH_DENYRW` (the original failure) cannot be killed. A skip is not a pass, so I am not merging. CI at review time: Linux checks pass, `Build and test on Windows` still pending, `/O2` skipping. Result: no defects found, no merge. To merge, show the changed read path running, for example on an adapter that refuses the full request, or a CI log where the shortcut line is counted. AI-assisted; commands listed were executed locally.
upstream-sync closed this pull request 2026-11-25 00:04:50 +00:00
RenzoWit35 commented 2026-11-25 01:01:57 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by RenzoWit35 on 2026-11-24T23:40:07Z.


Independent verification on a second NVIDIA family, plus an AMD integrated GPU and WARP. Before and after on the same machine, dev preset (Debug), building only startup_view_heap_check at each commit.

  • Windows 11 build 26300, MSVC 19.44.35230, Windows SDK 10.0.26100, debug layer not enabled.
  • Adapters selected with XBOX2WINDOWS_ADAPTER.
Adapter Driver 1ebfe511 (parent) 2c1dcdd6 (this PR)
NVIDIA GeForce RTX 4070 Ti (10de:2782) 32.0.16.2101 Failed: shortcut logged -1 times, expected 1 Passed: oversized heap accepted; shortcut logged once; 1245184 requested (3/3 runs)
AMD Radeon(TM) Graphics (1002:13c0) 32.0.13018.6 Skipped: adapter accepts 1245184 descriptors directly Skipped, same reason
WARP in-box Skipped, same reason Skipped, same reason

On the 4070 Ti the stand-in measured a limit of 1,000,000 shader-visible view descriptors, the same as the RTX 3080 in the description. The trap log written by the failing run contains exactly one shortcut line. That confirms the -1 comes from the open, not from the count. The AMD integrated GPU accepts the full request, so on that adapter the test doesn't exercise the shortcut either way.

Commands, per commit:

git checkout --detach <commit>
cmake --preset dev
cmake --build --preset dev --target startup_view_heap_check
$env:XBOX2WINDOWS_ADAPTER = 'NVIDIA'   # then 'Radeon'
ctest --test-dir out/build/dev -R '^startup_view_heap_hardware$' -V
ctest --test-dir out/build/dev -R '^startup_view_heap_warp$' -V

Separately, a full serial ctest --preset dev on main at 889cd3f4 on this machine gave 1257/1258 passing or skipped. startup_view_heap_hardware was the only failure.

AI-assisted (Claude Code); the runs above were executed on the hardware listed.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7147661708 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2001#issuecomment-7147661708). Originally posted by [RenzoWit35](https://github.com/RenzoWit35) on 2026-11-24T23:40:07Z. --- Independent verification on a second NVIDIA family, plus an AMD integrated GPU and WARP. Before and after on the same machine, `dev` preset (Debug), building only `startup_view_heap_check` at each commit. - Windows 11 build 26300, MSVC 19.44.35230, Windows SDK 10.0.26100, debug layer not enabled. - Adapters selected with `XBOX2WINDOWS_ADAPTER`. | Adapter | Driver | `1ebfe511` (parent) | `2c1dcdd6` (this PR) | |---|---|---|---| | NVIDIA GeForce RTX 4070 Ti (10de:2782) | 32.0.16.2101 | **Failed**: `shortcut logged -1 times, expected 1` | **Passed**: `oversized heap accepted; shortcut logged once; 1245184 requested` (3/3 runs) | | AMD Radeon(TM) Graphics (1002:13c0) | 32.0.13018.6 | Skipped: adapter accepts 1245184 descriptors directly | Skipped, same reason | | WARP | in-box | Skipped, same reason | Skipped, same reason | On the 4070 Ti the stand-in measured a limit of 1,000,000 shader-visible view descriptors, the same as the RTX 3080 in the description. The trap log written by the failing run contains exactly one shortcut line. That confirms the `-1` comes from the open, not from the count. The AMD integrated GPU accepts the full request, so on that adapter the test doesn't exercise the shortcut either way. Commands, per commit: ```powershell git checkout --detach <commit> cmake --preset dev cmake --build --preset dev --target startup_view_heap_check $env:XBOX2WINDOWS_ADAPTER = 'NVIDIA' # then 'Radeon' ctest --test-dir out/build/dev -R '^startup_view_heap_hardware$' -V ctest --test-dir out/build/dev -R '^startup_view_heap_warp$' -V ``` Separately, a full serial `ctest --preset dev` on `main` at `889cd3f4` on this machine gave 1257/1258 passing or skipped. `startup_view_heap_hardware` was the only failure. AI-assisted (Claude Code); the runs above were executed on the hardware listed.
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!1994
No description provided.