test(ui): pump and wait longer while prefetch setup fills the cache (#4096)

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.
This commit is contained in:
FredApps
2026-11-22 23:28:40 +07:00
committed by GitHub
parent 171e92b077
commit 108e636260
+5 -2
View File
@@ -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::<Vec<_>>());
let cached = h.state().frames.cached_frames(&series);
assert_eq!(cached, (0..120).collect::<Vec<_>>(), "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();