From a926aa9182582b3f77966659faa0ef3fa90a81f8 Mon Sep 17 00:00:00 2001 From: Brandon Thomas Date: Sat, 31 Oct 2026 11:32:05 -0400 Subject: [PATCH] test(media): measure the in-place movie's peak RSS in its own process VmHWM is per process; the other tests in the binary ran on parallel threads and their allocations failed the 64 MiB bound intermittently. Co-Authored-By: Claude Opus 5.5 --- crates/media/tests/it/open_in_place.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/crates/media/tests/it/open_in_place.rs b/crates/media/tests/it/open_in_place.rs index 91eab2ba3..2cf314d03 100644 --- a/crates/media/tests/it/open_in_place.rs +++ b/crates/media/tests/it/open_in_place.rs @@ -79,12 +79,29 @@ fn reset_peak() -> Option { status_kib("VmHWM:").map(|k| k * 1024) } +/// Set in the child process that does the measuring (see below). +const ALONE: &str = "EFFECTCRAFT_TEST_RSS_ALONE"; + #[test] fn a_long_movie_is_read_in_place_not_whole() { if !cfg!(target_os = "linux") { eprintln!("peak RSS is read from /proc: skipping"); return; } + // Peak RSS is per process, and the other tests in this binary run on parallel threads, so + // their allocations would count against this one. Measure in a child running only this test. + if std::env::var_os(ALONE).is_none() { + let out = std::process::Command::new(std::env::current_exe().unwrap()) + .args(["--exact", "open_in_place::a_long_movie_is_read_in_place_not_whole", "--test-threads=1", "--nocapture"]) + .env(ALONE, "1") + .output() + .unwrap(); + let log = format!("{}{}", String::from_utf8_lossy(&out.stdout), String::from_utf8_lossy(&out.stderr)); + assert!(out.status.success(), "the measuring child failed:\n{log}"); + assert!(log.contains("1 passed"), "the measuring child ran no test:\n{log}"); + eprintln!("{log}"); + return; + } let Some(small) = small_mp4() else { eprintln!("ffmpeg not found: skipping"); return;