forge
Explore
Log in

Don't you dare go Hollow

Merge branch 'lane-reqffmpeg': have_ffmpeg() asserts under EC_AV1_REQUIRE_FFMPEG/EC_AV1_REQUIRE_AOMENC (was silent-false, short-circuiting every aomenc gate to a green SKIP); same fix in 4 helper copies

Browse files at this commit

1c1fd675f506845ce028d57d8a9e7bb49cd2489dAhmet Kaan GümüşParent: ae52c3491c1335
crates/ec-av1/src/decode.rsmodified+16 -2
@@ -13682,13 +13682,27 @@ mod tests {
1368213682 use std::io::Write;
1368313683 use std::process::{Command, Stdio};
1368413684
13685+ /// Whether ffmpeg is on PATH. Absence normally SKIPs, but
13686+ /// `EC_AV1_REQUIRE_FFMPEG=1` -- or `EC_AV1_REQUIRE_AOMENC=1`, since every
13687+ /// aomenc gate decodes its stream through ffmpeg and is meaningless
13688+ /// without it -- turns it into a hard failure. Without this the require
13689+ /// flag was silently short-circuited: `!have_ffmpeg()` is evaluated first
13690+ /// in `if !have_ffmpeg() || !have_aomenc()`, so a machine with no ffmpeg
13691+ /// printed SKIP and reported green (class gate-skips-on-its-own-failure).
1368513692 fn have_ffmpeg() -> bool {
13686- Command::new("ffmpeg")
13693+ let present = Command::new("ffmpeg")
1368713694 .arg("-version")
1368813695 .stdout(Stdio::null())
1368913696 .stderr(Stdio::null())
1369013697 .status()
13691- .is_ok_and(|s| s.success())
13698+ .is_ok_and(|s| s.success());
13699+ assert!(
13700+ present
13701+ || (std::env::var_os("EC_AV1_REQUIRE_FFMPEG").is_none()
13702+ && std::env::var_os("EC_AV1_REQUIRE_AOMENC").is_none()),
13703+ "EC_AV1_REQUIRE_FFMPEG/EC_AV1_REQUIRE_AOMENC is set but no working ffmpeg on PATH"
13704+ );
13705+ present
1369213706 }
1369313707
1369413708 /// Decodes one AV1 OBU stream with ffmpeg and hands back its one 4:2:0
crates/ec-av1/src/encode.rsmodified+16 -2
@@ -3063,13 +3063,27 @@ mod tests {
30633063 use std::io::Write;
30643064 use std::process::{Command, Stdio};
30653065
3066+ /// Whether ffmpeg is on PATH. Absence normally SKIPs, but
3067+ /// `EC_AV1_REQUIRE_FFMPEG=1` -- or `EC_AV1_REQUIRE_AOMENC=1`, since every
3068+ /// aomenc gate decodes its stream through ffmpeg and is meaningless
3069+ /// without it -- turns it into a hard failure. Without this the require
3070+ /// flag was silently short-circuited: `!have_ffmpeg()` is evaluated first
3071+ /// in `if !have_ffmpeg() || !have_aomenc()`, so a machine with no ffmpeg
3072+ /// printed SKIP and reported green (class gate-skips-on-its-own-failure).
30663073 fn have_ffmpeg() -> bool {
3067- Command::new("ffmpeg")
3074+ let present = Command::new("ffmpeg")
30683075 .arg("-version")
30693076 .stdout(Stdio::null())
30703077 .stderr(Stdio::null())
30713078 .status()
3072- .is_ok_and(|s| s.success())
3079+ .is_ok_and(|s| s.success());
3080+ assert!(
3081+ present
3082+ || (std::env::var_os("EC_AV1_REQUIRE_FFMPEG").is_none()
3083+ && std::env::var_os("EC_AV1_REQUIRE_AOMENC").is_none()),
3084+ "EC_AV1_REQUIRE_FFMPEG/EC_AV1_REQUIRE_AOMENC is set but no working ffmpeg on PATH"
3085+ );
3086+ present
30733087 }
30743088
30753089 /// Decodes an AV1 OBU stream with ffmpeg and hands back the three planes.
crates/ec-av1/src/encoder.rsmodified+16 -2
@@ -362,13 +362,27 @@ mod tests {
362362 use super::*;
363363 use std::process::{Command, Stdio};
364364
365+ /// Whether ffmpeg is on PATH. Absence normally SKIPs, but
366+ /// `EC_AV1_REQUIRE_FFMPEG=1` -- or `EC_AV1_REQUIRE_AOMENC=1`, since every
367+ /// aomenc gate decodes its stream through ffmpeg and is meaningless
368+ /// without it -- turns it into a hard failure. Without this the require
369+ /// flag was silently short-circuited: `!have_ffmpeg()` is evaluated first
370+ /// in `if !have_ffmpeg() || !have_aomenc()`, so a machine with no ffmpeg
371+ /// printed SKIP and reported green (class gate-skips-on-its-own-failure).
365372 fn have_ffmpeg() -> bool {
366- Command::new("ffmpeg")
373+ let present = Command::new("ffmpeg")
367374 .arg("-version")
368375 .stdout(Stdio::null())
369376 .stderr(Stdio::null())
370377 .status()
371- .is_ok_and(|s| s.success())
378+ .is_ok_and(|s| s.success());
379+ assert!(
380+ present
381+ || (std::env::var_os("EC_AV1_REQUIRE_FFMPEG").is_none()
382+ && std::env::var_os("EC_AV1_REQUIRE_AOMENC").is_none()),
383+ "EC_AV1_REQUIRE_FFMPEG/EC_AV1_REQUIRE_AOMENC is set but no working ffmpeg on PATH"
384+ );
385+ present
372386 }
373387
374388 fn test_card(width: usize, height: usize, shift: usize) -> Picture {
crates/ec-av1/src/stream.rsmodified+16 -2
@@ -867,13 +867,27 @@ mod tests {
867867 hash
868868 }
869869
870+ /// Whether ffmpeg is on PATH. Absence normally SKIPs, but
871+ /// `EC_AV1_REQUIRE_FFMPEG=1` -- or `EC_AV1_REQUIRE_AOMENC=1`, since every
872+ /// aomenc gate decodes its stream through ffmpeg and is meaningless
873+ /// without it -- turns it into a hard failure. Without this the require
874+ /// flag was silently short-circuited: `!have_ffmpeg()` is evaluated first
875+ /// in `if !have_ffmpeg() || !have_aomenc()`, so a machine with no ffmpeg
876+ /// printed SKIP and reported green (class gate-skips-on-its-own-failure).
870877 fn have_ffmpeg() -> bool {
871- Command::new("ffmpeg")
878+ let present = Command::new("ffmpeg")
872879 .arg("-version")
873880 .stdout(Stdio::null())
874881 .stderr(Stdio::null())
875882 .status()
876- .is_ok_and(|s| s.success())
883+ .is_ok_and(|s| s.success());
884+ assert!(
885+ present
886+ || (std::env::var_os("EC_AV1_REQUIRE_FFMPEG").is_none()
887+ && std::env::var_os("EC_AV1_REQUIRE_AOMENC").is_none()),
888+ "EC_AV1_REQUIRE_FFMPEG/EC_AV1_REQUIRE_AOMENC is set but no working ffmpeg on PATH"
889+ );
890+ present
877891 }
878892
879893 /// Decodes `frames` concatenated 4:2:0 frames out of one AV1 OBU stream.
crates/ec-av1/src/tile.rsmodified+16 -2
@@ -2983,13 +2983,27 @@ mod tests {
29832983 }
29842984 }
29852985
2986+ /// Whether ffmpeg is on PATH. Absence normally SKIPs, but
2987+ /// `EC_AV1_REQUIRE_FFMPEG=1` -- or `EC_AV1_REQUIRE_AOMENC=1`, since every
2988+ /// aomenc gate decodes its stream through ffmpeg and is meaningless
2989+ /// without it -- turns it into a hard failure. Without this the require
2990+ /// flag was silently short-circuited: `!have_ffmpeg()` is evaluated first
2991+ /// in `if !have_ffmpeg() || !have_aomenc()`, so a machine with no ffmpeg
2992+ /// printed SKIP and reported green (class gate-skips-on-its-own-failure).
29862993 fn have_ffmpeg() -> bool {
2987- Command::new("ffmpeg")
2994+ let present = Command::new("ffmpeg")
29882995 .arg("-version")
29892996 .stdout(Stdio::null())
29902997 .stderr(Stdio::null())
29912998 .status()
2992- .is_ok_and(|s| s.success())
2999+ .is_ok_and(|s| s.success());
3000+ assert!(
3001+ present
3002+ || (std::env::var_os("EC_AV1_REQUIRE_FFMPEG").is_none()
3003+ && std::env::var_os("EC_AV1_REQUIRE_AOMENC").is_none()),
3004+ "EC_AV1_REQUIRE_FFMPEG/EC_AV1_REQUIRE_AOMENC is set but no working ffmpeg on PATH"
3005+ );
3006+ present
29933007 }
29943008
29953009 /// Decodes an AV1 OBU stream with ffmpeg and hands back the planes.