From 108e6362609c05e94570d20f1e456b8fb33ad2d4 Mon Sep 17 00:00:00 2001 From: FredApps <153173854+FredApps@users.noreply.github.com> Date: Sun, 22 Nov 2026 23:28:40 +0700 Subject: [PATCH] test(ui): pump and wait longer while prefetch setup fills the cache (#4096) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes #4095. This is a hardening change for a FreeBSD CI flake; it may not fully fix the flake. On the scheduled FreeBSD 15 x86_64 run, ui_preview_align::playback_prefetches_past_the_cached_frames_ahead failed during setup: after requesting frames 0..120 it asserted the cache equalled [0, 1, …, 119] and got only [0]. The wait was eight seconds and did not step the harness. The same test passed on the previous day's scheduled run. This PR steps the harness while waiting, gives the workers up to 60 seconds, and reports how many frames actually landed. If workers never fill the cache under load, the test can still fail. The FreeBSD aarch64 job only cross-compiles tests; it does not run them, so a green aarch64 leg is not a test pass. --- crates/ui-egui/tests/it/ui_preview_align.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/crates/ui-egui/tests/it/ui_preview_align.rs b/crates/ui-egui/tests/it/ui_preview_align.rs index afafa8a45..a41723d61 100644 --- a/crates/ui-egui/tests/it/ui_preview_align.rs +++ b/crates/ui-egui/tests/it/ui_preview_align.rs @@ -273,13 +273,16 @@ fn playback_prefetches_past_the_cached_frames_ahead() { for f in 0..120 { h.state().request_frame(cid, f, scale); } - for _ in 0..4000 { + let deadline = std::time::Instant::now() + std::time::Duration::from_secs(60); + while std::time::Instant::now() < deadline { if h.state().frames.cached_frames(&series).len() >= 120 && h.state().frames.inflight() == 0 { break; } + h.step(); std::thread::sleep(std::time::Duration::from_millis(2)); } - assert_eq!(h.state().frames.cached_frames(&series), (0..120).collect::>()); + let cached = h.state().frames.cached_frames(&series); + assert_eq!(cached, (0..120).collect::>(), "setup cached {} frames before playback: {cached:?}", cached.len()); // Rendering/instrumentation time must not move the playhead near the end of the // cached run. Exercise real prefetch workers while holding playback in its first second. h.state_mut().use_manual_clock();