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 <noreply@anthropic.com>
This commit is contained in:
iannitram
2026-10-18 16:51:47 -06:00
co-authored by Claude Opus 5.5
parent ef74d82902
commit c1d411b249
+5
View File
@@ -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);