From 5a9e771cc95991d5d4cff61bc9fe68c0e8aae922 Mon Sep 17 00:00:00 2001 From: kezmdor Date: Wed, 21 Oct 2026 00:58:39 +0000 Subject: [PATCH] io: the 3MF and DXF budget tests do not check wall-clock time (#2998) (#2999) * claim: #2998 Co-Authored-By: Claude Opus 5.5 * io: the 3MF and DXF budget tests do not check wall-clock time nested_fan_out_of_empty_objects_is_bounded spends about 20 million visits reaching the work budget: 1.5 s alone, up to 40 s and more when every test binary runs at once, past its 30 s limit. The time checks run only after the reader returns, so a missing budget hangs these tests with or without them; the error, the empty geometry and the three vertices per placement are what show the budgets work. CONTRIBUTING.md: a test must not depend on wall-clock timing. Co-Authored-By: Claude Opus 5.5 --------- Co-authored-by: kezmdor <15539254+kezmdor@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 --- crates/io/src/dxf.rs | 4 ---- crates/io/src/threemf.rs | 4 ---- 2 files changed, 8 deletions(-) diff --git a/crates/io/src/dxf.rs b/crates/io/src/dxf.rs index 2d8be4207..df792bd7b 100644 --- a/crates/io/src/dxf.rs +++ b/crates/io/src/dxf.rs @@ -542,8 +542,6 @@ mod tests { /// self-inserts fan out to 6^16 visits for no output. Both shapes must be refused quickly. #[test] fn empty_blocks_do_not_fan_out() { - let t = std::time::Instant::now(); - let fanout = format!( "0\nSECTION\n2\nBLOCKS\n0\nBLOCK\n2\nA\n{}0\nENDBLK\n0\nENDSEC\n0\nSECTION\n2\nENTITIES\n0\nINSERT\n2\nA\n0\nENDSEC\n0\nEOF\n", "0\nINSERT\n2\nA\n".repeat(6) @@ -557,7 +555,5 @@ mod tests { ); let g = read_dxf(&array).unwrap_or_default(); assert!(g.is_empty(), "an empty block has no geometry to place"); - - assert!(t.elapsed() < std::time::Duration::from_secs(5), "took {:?}", t.elapsed()); } } diff --git a/crates/io/src/threemf.rs b/crates/io/src/threemf.rs index 736a4b257..ef48cc6fe 100644 --- a/crates/io/src/threemf.rs +++ b/crates/io/src/threemf.rs @@ -1352,7 +1352,6 @@ pub(crate) mod tests { /// allocation, which no panic guard can intercept. #[test] fn many_placements_of_a_big_object_stay_bounded() { - let t = std::time::Instant::now(); let verts: String = (0..100_000).map(|i| format!("", i % 100, i / 100)).collect(); let model = format!( "{}{verts}\ @@ -1364,7 +1363,6 @@ pub(crate) mod tests { assert_eq!(objs.len(), 10_000); // Only the three vertices the one triangle reaches are copied per placement. assert!(objs.iter().all(|o| o.positions.len() == 3 && o.triangles.len() == 1), "{:?}", objs.first().map(|o| o.positions.len())); - assert!(t.elapsed() < std::time::Duration::from_secs(30), "took {:?}", t.elapsed()); } /// Objects that only place other objects count toward the budget too: six levels of 300 @@ -1372,7 +1370,6 @@ pub(crate) mod tests { /// budget instead of running for days. #[test] fn nested_fan_out_of_empty_objects_is_bounded() { - let t = std::time::Instant::now(); let components = |child: u32| (0..300).map(|_| format!(r#""#)).collect::(); let mut objects = r#""#.to_string(); for id in 2..=7 { @@ -1381,7 +1378,6 @@ pub(crate) mod tests { let model = format!(r#"{objects}"#); let err = read_3mf(&package(&model, None)).unwrap_err().to_string(); assert!(err.contains("placements"), "{err}"); - assert!(t.elapsed() < std::time::Duration::from_secs(30), "took {:?}", t.elapsed()); } /// Triangles are budgeted across every placement, so fan-out cannot outrun the cap.