From 515940dbd80b13f35c67f7818b738eb8365a6e75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Fri, 6 Nov 2026 19:26:48 +0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Export=20tests=20find=20hw-child?= =?UTF-8?q?=20under=20EDITH=5FTARGET=5FDIR=20too;=20gen=5Ffixtures=20makes?= =?UTF-8?q?=20the=20test=5Fsync.mp4=20the=20copy-length=20test=20reads?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crates/engine/tests/export.rs | 12 ++++++++++-- scripts/gen_fixtures.sh | 7 +++++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/crates/engine/tests/export.rs b/crates/engine/tests/export.rs index 428cad8..1a4c5eb 100644 --- a/crates/engine/tests/export.rs +++ b/crates/engine/tests/export.rs @@ -1668,13 +1668,21 @@ fn injected_with( engine::envcfg::unset("VE_SW_ENC"); engine::envcfg::set("VE_HW_TEST_FAKE", "1"); // The child is a binary of `engine-hw`, so cargo names it for no test of - // this package; it sits beside the test binary's own `target//`. - let child = std::env::current_exe() + // this package; it sits beside the test binary's own `target//`, + // or under `EDITH_TARGET_DIR` when cargo's `build-dir` keeps the test + // binaries elsewhere. + let profile = if cfg!(debug_assertions) { "debug" } else { "release" }; + let beside = std::env::current_exe() .expect("the test binary's path") .parent() .and_then(|deps| deps.parent()) .expect("target/") .join("hw-child"); + let child = [Some(beside.clone()), engine::envcfg::var_os("EDITH_TARGET_DIR").map(|t| std::path::PathBuf::from(t).join(profile).join("hw-child"))] + .into_iter() + .flatten() + .find(|c| c.is_file()) + .unwrap_or(beside); engine::envcfg::set("VE_HW_CHILD_BIN", child.to_str().expect("a UTF-8 path")); match timeout_ms { Some(ms) => engine::envcfg::set("VE_HW_TIMEOUT_MS", ms), diff --git a/scripts/gen_fixtures.sh b/scripts/gen_fixtures.sh index ddce120..27eb3ea 100755 --- a/scripts/gen_fixtures.sh +++ b/scripts/gen_fixtures.sh @@ -848,3 +848,10 @@ ffmpeg -y -f lavfi -i "testsrc2=size=1920x1080:rate=30:duration=2" \ echo "fixtures written to assets/" +# Copy-length fixture: 4.0 s of picture over 44.1k AAC, whose 172.27 packets' +# worth of sound a stream copy has to round up, not away (export.rs +# a_copied_sound_runs_as_long_as_its_picture). +ffmpeg -y -f lavfi -i testsrc2=size=320x180:rate=30:duration=4 \ + -f lavfi -i "sine=frequency=440:sample_rate=44100:duration=4" \ + -map 0:v -map 1:a -c:v libx264 -profile:v baseline -pix_fmt yuv420p \ + -ac 2 -c:a aac -b:a 128k -shortest assets/test_sync.mp4