Expand pure-Rust unit test coverage for switch parsing, A/B helpers and launcher profiles #14

Open
opened 2026-12-06 00:20:10 +00:00 by github-bot · 0 comments
Owner

@⁠VictoryX-dev on GitHub · 2026-12-03 02:57 UTC · original

Problem

Several pure-logic modules in victory-gpu and launcher handle user configuration, A/B phase scheduling, frame-metric percentile math and GPU/CPU profile selection. Expanding their unit test coverage protects contributors against silent regressions without requiring any title data or physical GPU hardware.

Known Evidence

  • Observed directly in source:
    • runtime/crates/victory-gpu/src/switch.rs parses boolean VICTORY_* values ("0" vs non-zero).
    • runtime/crates/victory-gpu/src/ab.rs parses VICTORY_AB=<seconds>,<SW1>[,...] and keeps a hand-maintained alphabetical READ table (where typos or out-of-order entries can silently break A/B runs).
    • runtime/crates/victory-gpu/src/frame_metrics.rs computes nearest-rank percentiles (p50, p95, p99, p99_9), low_1pct_fps / low_0_1pct_fps and tail-frame cost attribution.
    • launcher/src/hw.rs and launcher/src/profile.rs classify AMD/NVIDIA/Intel GPU generations, VRAM tiers and console profiles from plain structs.
  • Synthetic / Local verification: All of these tests run in seconds via cargo test.

Approaches That Did Not Work

  • Tests mutating global process environment variables in parallel: Causes flaky cross-test interference unless isolated via pure helper functions or child-process execution (as frame_metrics::tests already does). Always test pure parsing functions directly wherever possible.

Relevant Source Modules

  • runtime/crates/victory-gpu/src/switch.rs
  • runtime/crates/victory-gpu/src/ab.rs
  • runtime/crates/victory-gpu/src/frame_metrics.rs
  • launcher/src/hw.rs
  • launcher/src/profile.rs

Expected Contribution

  • Add pure unit tests covering edge cases such as:
    • ab.rs: verifying READ is strictly sorted alphabetically, rejects >8 switches, rejects seconds <= 1.0, handles whitespace/trailing commas and validates bitmask phase wrap-around.
    • frame_metrics.rs: boundary cases for Metrics::of (100% uniform frames, single extreme spike, exact 1% and 0.1% boundary counts).
    • launcher/src/hw.rs & profile.rs: additional synthetic GPU/CPU hardware profiles (e.g., Intel Arc Battlemage/Alchemist, AMD RDNA 2/3/4, NVIDIA Ada/Blackwell, 8 GB / 12 GB / 16 GB / 24 GB VRAM tiers and hybrid P/E-core CPUs).

Acceptance Criteria

  • All new tests are deterministic, parallel-safe and require zero proprietary files or physical GPU devices.
  • cargo test --workspace --locked (in runtime/) and cargo test (in launcher/) pass cleanly.
  • cargo clippy passes with -D warnings.
**@⁠VictoryX-dev** on GitHub · 2026-12-03 02:57 UTC · [original](https://github.com/VictoryX-dev/VictoryX/issues/14) ## Problem Several pure-logic modules in `victory-gpu` and `launcher` handle user configuration, A/B phase scheduling, frame-metric percentile math and GPU/CPU profile selection. Expanding their unit test coverage protects contributors against silent regressions without requiring any title data or physical GPU hardware. ## Known Evidence - **Observed directly in source:** - `runtime/crates/victory-gpu/src/switch.rs` parses boolean `VICTORY_*` values (`"0"` vs non-zero). - `runtime/crates/victory-gpu/src/ab.rs` parses `VICTORY_AB=<seconds>,<SW1>[,...]` and keeps a hand-maintained alphabetical `READ` table (where typos or out-of-order entries can silently break A/B runs). - `runtime/crates/victory-gpu/src/frame_metrics.rs` computes nearest-rank percentiles (`p50`, `p95`, `p99`, `p99_9`), `low_1pct_fps` / `low_0_1pct_fps` and tail-frame cost attribution. - `launcher/src/hw.rs` and `launcher/src/profile.rs` classify AMD/NVIDIA/Intel GPU generations, VRAM tiers and console profiles from plain structs. - **Synthetic / Local verification:** All of these tests run in seconds via `cargo test`. ## Approaches That Did Not Work - **Tests mutating global process environment variables in parallel:** Causes flaky cross-test interference unless isolated via pure helper functions or child-process execution (as `frame_metrics::tests` already does). Always test pure parsing functions directly wherever possible. ## Relevant Source Modules - `runtime/crates/victory-gpu/src/switch.rs` - `runtime/crates/victory-gpu/src/ab.rs` - `runtime/crates/victory-gpu/src/frame_metrics.rs` - `launcher/src/hw.rs` - `launcher/src/profile.rs` ## Expected Contribution - Add pure unit tests covering edge cases such as: - `ab.rs`: verifying `READ` is strictly sorted alphabetically, rejects >8 switches, rejects `seconds <= 1.0`, handles whitespace/trailing commas and validates bitmask phase wrap-around. - `frame_metrics.rs`: boundary cases for `Metrics::of` (100% uniform frames, single extreme spike, exact 1% and 0.1% boundary counts). - `launcher/src/hw.rs` & `profile.rs`: additional synthetic GPU/CPU hardware profiles (e.g., Intel Arc Battlemage/Alchemist, AMD RDNA 2/3/4, NVIDIA Ada/Blackwell, 8 GB / 12 GB / 16 GB / 24 GB VRAM tiers and hybrid P/E-core CPUs). ## Acceptance Criteria - [ ] All new tests are deterministic, parallel-safe and require zero proprietary files or physical GPU devices. - [ ] `cargo test --workspace --locked` (in `runtime/`) and `cargo test` (in `launcher/`) pass cleanly. - [ ] `cargo clippy` passes with `-D warnings`.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-06 00:20:10 +00:00
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/VictoryX-dev--VictoryX#14
No description provided.