2026-05-10 23:14:15 -03:00
|
|
|
// Include-based coverage for microphone startup cleanup paths.
|
|
|
|
|
//
|
|
|
|
|
// Scope: include `client/src/input/microphone.rs` and exercise startup
|
|
|
|
|
// failures without requiring a live microphone.
|
|
|
|
|
// Targets: `client/src/input/microphone.rs`.
|
|
|
|
|
// Why: startup failures should move the pipeline back to NULL before the
|
|
|
|
|
// capture object returns an error.
|
2026-04-22 08:07:09 -03:00
|
|
|
|
2026-04-25 16:48:20 -03:00
|
|
|
#[allow(warnings)]
|
|
|
|
|
mod live_capture_clock {
|
2026-05-10 23:14:15 -03:00
|
|
|
include!(concat!(
|
|
|
|
|
env!("CARGO_MANIFEST_DIR"),
|
|
|
|
|
"/tests/helpers/support/live_capture_clock_shim.rs"
|
|
|
|
|
));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[allow(warnings)]
|
|
|
|
|
mod input {
|
|
|
|
|
pub mod audio_codec {
|
|
|
|
|
pub use lesavka_client::input::audio_codec::*;
|
|
|
|
|
}
|
2026-04-25 16:48:20 -03:00
|
|
|
}
|
|
|
|
|
|
2026-04-22 08:07:09 -03:00
|
|
|
#[allow(warnings)]
|
|
|
|
|
mod microphone_startup_contract {
|
|
|
|
|
include!(env!("LESAVKA_CLIENT_MICROPHONE_SRC"));
|
|
|
|
|
|
|
|
|
|
use serial_test::serial;
|
|
|
|
|
use temp_env::with_var;
|
|
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
|
#[cfg(coverage)]
|
|
|
|
|
#[serial]
|
|
|
|
|
fn startup_failure_cleans_up_pipeline_state() {
|
|
|
|
|
gst::init().ok();
|
|
|
|
|
with_var("LESAVKA_MIC_SOURCE", None::<&str>, || {
|
|
|
|
|
with_var(
|
|
|
|
|
"LESAVKA_MIC_TEST_SOURCE_DESC",
|
|
|
|
|
Some("filesrc location=/definitely-missing-lesavka-mic.raw"),
|
|
|
|
|
|| {
|
|
|
|
|
let result = MicrophoneCapture::new();
|
|
|
|
|
assert!(result.is_err(), "missing filesrc should fail startup");
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|