Skip to content

Test-helper duplication in crates/rdlp-ffmpeg/tests: migrate the 16 copies of ffmpeg_available() and 11 hand-rolled ffprobe calls to tests/common #640

Description

@crippledgeek

Raised in code review of #638.

Problem

crates/rdlp-ffmpeg/tests/ has no shared helper module, so each suite re-declares its own:

  • ffmpeg_available() — copied into 16 of 22 test files.
  • An ffprobe invocation with hand-written arg arrays — 11 files, each with slightly different -show_entries / -of handling and its own idea of what a failure looks like.

That last point is the real cost: the variants disagree on how to treat a failed probe, and at least one historical pattern in this repo scored a failed mux as a pass because it checked file size rather than decoding (the trap documented in #637/#638).

crates/rdlp-postprocess/tests/common/mod.rs already shows the right shape for this repo.

Done so far

#638 added crates/rdlp-ffmpeg/tests/common/mod.rs with ffmpeg_available, encoder_available, probe_audio_field, and decoded_audio_frames, and used it from the suites that PR introduced. The pre-existing 16 were deliberately left alone to keep that diff reviewable.

Scope

  • Migrate the remaining suites in crates/rdlp-ffmpeg/tests/ to mod common.
  • Fold the video-side probes into common too where they repeat (several suites probe codec_name/r_frame_rate the same way).
  • Keep the "decode, don't stat" rule as the single implementation, so no suite can reintroduce a size-based success check.

Mechanical and low-risk, but touches many files — worth doing as its own PR rather than riding along with a behavioral change.

Refs #638

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions