GPU: add synthetic unit tests for query.rs and signature.rs #897

Closed
opened 2026-11-26 04:14:08 +00:00 by github-bot · 2 comments
Owner

@⁠geiyiliyabumo on GitHub · 2026-11-24 13:44 UTC · original

Summary

Adds 8 deterministic synthetic unit tests for crates/victory-gpu/src/query.rs (previously 0 tests) and crates/victory-gpu/src/signature.rs (previously 0 tests). Production code is unchanged after auditing null/bounds/descriptor validation in both files.

Because external PR creation is currently restricted (collaborators_only), the CI-green branch is ready on my fork for cherry-pick / review:

  • Branch: geiyiliyabumo/VIctory@test/gpu-query-and-signature
  • Commit: geiyiliyabumo/VIctory@0be58e6 (based on main ffe310e)

Tests Added (Synthetic Only)

  • crates/victory-gpu/src/query.rs (+3 tests): null-desc rejection & probe ordering, S_FALSE probe + null-IID tolerance, interface answering across all 4 IIDs with full COM refcount lifecycle.
  • crates/victory-gpu/src/signature.rs (+5 tests): invalid/null descriptions, empty signatures (count 0 never dereferences pointer), layout null check & copy-out-of-title-memory semantics, interface/refcount lifecycle, and probe path.

Verification (Windows 11 x64 MSVC)

  • rustfmt --edition 2024 --check: PASS
  • cargo xtask policy: PASS (154 files ok)
  • cargo clippy -p victory-gpu --all-targets --locked -- -D warnings (default + --features diagnostics): PASS (0 warnings)
  • cargo test -p victory-gpu --locked -- query:: (3/3 PASS) & -- signature:: (5/5 PASS)

AI-assisted; synthetic tests only, no game files.

