HLE: expand synthetic unit tests for apu.rs (1 -> 19 tests) #1137

Closed
github-bot wants to merge 1 commit from gh-pr/1137/head into gh-pr/1137/base
Owner

@⁠Vittorio17 on GitHub · 2026-11-24 16:07 UTC · original
Vittorio17:test/hle-apu-audit → main · +679 −0 · 1 files · 1 commits · closed without merging

Summary

Audits crates/victory-hle/src/modules/apu.rs and expands its deterministic synthetic unit tests from 1 to 19 passing tests. Packets are synthetic two-tone Opus streams encoded at test time via opus_pure, so there are no fixtures and no game data. Production code is unchanged.

Closes #1120.

Tests added

  • Connect validation matrix: null arguments, streams 0/501, commands_per_stream 0/17, memory 0, frames_per_output, E_NOTIMPL, and both accepted range endpoints.
  • Connect memory and event: 16-byte-aligned zeroed memory, and the result event created only when requested.
  • Activation: rejected channel counts leave the stream idle, ALREADY_ACTIVE on a second activation, mono and stereo streams.
  • Decode: determinism against a fresh decoder, first_frame and output-room clamping, planar DEINTERLEAVED_OUTPUT, mono output and stereo-to-mono downmix.
  • Process errors: null/empty input and output buffers, and BAD_PACKET leaving the title buffer untouched.
  • Commands: RESET restores initial decoder state; one result per command in order; per-stream QUEUE_FULL and slot release on dequeue; rejected commands leave no result behind.
  • Results: identity echo, PENDING_RESULTS, null arguments on every export, and SIGNAL/auto-reset event behaviour.
  • ABI: the console's structure sizes.

Verification (Windows 11 x64 MSVC, Rust 1.98.1)

  • rustfmt --edition 2024 --check crates/victory-hle/src/modules/apu.rs: PASS
  • cargo xtask policy: PASS (154 files ok)
  • cargo clippy -p victory-hle --all-targets --locked -- -D warnings: PASS (0 warnings)
  • cargo clippy -p victory-hle --all-targets --locked --features diagnostics -- -D warnings: PASS (0 warnings)
  • cargo test -p victory-hle --locked -- "modules::apu::tests": 19 passed, 0 failed

Cherry-picked from geiyiliyabumo/VIctory@d10138b (branch test/hle-apu-audit), as suggested in the issue.

**@⁠Vittorio17** on GitHub · 2026-11-24 16:07 UTC · [original](https://github.com/Marvisak/VIctory/pull/1137) `Vittorio17:test/hle-apu-audit` → `main` · +679 −0 · 1 files · 1 commits · closed without merging ## Summary Audits `crates/victory-hle/src/modules/apu.rs` and expands its deterministic synthetic unit tests from 1 to 19 passing tests. Packets are synthetic two-tone Opus streams encoded at test time via `opus_pure`, so there are no fixtures and no game data. Production code is unchanged. Closes #1120. ## Tests added - **Connect validation matrix**: null arguments, streams 0/501, commands_per_stream 0/17, memory 0, frames_per_output, E_NOTIMPL, and both accepted range endpoints. - **Connect memory and event**: 16-byte-aligned zeroed memory, and the result event created only when requested. - **Activation**: rejected channel counts leave the stream idle, `ALREADY_ACTIVE` on a second activation, mono and stereo streams. - **Decode**: determinism against a fresh decoder, `first_frame` and output-room clamping, planar `DEINTERLEAVED_OUTPUT`, mono output and stereo-to-mono downmix. - **Process errors**: null/empty input and output buffers, and `BAD_PACKET` leaving the title buffer untouched. - **Commands**: `RESET` restores initial decoder state; one result per command in order; per-stream `QUEUE_FULL` and slot release on dequeue; rejected commands leave no result behind. - **Results**: identity echo, `PENDING_RESULTS`, null arguments on every export, and `SIGNAL`/auto-reset event behaviour. - **ABI**: the console's structure sizes. ## Verification (Windows 11 x64 MSVC, Rust 1.98.1) - `rustfmt --edition 2024 --check crates/victory-hle/src/modules/apu.rs`: PASS - `cargo xtask policy`: PASS (154 files ok) - `cargo clippy -p victory-hle --all-targets --locked -- -D warnings`: PASS (0 warnings) - `cargo clippy -p victory-hle --all-targets --locked --features diagnostics -- -D warnings`: PASS (0 warnings) - `cargo test -p victory-hle --locked -- "modules::apu::tests"`: 19 passed, 0 failed Cherry-picked from `geiyiliyabumo/VIctory@d10138b` (branch `test/hle-apu-audit`), as suggested in the issue.
Cover xapu end to end without fixtures or game data: connect validation,
zeroed 16-byte-aligned memory, result-event creation, activation checks,
decode determinism, first_frame/output-room clamping, planar and mono
output, bad packets, reset, per-stream queue limits, result ordering and
echo, pending results, null arguments, and SIGNAL/auto-reset behaviour.

Packets are two-tone Opus streams encoded at test time with opus_pure.
Production code is unchanged.

Cherry-picked from geiyiliyabumo/VIctory@d10138b.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:20:55 +00:00
github-bot closed this pull request 2026-11-26 04:20:55 +00:00
Author
Owner

@⁠Zipettte on GitHub · 2026-11-24 18:01 UTC · original

Tested on AMD Radeon RX 7700 XT (RDNA3, gfx1101), driver 32.0.32029.2010, Windows 11, Rust 1.98.1 MSVC at 7d94b72: cargo test -p victory-hle passes, 113 passed / 0 failed. Workspace baseline on main (ffe310e) is green on the same machine (342 passed).

Tested with AI assistance (Claude).

**@⁠Zipettte** on GitHub · 2026-11-24 18:01 UTC · [original](https://github.com/Marvisak/VIctory/pull/1137#issuecomment-7140045287) Tested on AMD Radeon RX 7700 XT (RDNA3, gfx1101), driver 32.0.32029.2010, Windows 11, Rust 1.98.1 MSVC at 7d94b72: `cargo test -p victory-hle` passes, 113 passed / 0 failed. Workspace baseline on main (ffe310e) is green on the same machine (342 passed). _Tested with AI assistance (Claude)._
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 00:32 UTC · original

Automated triage for the maintainers. Closing because another open pull request covers the same change.

See #1212.

If this is mistaken, reply here with what was missed (or push a change and say so) and it will be looked at again. Thank you for the contribution.

**@⁠Marvisak** on GitHub · 2026-11-25 00:32 UTC · [original](https://github.com/Marvisak/VIctory/pull/1137#issuecomment-7148621101) Automated triage for the maintainers. Closing because another open pull request covers the same change. See #1212. If this is mistaken, reply here with what was missed (or push a change and say so) and it will be looked at again. Thank you for the contribution.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No reviewers
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!1137
No description provided.