From c1d411b2495f49ead824876339d92d19e06eb030 Mon Sep 17 00:00:00 2001 From: iannitram <4624371+iannitram@users.noreply.github.com> Date: Sun, 18 Oct 2026 14:48:07 -0600 Subject: [PATCH] Tests: serialise disk-cache-opening tests with the roto tests The Roto/Object Matte segment store is one per process (roto::set_seg_store), and every Session::configure_disk_cache that opens a cache takes it over. The roto and disk-cache tests already serialise on hold_roto_cache_test_lock(), but many other engine tests build a Session with a settings store, which opens the disk cache at the platform folder and takes the store; once that session drops, the weak store is dead and object_matte_mattes_persist_in_the_disk_cache sees no disk writes. It failed 3 of 3 in the full parallel suite here. configure_disk_cache now takes that lock under cfg(test) before opening a cache, so every such test runs apart from the roto tests. Re-entry on the same thread is a no-op. Product code is unchanged: only the app's one session ever opens a disk cache, so users cannot hit the race. Co-Authored-By: Claude Opus 5.5 --- crates/engine/src/session_settings.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/crates/engine/src/session_settings.rs b/crates/engine/src/session_settings.rs index ef3e748a..0b457926 100644 --- a/crates/engine/src/session_settings.rs +++ b/crates/engine/src/session_settings.rs @@ -116,6 +116,11 @@ impl Session { self.layer_cache.set_disk(None); return; }; + // Tests: the Roto/Object Matte segment store below is one per process, so a test that + // opens a disk cache (often the platform folder, through a settings store) would take + // over the store of a roto test running beside it. Serialise them with the roto tests. + #[cfg(test)] + crate::tests_roto::hold_roto_cache_test_lock(); let dc = match &self.disk_cache { Some(c) if c.folder() == folder.as_path() => { c.set_max_bytes(max);