From 634f7dd58eb6e74dc58bbca39db9deecea653afe Mon Sep 17 00:00:00 2001 From: 2ez4gcx <108074836+2ez4gcx@users.noreply.github.com> Date: Mon, 30 Nov 2026 19:39:28 +0700 Subject: [PATCH] cadcraft: the device test checks that the read-back is answered check() takes a read-back with no answer within 10 s as a pass, so the device test that called it couldn't tell an answered read-back from a timeout (it took 10.9 s on the Linux CI runner). Call clear_and_read and require Ok(true) for both passes, naming the adapter and the time taken. Co-Authored-By: Claude Opus 5.5 --- apps/cadcraft/src/renderer.rs | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/apps/cadcraft/src/renderer.rs b/apps/cadcraft/src/renderer.rs index 6165bf54e..fa13ed217 100644 --- a/apps/cadcraft/src/renderer.rs +++ b/apps/cadcraft/src/renderer.rs @@ -567,9 +567,10 @@ mod tests { } } - /// The read-back check passes on a working device, with and without a stencil buffer. The - /// device is made as the app makes it: on Windows DirectX 12 alone with FXC (graphics.rs; an - /// AMD driver crashes when OpenGL is created there, #31), and egui's limits for the adapter. + /// The read-back is answered and passes on a working device, with and without a stencil + /// buffer. The device is made as the app makes it: on Windows DirectX 12 alone with FXC + /// (graphics.rs; an AMD driver crashes when OpenGL is created there, #31), and egui's limits for + /// the adapter. #[test] fn the_check_passes_on_a_device_that_draws() { let mut options = eframe::NativeOptions::default(); @@ -583,8 +584,15 @@ mod tests { eprintln!("no graphics adapter here: the device check is left to machines with one"); return; }; - check(&rs.device, &rs.queue, None).unwrap(); - check(&rs.device, &rs.queue, Some(wgpu::TextureFormat::Stencil8)).unwrap(); + let info = rs.adapter.get_info(); + for stencil in [None, Some(wgpu::TextureFormat::Stencil8)] { + // `check` takes no answer as a pass; a working device must answer, or every start on it + // would wait for the timeout. + let started = std::time::Instant::now(); + let read = clear_and_read(&rs.device, &rs.queue, stencil); + let elapsed = started.elapsed(); + assert_eq!(read, Ok(true), "{stencil:?} on {} ({:?}, {:?}) after {elapsed:?}", info.name, info.backend, info.device_type); + } } /// The read-back passes only when every pixel came back cleared: a target the clear never