Have_ffmpeg() SKIPped green under EC_AV1_REQUIRE_AOMENC=1
Browse files at this commit91c13355d94321e04d7e7ae0c983027001e0c5dfParent: ae52c34- fix
- have_ffmpeg() SKIPped green under EC_AV1_REQUIRE_AOMENC=1
5 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 | use std::io::Write; | 13682 | use std::io::Write; |
| 13683 | use std::process::{Command, Stdio}; | 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 | fn have_ffmpeg() -> bool { | 13692 | fn have_ffmpeg() -> bool { |
| 13686 | - Command::new("ffmpeg") | 13693 | + let present = Command::new("ffmpeg") |
| 13687 | .arg("-version") | 13694 | .arg("-version") |
| 13688 | .stdout(Stdio::null()) | 13695 | .stdout(Stdio::null()) |
| 13689 | .stderr(Stdio::null()) | 13696 | .stderr(Stdio::null()) |
| 13690 | .status() | 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 | /// Decodes one AV1 OBU stream with ffmpeg and hands back its one 4:2:0 | 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 | use std::io::Write; | 3063 | use std::io::Write; |
| 3064 | use std::process::{Command, Stdio}; | 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 | fn have_ffmpeg() -> bool { | 3073 | fn have_ffmpeg() -> bool { |
| 3067 | - Command::new("ffmpeg") | 3074 | + let present = Command::new("ffmpeg") |
| 3068 | .arg("-version") | 3075 | .arg("-version") |
| 3069 | .stdout(Stdio::null()) | 3076 | .stdout(Stdio::null()) |
| 3070 | .stderr(Stdio::null()) | 3077 | .stderr(Stdio::null()) |
| 3071 | .status() | 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 | /// Decodes an AV1 OBU stream with ffmpeg and hands back the three planes. | 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 | use super::*; | 362 | use super::*; |
| 363 | use std::process::{Command, Stdio}; | 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 | fn have_ffmpeg() -> bool { | 372 | fn have_ffmpeg() -> bool { |
| 366 | - Command::new("ffmpeg") | 373 | + let present = Command::new("ffmpeg") |
| 367 | .arg("-version") | 374 | .arg("-version") |
| 368 | .stdout(Stdio::null()) | 375 | .stdout(Stdio::null()) |
| 369 | .stderr(Stdio::null()) | 376 | .stderr(Stdio::null()) |
| 370 | .status() | 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 | fn test_card(width: usize, height: usize, shift: usize) -> Picture { | 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 | hash | 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 | fn have_ffmpeg() -> bool { | 877 | fn have_ffmpeg() -> bool { |
| 871 | - Command::new("ffmpeg") | 878 | + let present = Command::new("ffmpeg") |
| 872 | .arg("-version") | 879 | .arg("-version") |
| 873 | .stdout(Stdio::null()) | 880 | .stdout(Stdio::null()) |
| 874 | .stderr(Stdio::null()) | 881 | .stderr(Stdio::null()) |
| 875 | .status() | 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 | /// Decodes `frames` concatenated 4:2:0 frames out of one AV1 OBU stream. | 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 | fn have_ffmpeg() -> bool { | 2993 | fn have_ffmpeg() -> bool { |
| 2987 | - Command::new("ffmpeg") | 2994 | + let present = Command::new("ffmpeg") |
| 2988 | .arg("-version") | 2995 | .arg("-version") |
| 2989 | .stdout(Stdio::null()) | 2996 | .stdout(Stdio::null()) |
| 2990 | .stderr(Stdio::null()) | 2997 | .stderr(Stdio::null()) |
| 2991 | .status() | 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 | /// Decodes an AV1 OBU stream with ffmpeg and hands back the planes. | 3009 | /// Decodes an AV1 OBU stream with ffmpeg and hands back the planes. |