forge
Explore
Log in

Don't you dare go Hollow

The proxy tests take turns over their one film

Browse files at this commit

31449fc5643dda4048d41e17e744c79ce6ced181Ahmet Kaan GümüşParent: c319ba2
  • fix
    • the proxy tests take turns over their one film
Show full message
🐛 fix(engine): the proxy tests take turns over their one film

Both proxy tests proxy test_av.mp4, and a proxy job is one per film:
run in the same binary, whichever asked second was refused ("a stand-in
for this film is already being made") and a cancel in one deleted the
file the other was asserting about -- the rotating failure this binary
has shown all sweep, misread as starvation until the panic named it.
A shared mutex serializes the pair; everything else still runs wide.
crates/engine/tests/export.rsmodified+8 -1
@@ -21,9 +21,14 @@
21 use std::fs::File;21 use std::fs::File;
22 use std::io::BufReader;22 use std::io::BufReader;
23 use std::path::{Path, PathBuf};23 use std::path::{Path, PathBuf};
24-use std::sync::Once;24+use std::sync::{Mutex, Once};
25 use std::time::{Duration, Instant};25 use std::time::{Duration, Instant};
26 26
27+/// The two proxy tests below share one film, and a proxy job is one per film:
28+/// run together, whichever asks second is refused ("already being made"), and
29+/// a cancel in one deletes what the other is asserting about. One at a time.
30+static PROXY_FILM: Mutex<()> = Mutex::new(());
31+
27 use engine::export::ExportSettings;32 use engine::export::ExportSettings;
28 use engine::hw::HwEncoder;33 use engine::hw::HwEncoder;
29 use engine::mux::{Mp4Muxer, VideoParams, parameter_sets};34 use engine::mux::{Mp4Muxer, VideoParams, parameter_sets};
@@ -912,6 +917,7 @@ fn exports_a_gapped_timeline_as_black_and_silence() {
912 /// hardware one buys is speed, and that is the ignored test below.917 /// hardware one buys is speed, and that is the ignored test below.
913 #[test]918 #[test]
914 fn a_proxy_is_picture_only_every_frame_a_starting_point_and_cached() {919 fn a_proxy_is_picture_only_every_frame_a_starting_point_and_cached() {
920+ let _film = PROXY_FILM.lock().unwrap_or_else(|e| e.into_inner());
915 let _seat = pin_software();921 let _seat = pin_software();
916 let source = asset("test_av.mp4");922 let source = asset("test_av.mp4");
917 let out = engine::proxy::path_for(&source).expect("a cache directory");923 let out = engine::proxy::path_for(&source).expect("a cache directory");
@@ -1047,6 +1053,7 @@ fn a_proxy_is_picture_only_every_frame_a_starting_point_and_cached() {
1047 /// Software seat, like every default test here ([`pin_software`]).1053 /// Software seat, like every default test here ([`pin_software`]).
1048 #[test]1054 #[test]
1049 fn a_stopped_proxy_leaves_neither_a_stand_in_nor_half_of_one() {1055 fn a_stopped_proxy_leaves_neither_a_stand_in_nor_half_of_one() {
1056+ let _film = PROXY_FILM.lock().unwrap_or_else(|e| e.into_inner());
1050 let _seat = pin_software();1057 let _seat = pin_software();
1051 let source = asset("test_av.mp4");1058 let source = asset("test_av.mp4");
1052 let out = engine::proxy::path_for(&source).expect("a cache directory");1059 let out = engine::proxy::path_for(&source).expect("a cache directory");