From 654e4efbe4cead03f69a7bf2bcdaee5ac1cbcc60 Mon Sep 17 00:00:00 2001 From: Tanish Manku Date: Sat, 21 Nov 2026 12:20:39 -0700 Subject: [PATCH] test: polling deadlines are a minute, not two seconds; the stroke test skips work it never read (M8) --- crates/cli/src/control/tests.rs | 3 ++- crates/render/src/stroke.rs | 4 ++-- src/gpu_stage.rs | 5 +++-- src/remote.rs | 2 +- src/tabs_tests.rs | 3 ++- 5 files changed, 10 insertions(+), 7 deletions(-) diff --git a/crates/cli/src/control/tests.rs b/crates/cli/src/control/tests.rs index afc967f4..c073dbdd 100644 --- a/crates/cli/src/control/tests.rs +++ b/crates/cli/src/control/tests.rs @@ -328,7 +328,8 @@ fn dropping_the_server_frees_the_port() { let port = server.port; assert!(TcpListener::bind(("127.0.0.1", port)).is_err(), "the port is taken while the server lives"); drop(server); - let freed = (0..200).any(|_| { + // (Up to a minute: the listening thread ends when it next runs, late on a busy machine.) + let freed = (0..6000).any(|_| { std::thread::sleep(Duration::from_millis(10)); TcpListener::bind(("127.0.0.1", port)).is_ok() }); diff --git a/crates/render/src/stroke.rs b/crates/render/src/stroke.rs index 5b6c9c6e..f6407481 100644 --- a/crates/render/src/stroke.rs +++ b/crates/render/src/stroke.rs @@ -931,9 +931,9 @@ mod tests { assert!(apart < 1.0 / 255.0, "{what}, {how}: {apart}"); // 3. Against the truth: each pixel sampled 16 × 16 times against the pieces. // (Checked for the plain styles; a sample grid is good to a sixteenth.) - let (pieces, _) = piece_loops(&lines, hw, &outline, profile.as_ref(), None, false); - let before = coverage(&pieces, FillRule::NonZero); if how == "round" || how == "dashes whose round caps overlap" { + let (pieces, _) = piece_loops(&lines, hw, &outline, profile.as_ref(), None, false); + let before = coverage(&pieces, FillRule::NonZero); for y in (0..300).step_by(7) { for x in 0..400 { let c = drawn[y * 400 + x]; diff --git a/src/gpu_stage.rs b/src/gpu_stage.rs index 74215b39..177d59e9 100644 --- a/src/gpu_stage.rs +++ b/src/gpu_stage.rs @@ -589,10 +589,11 @@ mod imp { ) } - /// Frames until the start thread has answered (bounded). + /// Frames until the start thread has answered (bounded: a minute, which only a start + /// thread that never answers reaches; a busy machine can take seconds to run it). fn settle(m: &mut Imp, svc: &RenderService, ctx: &egui::Context, now: f64, size: (u32, u32)) -> Vec { let mut out = Vec::new(); - for _ in 0..400 { + for _ in 0..12_000 { out.extend(m.sync(true, svc, ctx, now, size)); if m.starting.is_none() { break; diff --git a/src/remote.rs b/src/remote.rs index 83554d9a..f6c07b3d 100644 --- a/src/remote.rs +++ b/src/remote.rs @@ -193,7 +193,7 @@ mod tests { assert!(!file.exists(), "the token file goes when the window closes"); assert_eq!(super::port(&app), None); // The port is free again: the same run can open another window on it (ADR 0092). - let freed = (0..200).any(|_| { + let freed = (0..6000).any(|_| { std::thread::sleep(std::time::Duration::from_millis(10)); std::net::TcpListener::bind(("127.0.0.1", port)).is_ok() }); diff --git a/src/tabs_tests.rs b/src/tabs_tests.rs index ddd1613e..e736de90 100644 --- a/src/tabs_tests.rs +++ b/src/tabs_tests.rs @@ -390,8 +390,9 @@ fn autosave_and_recovery_cover_every_open_document() { let dir = std::env::temp_dir().join(format!("anicraft-tabs-recovery-{}", std::process::id())); let _ = std::fs::remove_dir_all(&dir); std::fs::create_dir_all(&dir).unwrap(); + // (A minute: a deadline for a save thread on a busy machine, not a time that is checked.) let wait = |saver_ids: &[String]| { - for _ in 0..200 { + for _ in 0..6000 { if saver_ids.iter().all(|id| recovery::document_path(&dir, id).exists()) { return; }