Skip to content

test: Automated coverage for the GPU light's frontend half #943

Closed

Description

@zackees

Context

Two parts of the light live only in frontend C++ (frontend/utility/GpuStatus.cpp) and have no automated test:

  • reading the active adapter name, which was broken: it returned OpenGL;
  • the one-second frame-time sampling feeding FrameStats::from_samples.

The Rust classifier has 36 Tier 1 tests, but the bug was in the data the frontend passed to it.

Proposal

  • In Rust, treat a bare API name (OpenGL, Direct3D 11, Metal) passed as the adapter as a caller bug: log it once and report it in the JSON (adapterIsApiName: true). Tier 4 can then assert on it on every platform.
  • Make the sampling logic (ring buffer of 15, skip zeros) a small pure class with a frontend unit test in frontend/tests, if that harness builds in CI; otherwise move the logic into Rust.

Acceptance criteria

  • RED: a test that passes OpenGL as the adapter fails before the change, and so does a sampler test that pushes 20 samples and expects the last 15.
  • GREEN: both pass in CI.

Decisions

  • Prefer moving logic into Rust, where Tier 1 already runs on three OSes, over adding a new C++ test harness.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions