diff --git a/crates/doc/src/tests.rs b/crates/doc/src/tests.rs index 088bd3bd2c..43cdedcb44 100644 --- a/crates/doc/src/tests.rs +++ b/crates/doc/src/tests.rs @@ -144,6 +144,7 @@ fn parts_and_media() { } #[test] +#[cfg_attr(coverage, ignore = "coverage instrumentation skews the measured time")] fn many_distinct_media_add_in_linear_time() { // An import with tens of thousands of small distinct images (same length, differing only at // the end) used to compare each against every earlier one. @@ -645,6 +646,7 @@ fn para_of_objects(objs: Vec) -> Paragraph { } #[test] +#[cfg_attr(coverage, ignore = "coverage instrumentation skews the measured time")] fn object_walks_are_linear_in_the_paragraph() { // #3614: loops of object_offsets + object_at recounted the objects before each one, so a // paragraph of 40,000 markers took seconds per walk. @@ -691,6 +693,7 @@ fn object_walks_are_linear_in_the_paragraph() { } #[test] +#[cfg_attr(coverage, ignore = "coverage instrumentation skews the measured time")] fn deleting_across_many_lone_control_markers_is_not_quadratic() { // A millisecond now; the old delete took 18 s at 1,500 markers and 114 s at 3,000. let n = 3_000; @@ -725,6 +728,7 @@ fn control_markers_kept_are_sorted() { } #[test] +#[cfg_attr(coverage, ignore = "coverage instrumentation skews the measured time")] fn lone_table_open_markers_linear_time() { let mut d = Document::new(); let mut t = Table::new(1, 1, 100.0); diff --git a/crates/docx/tests/it/comment_save_cost.rs b/crates/docx/tests/it/comment_save_cost.rs index 2716578b29..e6858e5785 100644 --- a/crates/docx/tests/it/comment_save_cost.rs +++ b/crates/docx/tests/it/comment_save_cost.rs @@ -27,6 +27,7 @@ fn cpu_cost(mut f: impl FnMut()) -> f64 { } #[test] +#[cfg_attr(coverage, ignore = "coverage instrumentation skews the measured time")] fn many_comments_save_without_quadratic_id_searches() { for imported in [true, false] { let small = comments(4_000, imported); diff --git a/crates/docx/tests/it/content_control_save_cost.rs b/crates/docx/tests/it/content_control_save_cost.rs index c61268e96c..0ed92b64d6 100644 --- a/crates/docx/tests/it/content_control_save_cost.rs +++ b/crates/docx/tests/it/content_control_save_cost.rs @@ -74,6 +74,7 @@ fn cost_ratio(scale: usize, mut small: impl FnMut(), mut big: impl FnMut()) -> ( /// looked for each paragraph's markers in the whole set of markers, once per paragraph, so a /// document with 32,000 controls took four seconds to save where it takes a tenth of one now. #[test] +#[cfg_attr(coverage, ignore = "coverage instrumentation skews the measured time")] fn a_document_with_many_inline_content_controls_saves_in_linear_time() { let scale = 4; let small = inline_controls(8_000); @@ -94,6 +95,7 @@ fn a_document_with_many_inline_content_controls_saves_in_linear_time() { /// The same for the controls written around whole paragraphs: the writer compared every control /// with every other one to find the ones that clash, so the save was quadratic in their number. #[test] +#[cfg_attr(coverage, ignore = "coverage instrumentation skews the measured time")] fn a_document_with_many_block_content_controls_saves_in_linear_time() { let scale = 4; let small = block_controls(8_000); diff --git a/crates/docx/tests/it/malformed.rs b/crates/docx/tests/it/malformed.rs index e5e06407ae..304b9fcf38 100644 --- a/crates/docx/tests/it/malformed.rs +++ b/crates/docx/tests/it/malformed.rs @@ -152,6 +152,7 @@ fn many_fields_and_huge_attribute_values() { /// A paragraph with 2,000,000 attributes deflates to ~15 KB. Opening it is refused with a /// limit error, or the extras are dropped and the text survives (#3702, WC-06). #[test] +#[cfg_attr(coverage, ignore = "coverage instrumentation skews the measured time")] fn millions_of_attributes_on_one_paragraph_are_capped() { let attrs: String = (0..2_000_000).map(|i| format!(" a{i}=\"\"")).collect(); let x = format!("kept"); @@ -222,6 +223,7 @@ fn malformed_or_hostile_bibliography_never_panics() { /// A file with a huge number of bibliography sources (duplicates and distinct ones) reads in /// linear time and keeps at most 10,000 of them. #[test] +#[cfg_attr(coverage, ignore = "coverage instrumentation skews the measured time")] fn hostile_bibliography_source_count_is_capped() { let doc = format!("body"); let mut sources = String::from(r#""#); diff --git a/crates/engine/src/cmd/citations/tests.rs b/crates/engine/src/cmd/citations/tests.rs index cdf12e23ed..b1fcdfede0 100644 --- a/crates/engine/src/cmd/citations/tests.rs +++ b/crates/engine/src/cmd/citations/tests.rs @@ -871,6 +871,7 @@ fn citation_source_lookups_keep_first_duplicates_case_and_style_order() { #[cfg(not(target_arch = "wasm32"))] #[test] +#[cfg_attr(coverage, ignore = "coverage instrumentation skews the measured time")] fn citation_refresh_source_lookup_work_scales_with_document_size() { fn doc(n: usize) -> Session { let mut p = Paragraph::new(); diff --git a/crates/engine/src/cmd/connectors.rs b/crates/engine/src/cmd/connectors.rs index b530ee858d..16114da442 100644 --- a/crates/engine/src/cmd/connectors.rs +++ b/crates/engine/src/cmd/connectors.rs @@ -332,6 +332,7 @@ mod tests { /// Drawing commands must not search every page again for each glued connector. #[test] + #[cfg_attr(coverage, ignore = "coverage instrumentation skews the measured time")] fn rerouting_many_pages_does_not_rescan_all_objects_per_connector() { use wordcraft_doc::{Document, Paragraph, para_block}; let mut doc = Document::new(); diff --git a/crates/engine/src/cmd/review/tests.rs b/crates/engine/src/cmd/review/tests.rs index 64dd983970..feb8f0ec4d 100644 --- a/crates/engine/src/cmd/review/tests.rs +++ b/crates/engine/src/cmd/review/tests.rs @@ -799,6 +799,7 @@ fn deleting_a_comment_in_a_parent_cycle_ends() { /// A very long reply chain (as a hostile file could hold) is deleted in one pass over the /// comments, not one pass per reply: 50,000 replies would otherwise freeze the app. #[test] +#[cfg_attr(coverage, ignore = "coverage instrumentation skews the measured time")] fn deleting_a_long_reply_chain_stays_fast() { let mut s = Session::new(Document::new()); s.view.proofing = false; diff --git a/crates/engine/src/speech/tests.rs b/crates/engine/src/speech/tests.rs index 9433326a78..39144a6efb 100644 --- a/crates/engine/src/speech/tests.rs +++ b/crates/engine/src/speech/tests.rs @@ -102,6 +102,7 @@ fn tidy_matches_replacing_until_nothing_changes() { /// Nested empty brackets are removed in one pass: 40,000 pairs took seconds when each pass /// removed one level (#3680). #[test] +#[cfg_attr(coverage, ignore = "coverage instrumentation skews the measured time")] fn tidy_is_linear_on_nested_brackets() { let n = 40_000; let started = std::time::Instant::now(); diff --git a/crates/engine/src/tests.rs b/crates/engine/src/tests.rs index 6becd6ef12..1181f55c09 100644 --- a/crates/engine/src/tests.rs +++ b/crates/engine/src/tests.rs @@ -1052,6 +1052,7 @@ fn rep_mode(text: &str, q: &str, with: &str, extra: serde_json::Value) -> String } #[test] +#[cfg_attr(coverage, ignore = "coverage instrumentation skews the measured time")] fn hostile_find_patterns_are_bounded() { let mut s = s(); run(&mut s, "document.setText", json!({"text": &"a".repeat(5000)})); @@ -12161,6 +12162,7 @@ fn inspect_document_removes_the_note_of_a_hidden_reference() { /// #1344: many hidden pieces (index entries are hidden text) are removed quickly, and the /// found list is capped. #[test] +#[cfg_attr(coverage, ignore = "coverage instrumentation skews the measured time")] fn inspect_document_removes_thousands_of_hidden_pieces() { use wordcraft_doc::props::CharProps; use wordcraft_doc::{Paragraph, para_block}; diff --git a/crates/fonts/src/fontdb/tests.rs b/crates/fonts/src/fontdb/tests.rs index d3f2fd34ab..b589921e85 100644 --- a/crates/fonts/src/fontdb/tests.rs +++ b/crates/fonts/src/fontdb/tests.rs @@ -450,6 +450,7 @@ fn long_names_are_cut_before_faces_copy_them() { } #[test] +#[cfg_attr(coverage, ignore = "coverage instrumentation skews the measured time")] fn named_instances_and_collection_members_are_capped() { // #3716: a file's faces are capped before they are built, however the file multiplies them. let font = variable_font(300); diff --git a/crates/formats/src/tests.rs b/crates/formats/src/tests.rs index 1214e7742c..e7c4d9b697 100644 --- a/crates/formats/src/tests.rs +++ b/crates/formats/src/tests.rs @@ -488,6 +488,7 @@ fn code_blocks_and_rules() { } #[test] +#[cfg_attr(coverage, ignore = "coverage instrumentation skews the measured time")] fn deep_nesting_is_bounded() { let html = "
".repeat(5000) + "x"; let d = import("html", html.as_bytes()).unwrap().unwrap(); @@ -566,6 +567,7 @@ fn latex_export_carries_no_commands_from_the_document() { /// past them for the last text made a megabyte of labels take tens of seconds), and labels /// separated by text are all kept. #[test] +#[cfg_attr(coverage, ignore = "coverage instrumentation skews the measured time")] fn latex_labels_in_a_row_are_read_in_linear_time() { let started = std::time::Instant::now(); for src in ["\\label{a} ".repeat(100_000) + "x", "\\label{a}".repeat(100_000) + "x", "\\hypertarget{a}{} ".repeat(100_000)] { @@ -743,6 +745,7 @@ fn decorative_picture_exports_with_empty_alt_text() { /// Hostile Markdown and HTML that rescanned the rest of the text from every `[`, `![`, `<` or `&` /// took quadratic time: a few hundred KB froze the importer for tens of seconds. #[test] +#[cfg_attr(coverage, ignore = "coverage instrumentation skews the measured time")] fn hostile_importer_input_takes_linear_time() { use std::time::{Duration, Instant}; let cases: [(&str, String); 5] = [ @@ -764,6 +767,7 @@ fn hostile_importer_input_takes_linear_time() { /// bracket scan over them looking for a closing run through the rest of the text: superlinear /// time on hostile Markdown. #[test] +#[cfg_attr(coverage, ignore = "coverage instrumentation skews the measured time")] fn unmatched_backtick_runs_take_linear_time() { use std::time::{Duration, Instant}; // Runs of 1, 2, … 2000 backticks (2 MB), none of them closed. diff --git a/crates/layout/src/tests.rs b/crates/layout/src/tests.rs index c1c51083e2..d80b0c082a 100644 --- a/crates/layout/src/tests.rs +++ b/crates/layout/src/tests.rs @@ -923,6 +923,7 @@ fn a_long_unbreakable_word_lays_out_in_linear_time() { /// A word a megabyte long lays out in a fraction of a second: it used to take half a minute. #[test] +#[cfg_attr(coverage, ignore = "coverage instrumentation skews the measured time")] fn a_megabyte_long_word_lays_out_quickly() { let d = long_word_beside_a_float(1_000_000); let t = std::time::Instant::now(); @@ -1143,6 +1144,7 @@ fn a_word_with_alternating_advances_lays_out_in_linear_time() { } #[test] +#[cfg_attr(coverage, ignore = "coverage instrumentation skews the measured time")] fn hidden_separators_with_automatic_hyphenation_lay_out_in_linear_time() { crate::test_fonts(); // "hyphenation " n times with every space hidden: one joined word of 11n letters reaches the @@ -1175,6 +1177,7 @@ fn page_break_paragraphs(n: usize) -> Document { /// the section list by walking the whole body, so a document of n paragraphs paid n body-length /// scans: a two-megabyte file took half a minute before the first page was drawn. #[test] +#[cfg_attr(coverage, ignore = "coverage instrumentation skews the measured time")] fn a_document_of_many_paragraphs_lays_out_in_linear_time() { let (t1, tk, ratio) = layout_time_ratio(page_break_paragraphs, 2_500, &LayoutOptions::default()); eprintln!("t(n) {t1:.4} s, t(8n) {tk:.4} s, ratio {ratio:.1}"); @@ -1182,6 +1185,7 @@ fn a_document_of_many_paragraphs_lays_out_in_linear_time() { } #[test] +#[cfg_attr(coverage, ignore = "coverage instrumentation skews the measured time")] fn many_hidden_float_anchors_lay_out_in_linear_time() { crate::test_fonts(); // n square-wrapped shapes, each anchored in its own hidden run (bold alternating, so runs do not diff --git a/crates/layout/src/tests/numeral.rs b/crates/layout/src/tests/numeral.rs index a1052dae84..9bf244e879 100644 --- a/crates/layout/src/tests/numeral.rs +++ b/crates/layout/src/tests/numeral.rs @@ -117,6 +117,7 @@ fn resolve_uses_the_given_system_locale() { } #[test] +#[cfg_attr(coverage, ignore = "coverage instrumentation skews the measured time")] fn context_mode_on_a_very_long_digit_run_stays_linear() { crate::test_fonts(); // Every digit used to scan back over all the digits and spaces before it (O(n²)). diff --git a/crates/pdf/src/tests.rs b/crates/pdf/src/tests.rs index 19f183d62f..aab3988cc5 100644 --- a/crates/pdf/src/tests.rs +++ b/crates/pdf/src/tests.rs @@ -390,6 +390,7 @@ fn cost_ratio(scale: usize, mut small: impl FnMut(), mut big: impl FnMut()) -> ( } #[test] +#[cfg_attr(coverage, ignore = "coverage instrumentation skews the measured time")] fn long_fragmented_hidden_headings_export_in_linear_time() { // Headings of n chars in one-char runs: all hidden with bold alternating, and hidden and visible // alternating. Layout and the bookmark/tag titles once scanned every left-out range for every @@ -1917,6 +1918,7 @@ fn comments_print_in_balloons_beside_scaled_pages() { /// references) exports in time proportional to its length: each link looked its bookmark up by /// walking the whole document, so NIH's 67-page protocol template took 10.6 s (0.9 s now). #[test] +#[cfg_attr(coverage, ignore = "coverage instrumentation skews the measured time")] fn internal_links_export_in_linear_time() { let doc = |n: usize| { let mut d = Document::new(); @@ -3121,6 +3123,7 @@ fn only_safe_link_targets_become_annotations() { /// without one), found in one pass: a long run of glyphs sharing a cluster used to rescan the rest /// of the run for every glyph. #[test] +#[cfg_attr(coverage, ignore = "coverage instrumentation skews the measured time")] fn cluster_ends_match_the_next_larger_cluster_in_linear_time() { let brute = |cl: &[usize], len: usize| -> Vec { (0..cl.len()).map(|i| cl.iter().skip(i + 1).copied().find(|n| *n > cl[i]).unwrap_or(len)).collect::>() diff --git a/crates/zotero/src/tests/limits.rs b/crates/zotero/src/tests/limits.rs index ce6b12c673..b18c4fe18f 100644 --- a/crates/zotero/src/tests/limits.rs +++ b/crates/zotero/src/tests/limits.rs @@ -56,6 +56,7 @@ fn listing_stops_at_the_field_budget() { // Finding 16: rich text with alternating formatting is built in one pass, not run by run with // every earlier run merged again. #[test] +#[cfg_attr(coverage, ignore = "coverage instrumentation skews the measured time")] fn rich_text_with_many_runs_is_linear() { let html: String = "ab".repeat(50_000); let t = Instant::now(); @@ -82,6 +83,7 @@ fn call(b: &mut Bridge, s: &mut Session, method: &str, args: Value) -> Result