🐛 Export tests find hw-child under EDITH_TARGET_DIR too; gen_fixtures makes the test_sync.mp4 the copy-length test reads
Browse files at this commit515940dbd80b13f35c67f7818b738eb8365a6e75Parent: 20a1c042 changed files +17 -2
- crates/engine/tests/export.rs +10 -2
- scripts/gen_fixtures.sh +7 -0
crates/engine/tests/export.rsmodified+10 -2
| @@ -1668,13 +1668,21 @@ fn injected_with<T>( | |||
| 1668 | engine::envcfg::unset("VE_SW_ENC"); | 1668 | engine::envcfg::unset("VE_SW_ENC"); |
| 1669 | engine::envcfg::set("VE_HW_TEST_FAKE", "1"); | 1669 | engine::envcfg::set("VE_HW_TEST_FAKE", "1"); |
| 1670 | // The child is a binary of `engine-hw`, so cargo names it for no test of | 1670 | // The child is a binary of `engine-hw`, so cargo names it for no test of |
| 1671 | - // this package; it sits beside the test binary's own `target/<profile>/`. | 1671 | + // this package; it sits beside the test binary's own `target/<profile>/`, |
| 1672 | - let child = std::env::current_exe() | 1672 | + // or under `EDITH_TARGET_DIR` when cargo's `build-dir` keeps the test |
| 1673 | + // binaries elsewhere. | ||
| 1674 | + let profile = if cfg!(debug_assertions) { "debug" } else { "release" }; | ||
| 1675 | + let beside = std::env::current_exe() | ||
| 1673 | .expect("the test binary's path") | 1676 | .expect("the test binary's path") |
| 1674 | .parent() | 1677 | .parent() |
| 1675 | .and_then(|deps| deps.parent()) | 1678 | .and_then(|deps| deps.parent()) |
| 1676 | .expect("target/<profile>") | 1679 | .expect("target/<profile>") |
| 1677 | .join("hw-child"); | 1680 | .join("hw-child"); |
| 1681 | + let child = [Some(beside.clone()), engine::envcfg::var_os("EDITH_TARGET_DIR").map(|t| std::path::PathBuf::from(t).join(profile).join("hw-child"))] | ||
| 1682 | + .into_iter() | ||
| 1683 | + .flatten() | ||
| 1684 | + .find(|c| c.is_file()) | ||
| 1685 | + .unwrap_or(beside); | ||
| 1678 | engine::envcfg::set("VE_HW_CHILD_BIN", child.to_str().expect("a UTF-8 path")); | 1686 | engine::envcfg::set("VE_HW_CHILD_BIN", child.to_str().expect("a UTF-8 path")); |
| 1679 | match timeout_ms { | 1687 | match timeout_ms { |
| 1680 | Some(ms) => engine::envcfg::set("VE_HW_TIMEOUT_MS", ms), | 1688 | Some(ms) => engine::envcfg::set("VE_HW_TIMEOUT_MS", ms), |
scripts/gen_fixtures.shmodified+7 -0
| @@ -848,3 +848,10 @@ ffmpeg -y -f lavfi -i "testsrc2=size=1920x1080:rate=30:duration=2" \ | |||
| 848 | 848 | ||
| 849 | 849 | ||
| 850 | echo "fixtures written to assets/" | 850 | echo "fixtures written to assets/" |
| 851 | +# Copy-length fixture: 4.0 s of picture over 44.1k AAC, whose 172.27 packets' | ||
| 852 | +# worth of sound a stream copy has to round up, not away (export.rs | ||
| 853 | +# a_copied_sound_runs_as_long_as_its_picture). | ||
| 854 | +ffmpeg -y -f lavfi -i testsrc2=size=320x180:rate=30:duration=4 \ | ||
| 855 | + -f lavfi -i "sine=frequency=440:sample_rate=44100:duration=4" \ | ||
| 856 | + -map 0:v -map 1:a -c:v libx264 -profile:v baseline -pix_fmt yuv420p \ | ||
| 857 | + -ac 2 -c:a aac -b:a 128k -shortest assets/test_sync.mp4 | ||