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 commit5 changed files +80 -10
- crates/ec-av1/src/decode.rs +16 -2
- crates/ec-av1/src/encode.rs +16 -2
- crates/ec-av1/src/encoder.rs +16 -2
- crates/ec-av1/src/stream.rs +16 -2
- crates/ec-av1/src/tile.rs +16 -2
crates/ec-av1/src/decode.rsmodified+16 -2
| @@ -13682,13 +13682,27 @@ mod tests { | ||
| 13682 | 13682 | use std::io::Write; |
| 13683 | 13683 | use std::process::{Command, Stdio}; |
| 13684 | 13684 | |
| 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). | |
| 13685 | 13692 | fn have_ffmpeg() -> bool { |
| 13686 | - Command::new("ffmpeg") | |
| 13693 | + let present = Command::new("ffmpeg") | |
| 13687 | 13694 | .arg("-version") |
| 13688 | 13695 | .stdout(Stdio::null()) |
| 13689 | 13696 | .stderr(Stdio::null()) |
| 13690 | 13697 | .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 | |
| 13692 | 13706 | } |
| 13693 | 13707 | |
| 13694 | 13708 | /// 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 { | ||
| 3063 | 3063 | use std::io::Write; |
| 3064 | 3064 | use std::process::{Command, Stdio}; |
| 3065 | 3065 | |
| 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). | |
| 3066 | 3073 | fn have_ffmpeg() -> bool { |
| 3067 | - Command::new("ffmpeg") | |
| 3074 | + let present = Command::new("ffmpeg") | |
| 3068 | 3075 | .arg("-version") |
| 3069 | 3076 | .stdout(Stdio::null()) |
| 3070 | 3077 | .stderr(Stdio::null()) |
| 3071 | 3078 | .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 | |
| 3073 | 3087 | } |
| 3074 | 3088 | |
| 3075 | 3089 | /// 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 { | ||
| 362 | 362 | use super::*; |
| 363 | 363 | use std::process::{Command, Stdio}; |
| 364 | 364 | |
| 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). | |
| 365 | 372 | fn have_ffmpeg() -> bool { |
| 366 | - Command::new("ffmpeg") | |
| 373 | + let present = Command::new("ffmpeg") | |
| 367 | 374 | .arg("-version") |
| 368 | 375 | .stdout(Stdio::null()) |
| 369 | 376 | .stderr(Stdio::null()) |
| 370 | 377 | .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 | |
| 372 | 386 | } |
| 373 | 387 | |
| 374 | 388 | fn test_card(width: usize, height: usize, shift: usize) -> Picture { |
crates/ec-av1/src/stream.rsmodified+16 -2
| @@ -867,13 +867,27 @@ mod tests { | ||
| 867 | 867 | hash |
| 868 | 868 | } |
| 869 | 869 | |
| 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). | |
| 870 | 877 | fn have_ffmpeg() -> bool { |
| 871 | - Command::new("ffmpeg") | |
| 878 | + let present = Command::new("ffmpeg") | |
| 872 | 879 | .arg("-version") |
| 873 | 880 | .stdout(Stdio::null()) |
| 874 | 881 | .stderr(Stdio::null()) |
| 875 | 882 | .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 | |
| 877 | 891 | } |
| 878 | 892 | |
| 879 | 893 | /// 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 { | ||
| 2983 | 2983 | } |
| 2984 | 2984 | } |
| 2985 | 2985 | |
| 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). | |
| 2986 | 2993 | fn have_ffmpeg() -> bool { |
| 2987 | - Command::new("ffmpeg") | |
| 2994 | + let present = Command::new("ffmpeg") | |
| 2988 | 2995 | .arg("-version") |
| 2989 | 2996 | .stdout(Stdio::null()) |
| 2990 | 2997 | .stderr(Stdio::null()) |
| 2991 | 2998 | .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 | |
| 2993 | 3007 | } |
| 2994 | 3008 | |
| 2995 | 3009 | /// Decodes an AV1 OBU stream with ffmpeg and hands back the planes. |