lesavka/tests/manual/audio/tethys_downstream_audio_manual_contract.rs

55 lines
1.8 KiB
Rust

// Contract tests for the Tethys downstream audio sanity helper.
//
// Scope: inspect `scripts/manual/run_tethys_downstream_audio_sanity.sh`.
// Targets: downstream UAC host regressions where PipeWire routes audio into a
// broken zero-channel or zero-volume Lesavka sink.
const SCRIPT: &str = include_str!(concat!(
env!("CARGO_MANIFEST_DIR"),
"/scripts/manual/run_tethys_downstream_audio_sanity.sh"
));
#[test]
fn tethys_audio_probe_detects_zero_volume_and_channel_map_regressions() {
for expected in [
"LESAVKA_TETHYS_HOST",
"LESAVKA_TETHYS_AUDIO_REPAIR",
"LESAVKA_TETHYS_AUDIO_TIMEOUT_SECONDS",
"run_pactl()",
"pactl list short sinks",
"Volume:.* / 0% /",
"audio.channels=0",
"channelVolumes",
"channelMap",
"WirePlumber has persisted empty Lesavka channelVolumes/channelMap",
] {
assert!(
SCRIPT.contains(expected),
"Tethys downstream audio probe missing guard: {expected}"
);
}
}
#[test]
fn tethys_audio_probe_keeps_repair_explicit_and_non_sudo_by_default() {
for expected in [
"LESAVKA_TETHYS_AUDIO_REPAIR:-0",
"LESAVKA_TETHYS_AUDIO_RESTART:-0",
"restart Tethys user audio or replug/rebind",
"Tethys root-level audio-interface rebind, if the UAC graph is wedged",
"bInterfaceSubClass",
"/proc/asound/cards",
"print_rebind_hint",
"Tethys full composite re-enumeration, if audio interfaces bind but ALSA creates no PCM",
] {
assert!(
SCRIPT.contains(expected),
"Tethys downstream audio probe should make recovery explicit: {expected}"
);
}
assert!(
!SCRIPT.contains("sudo sh -c") || SCRIPT.contains("echo \" sudo sh -c"),
"the helper may print a sudo recovery command but must not run sudo itself"
);
}