Skip to content

[upstream #1731] Tests: pin gpu::adapter name() DXGI DESC1 extraction contract - #397

Open
ufoptg wants to merge 1 commit into
mainfrom
upstream-pr/1731
Open

ufoptg wants to merge 1 commit into
mainfrom
upstream-pr/1731

Conversation

@ufoptg

@ufoptg ufoptg commented Nov 25, 2026

Copy link
Copy Markdown
Owner

Adds crates/xcl/tests/gpu_adapter_desc.rs: an integration test pinning adapter::name() to return exactly the UTF-16 prefix of DXGI_ADAPTER_DESC1::Description up to the first NUL, capped at the 128-code-unit array. Constructs only default/NUL-padded descriptions (no device, no GPU); verifies trailing-NUL padding, 127/128-unit boundary truncation, NUL-in-middle, all-NUL/empty, NUL-first, and non-ASCII code units. No production code changed.

What is in it

  • crates/xcl/tests/gpu_adapter_desc.rs: new integration test file pinning xcl::gpu::adapter::name() against DXGI_ADAPTER_DESC1 values built directly (no device/GPU): trailing NUL padding, truncation at the 128-code-unit array boundary without terminator (127 and 128 units), NUL in the middle, all-NUL/empty array, NUL-first array, non-BMP code units (e.g. AMD ™).

Tested

  • Hardware / OS / Rust: AMD Ryzen 7 9800X3D 8-Core Processor, Windows 11 Pro 10.0.26100 (Build 26100), rustc 1.94.1 (e408947bf 2026-03-25), stable-x86_64-pc-windows-msvc, debug build
  • AMD (AMD Radeon(TM) Graphics (driver 32.0.21043.19003, DXC 1.9.2609, native wave64), XCL_ADAPTER=radeon): cargo test --workspace -- --test-threads=2 — 864 passed, 0 failed, 42 ignored (SKIPPED GPU tests: 1 (no heap windows))
  • Verification / negative control: Temporarily replaced the name() prefix computation with 'let n = desc.Description.len();' (and reverted with git checkout); the full new suite failed 6/6 (empty array, NUL-terminated empty, NUL-in-middle, non-BMP, trailing padding, truncated boundary); after revert, the suite passed 6/6 again.

Not tested

  • retail Xbox Series X|S title (not available on this host)
  • NVIDIA wave32 GPU (not run in this pass; verified on AMD Radeon native wave64)

AI use

  • Local AI (thinkingmachines_inkling-2-mini) assisted with diagnosis, implementation, tests, review, and description; all tests executed locally on AMD Radeon (native wave64).

Mirror of xcl-dev#1731 (auto-synced, do not edit).

Adds crates/xcl/tests/gpu_adapter_desc.rs, an integration test that constructs DXGI_ADAPTER_DESC1 values directly (no GPU/device) and asserts that adapter::name() returns exactly the UTF-16 prefix of Description up to the first NUL, capped at the 128-code-unit array: trailing NUL padding, truncated-at-boundary without terminator (127 and 128 units), NUL in the middle, all-NUL/empty, non-BMP code units (e.g. Radeon ™), and a NUL-first array. Uses Default::default() as the baseline instead of cloning a real adapter. No production code changed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants