From 6f4049494d6f482ab93f9042b992b5fff606bde2 Mon Sep 17 00:00:00 2001 From: bflatastic Date: Sun, 11 Oct 2026 21:38:39 +0700 Subject: [PATCH] Test: the idle place test waits for the link scan in real time tests_place::a_file_placed_while_idle_follows_its_changes failed at random in CI (twice on 2026-10-11): while the link scan ran on its worker thread, the test's clock moved on by whole simulated seconds per 5 ms of real time, so on a busy machine the 10 simulated seconds ran out before the scan had read the changed file. The clock now waits for the scan (up to 20 real seconds). --- crates/ui-egui/src/tests_place.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/crates/ui-egui/src/tests_place.rs b/crates/ui-egui/src/tests_place.rs index 1483830e..f6c4ebe1 100644 --- a/crates/ui-egui/src/tests_place.rs +++ b/crates/ui-egui/src/tests_place.rs @@ -614,6 +614,7 @@ fn frame_at(app: &mut VectorcraftApp, ctx: &egui::Context, time: f64) -> std::ti /// for) or until `done` → whether it was. fn idle(app: &mut VectorcraftApp, ctx: &egui::Context, time: &mut f64, secs: f64, done: &dyn Fn(&VectorcraftApp) -> bool) -> bool { let end = *time + secs; + let real_end = std::time::Instant::now() + std::time::Duration::from_secs(20); loop { let wait = frame_at(app, ctx, *time); if done(app) { @@ -624,9 +625,11 @@ fn idle(app: &mut VectorcraftApp, ctx: &egui::Context, time: &mut f64, secs: f64 *time = end; return false; } - if app.session.link_scan.is_some() { - // The look runs on a worker thread, in real time. + // The look runs on a worker thread, in real time: the clock waits for it, else a busy + // machine's slow look outlasts the simulated seconds and the test fails at random. + if app.session.link_scan.is_some() && std::time::Instant::now() < real_end { std::thread::sleep(std::time::Duration::from_millis(5)); + continue; } *time = next; }