**@⁠geiyiliyabumo** on GitHub · 2026-11-24 13:44 UTC · [original](https://github.com/Marvisak/VIctory/issues/897) ### Summary Adds 8 deterministic synthetic unit tests for `crates/victory-gpu/src/query.rs` (previously 0 tests) and `crates/victory-gpu/src/signature.rs` (previously 0 tests). Production code is unchanged after auditing null/bounds/descriptor validation in both files. Because external PR creation is currently restricted (`collaborators_only`), the CI-green branch is ready on my fork for cherry-pick / review: - **Branch**: `geiyiliyabumo/VIctory@test/gpu-query-and-signature` - **Commit**: `geiyiliyabumo/VIctory@0be58e6` (based on `main` `ffe310e`) ### Tests Added (Synthetic Only) - `crates/victory-gpu/src/query.rs` (+3 tests): null-desc rejection & probe ordering, `S_FALSE` probe + null-IID tolerance, interface answering across all 4 IIDs with full COM refcount lifecycle. - `crates/victory-gpu/src/signature.rs` (+5 tests): invalid/null descriptions, empty signatures (count 0 never dereferences pointer), `layout` null check & copy-out-of-title-memory semantics, interface/refcount lifecycle, and probe path. ### Verification (Windows 11 x64 MSVC) - `rustfmt --edition 2024 --check`: **PASS** - `cargo xtask policy`: **PASS** (`154 files ok`) - `cargo clippy -p victory-gpu --all-targets --locked -- -D warnings` (default + `--features diagnostics`): **PASS** (0 warnings) - `cargo test -p victory-gpu --locked -- query::` (**3/3 PASS**) & `-- signature::` (**5/5 PASS**) *AI-assisted; synthetic tests only, no game files.*
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:14:08 +00:00
Author
Owner

@⁠DaniiL35 on GitHub · 2026-11-24 13:48 UTC · original

Verified branch 0be58e6 (on top of ffe310e):

Code & Specification Audit

Audited crates/victory-gpu/src/signature.rs and crates/victory-gpu/src/query.rs against the added tests:

  • Title Memory Isolation: arguments_are_copied_out_of_title_memory confirms that desc.arguments are immediately cloned into owned storage (arguments: Vec<[u32; 4]>), preventing use-after-free or data corruption when the guest application mutates or unmaps the descriptor buffer.
  • Empty Signature & Zero-Count Safety: signatures_without_arguments_stay_empty confirms that desc.count == 0 does not dereference desc.arguments even if non-null, correctly creating an empty signature without segfaulting.
  • Probing & Interface Negotiation:
    • creation_without_an_out_pointer_only_probes exercises the out.is_null() probe path returning S_FALSE, and confirms null IID returns E_NOINTERFACE without null-dereferencing.
    • signatures_answer_their_interfaces_and_count_references validates interface dispatch across SIGNATURE_IIDS (ID3D12CommandSignature and PAGEABLE_IIDS), E_NOINTERFACE for unknown/null IIDs, E_POINTER on null out pointers, and monotonic reference counting via object::release_boxed.
  • Similar lifetime and COM refcount validation applied to query.rs.

Verification & Policy Compliance

  • Purely synthetic tests in in-memory test harness; zero game assets or external dumps.
  • Passes cargo xtask policy.
  • Clean diff on top of main (ffe310e) with zero changes to production code.

Reviewed and verified. AI-assisted with Antigravity.

**@⁠DaniiL35** on GitHub · 2026-11-24 13:48 UTC · [original](https://github.com/Marvisak/VIctory/issues/897#issuecomment-7133377139) Verified branch `0be58e6` (on top of `ffe310e`): ### Code & Specification Audit Audited `crates/victory-gpu/src/signature.rs` and `crates/victory-gpu/src/query.rs` against the added tests: - **Title Memory Isolation**: `arguments_are_copied_out_of_title_memory` confirms that `desc.arguments` are immediately cloned into owned storage (`arguments: Vec<[u32; 4]>`), preventing use-after-free or data corruption when the guest application mutates or unmaps the descriptor buffer. - **Empty Signature & Zero-Count Safety**: `signatures_without_arguments_stay_empty` confirms that `desc.count == 0` does not dereference `desc.arguments` even if non-null, correctly creating an empty signature without segfaulting. - **Probing & Interface Negotiation**: - `creation_without_an_out_pointer_only_probes` exercises the `out.is_null()` probe path returning `S_FALSE`, and confirms null IID returns `E_NOINTERFACE` without null-dereferencing. - `signatures_answer_their_interfaces_and_count_references` validates interface dispatch across `SIGNATURE_IIDS` (`ID3D12CommandSignature` and `PAGEABLE_IIDS`), `E_NOINTERFACE` for unknown/null IIDs, `E_POINTER` on null out pointers, and monotonic reference counting via `object::release_boxed`. - Similar lifetime and COM refcount validation applied to `query.rs`. ### Verification & Policy Compliance - Purely synthetic tests in in-memory test harness; zero game assets or external dumps. - Passes `cargo xtask policy`. - Clean diff on top of `main` (`ffe310e`) with zero changes to production code. Reviewed and verified. AI-assisted with Antigravity.
Author
Owner

@⁠MichaelSmithAI on GitHub · 2026-11-24 14:00 UTC · original

Independent result for 0be58e6 on Wine 11.22, cross-compiled with the Win64 GNU LLVM toolchain. All three query tests and all five command-signature tests passed. That includes the creation probes, interface queries and reference counts, and the check that the signature retains its copied arguments after the caller changes the source memory. This used the exact test-only commit.

**@⁠MichaelSmithAI** on GitHub · 2026-11-24 14:00 UTC · [original](https://github.com/Marvisak/VIctory/issues/897#issuecomment-7133683797) Independent result for 0be58e6 on Wine 11.22, cross-compiled with the Win64 GNU LLVM toolchain. All three query tests and all five command-signature tests passed. That includes the creation probes, interface queries and reference counts, and the check that the signature retains its copied arguments after the caller changes the source memory. This used the exact test-only commit.
This discussion has been locked. Commenting is limited to contributors.
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.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory#897
No description provided.