From c002f1352749830f92cc6d503bf3a63c01fcdc85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Fri, 23 Oct 2026 18:27:54 +0300 Subject: [PATCH] =?UTF-8?q?=E2=9A=A1=20nextest=20fast=20tier:=20-P=20fast?= =?UTF-8?q?=20skips=20the=20slow=20decode/export=20tests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .config/nextest.toml | 6 +++ scripts/heavy_tests.py | 97 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 103 insertions(+) create mode 100644 scripts/heavy_tests.py diff --git a/.config/nextest.toml b/.config/nextest.toml index c6bd505..819dc94 100644 --- a/.config/nextest.toml +++ b/.config/nextest.toml @@ -14,3 +14,9 @@ max-threads = 2 [[profile.default.overrides]] filter = 'package(engine) and test(/export|decode|render/)' test-group = "heavy" + +# The quick tier for edits in progress: `cargo nextest run -P fast`. It skips the slow +# decode, export and render tests (>= 10 s in a full run); the full default run is the +# merge gate. Regenerate the filter with scripts/heavy_tests.py after a full run. +[profile.fast] +default-filter = 'not ((package(engine) and kind(test) and not binary(it)) or (binary_id(edith_mcp::it) and test(/^transcript::/)) or (binary_id(engine::it) and test(/^audio_bit_depth::/)) or (binary_id(engine::it) and test(/^av1_export::/)) or (binary_id(engine::it) and test(/^av1_software_export::/)) or (binary_id(engine::it) and test(/^av_sync::/)) or (binary_id(engine::it) and test(/^compose_at::/)) or (binary_id(engine::it) and test(/^effects::/)) or (binary_id(engine::it) and test(/^export_deep_ten_bit::/)) or (binary_id(engine::it) and test(/^export_presets::/)) or (binary_id(engine::it) and test(/^export_ten_bit::/)) or (binary_id(engine::it) and test(/^generators::/)) or (binary_id(engine::it) and test(/^grain_seek::/)) or (binary_id(engine::it) and test(/^hevc10_export::/)) or (binary_id(engine::it) and test(/^hevc_export::/)) or (binary_id(engine::it) and test(/^playback::/)) or (binary_id(engine::it) and test(/^prores_export::/)) or (binary_id(engine::it) and test(/^stills::/)) or (binary_id(engine::it) and test(/^undo_stress::/)) or (binary_id(engine::it) and test(/^video_copy::/)) or (binary_id(engine::it) and test(/^video_profile::/)) or (binary_id(engine::it) and test(/^voice_early_stop::/)) or (binary_id(edith::bin/edith) and test(=tests::cards::the_clock_stops_where_the_timeline_does_and_the_end_still_restarts)) or (binary_id(edith::bin/edith) and test(=tests::creator::normalize_each_track_names_the_tracks_it_moved)) or (binary_id(edith::bin/edith) and test(=tests::creator::normalize_sets_the_gain_and_one_undo_puts_it_back)) or (binary_id(edith_mcp::bin/edith_mcp) and test(=tests::a_running_export_is_waited_for_after_eof)) or (binary_id(edith_mcp::bin/edith_mcp) and test(=tests::a_stale_part_is_named_and_cleared_by_the_next_export)) or (binary_id(edith_mcp::bin/edith_mcp) and test(=tests::two_running_exports_are_both_waited_for_after_eof)) or (binary_id(edith_mcp::bin/edith_mcp) and test(=tools::edit::round12_tests::freeze_dry_run_writes_nothing_and_a_failed_batch_takes_its_source_back)) or (binary_id(edith_mcp::bin/edith_mcp) and test(=tools::edit::round13_tests::a_failed_batch_with_a_freeze_leaves_no_still_behind)) or (binary_id(edith_mcp::bin/edith_mcp) and test(=tools::edit::round13_tests::a_refused_freeze_in_a_fresh_folder_removes_the_folder_it_made)) or (binary_id(edith_mcp::bin/edith_mcp) and test(=tools::edit::tests::freeze_at_a_clips_last_frame_goes_after_it_with_no_sliver)) or (binary_id(edith_mcp::bin/edith_mcp) and test(=tools::edit::tests::freeze_inserted_inside_audio_warns_and_names_the_clip)) or (binary_id(edith_mcp::bin/edith_mcp) and test(=tools::edit::tests::freeze_inserts_a_still_and_shifts_the_rest)) or (binary_id(edith_mcp::bin/edith_mcp) and test(=tools::edit::tests::freeze_same_frame_reuses_the_source_and_a_graded_clip_gets_a_new_one)) or (binary_id(edith_mcp::bin/edith_mcp) and test(=tools::edit::tests::freeze_without_insert_overlays_a_new_top_lane)) or (binary_id(edith_mcp::bin/edith_mcp) and test(=tools::edit_fx::look_ops_tests::auto_color_writes_a_correction_and_reports_it)) or (binary_id(edith_mcp::bin/edith_mcp) and test(=tools::edit_fx::tests::a_title_warns_about_glyphs_the_font_cannot_draw_and_about_a_long_text)) or (binary_id(edith_mcp::bin/edith_mcp) and test(=tools::export::tests::a_picked_track_no_lane_places_is_written_whole_and_named)) or (binary_id(edith_mcp::bin/edith_mcp) and test(=tools::export::tests::a_stereo_clip_makes_the_timeline_stereo)) or (binary_id(edith_mcp::bin/edith_mcp) and test(=tools::export::tests::auto_av1_start_line_names_the_seat_and_the_bitrate)) or (binary_id(edith_mcp::bin/edith_mcp) and test(=tools::export::tests::auto_hevc_start_line_names_the_seat_and_the_gop_mode)) or (binary_id(edith_mcp::bin/edith_mcp) and test(=tools::export::tests::bit_depth_ten_is_refused_outside_av1_and_hevc_and_named_in_words)) or (binary_id(edith_mcp::bin/edith_mcp) and test(=tools::export::tests::overlapping_cues_are_named_as_merged_in_an_mp4_only)) or (binary_id(edith_mcp::bin/edith_mcp) and test(=tools::export::tests::start_reply_echoes_an_absolute_out_in_plain_words)) or (binary_id(edith_mcp::bin/edith_mcp) and test(=tools::export::tests::the_picture_formats_write_their_files)) or (binary_id(edith_mcp::bin/edith_mcp) and test(=tools::hear::tests::a_short_normalize_held_by_the_limiter_names_the_limiter)) or (binary_id(edith_mcp::bin/edith_mcp) and test(=tools::hear::tests::normalize_counts_on_a_limiter_already_on_and_never_advises_the_flag)) or (binary_id(edith_mcp::bin/edith_mcp) and test(=tools::hear::tests::normalize_counts_on_a_limiter_already_on_below_the_true_peak_target)) or (binary_id(edith_mcp::bin/edith_mcp) and test(=tools::hear::tests::normalize_dry_run_with_the_limiter_predicts_the_real_run)) or (binary_id(edith_mcp::bin/edith_mcp) and test(=tools::hear::tests::normalize_each_sets_every_lane_alone_to_the_target)) or (binary_id(edith_mcp::bin/edith_mcp) and test(=tools::hear::tests::normalize_limiter_path_ends_under_the_true_peak_ceiling)) or (binary_id(edith_mcp::bin/edith_mcp) and test(=tools::hear::tests::normalize_names_the_true_peak_cap_and_the_limiter_fixes_it)) or (binary_id(edith_mcp::bin/edith_mcp) and test(=tools::hear::tests::the_mix_with_the_limiter_is_held_at_the_true_peak_target)) or (binary_id(edith_mcp::bin/edith_mcp) and test(=tools::scan::tests::scan_of_a_clip_adds_timeline_times)) or (binary_id(edith_mcp::bin/edith_mcp) and test(=tools::scan::tests::steady_dark_flicker_is_not_a_fade)) or (binary_id(edith_mcp::bin/edith_mcp) and test(=tools::scan::tests::steady_dark_grain_is_not_a_fade_and_a_real_fade_is)) or (binary_id(edith_mcp::bin/edith_mcp) and test(=tools::see::tests::a_burned_caption_and_a_bottom_title_on_screen_together_are_named)) or (binary_id(edith_mcp::bin/edith_mcp) and test(=tools::see::tests::a_frame_whose_only_picture_is_hidden_is_not_called_a_gap)) or (binary_id(edith_mcp::bin/edith_mcp) and test(=tools::see::tests::burn_captions_refuses_source_and_bad_track)) or (binary_id(edith_mcp::bin/edith_mcp) and test(=tools::see::tests::burn_captions_true_is_the_defaults_and_false_is_off)) or (binary_id(edith_mcp::bin/edith_mcp) and test(=tools::see::tests::burned_frame_differs_from_plain_inside_a_cue)) or (binary_id(edith_mcp::bin/edith_mcp) and test(=tools::see::tests::burned_frame_reports_the_caption_it_drew_after_an_edit_and_a_cut)) or (binary_id(edith_mcp::bin/edith_mcp) and test(=tools::see::tests::caption_glyph_note_names_only_the_cue_on_screen)) or (binary_id(edith_mcp::bin/edith_mcp) and test(=tools::see::tests::contact_sheet_counts_an_audio_join_as_a_join_on_audio_lanes)) or (binary_id(edith_mcp::bin/edith_mcp) and test(=tools::see::tests::contact_sheet_is_one_image_of_the_expected_size)) or (binary_id(edith_mcp::bin/edith_mcp) and test(=tools::see::tests::contact_sheet_lists_a_dissolve_apart_from_the_hard_cut)) or (binary_id(edith_mcp::bin/edith_mcp) and test(=tools::see::tests::contact_sheet_merges_a_hard_cut_and_keeps_gaps_apart)) or (binary_id(edith_mcp::bin/edith_mcp) and test(=tools::see::tests::contact_sheet_of_a_source_says_it_has_no_edit_joins)) or (binary_id(edith_mcp::bin/edith_mcp) and test(=tools::see::tests::contact_sheet_on_one_clip_points_to_scenes_for_its_picture_cuts)) or (binary_id(edith_mcp::bin/edith_mcp) and test(=tools::see::tests::contact_sheet_save_names_the_path_it_wrote)) or (binary_id(edith_mcp::bin/edith_mcp) and test(=tools::see::tests::contact_sheet_with_only_a_dissolve_in_range_says_no_cuts)) or (binary_id(edith_mcp::bin/edith_mcp) and test(=tools::see::tests::frame_at_end_shows_the_last_frame_not_refused)) or (binary_id(edith_mcp::bin/edith_mcp) and test(=tools::see::tests::frame_names_the_source_time_in_seconds_across_a_rate_change)) or (binary_id(edith_mcp::bin/edith_mcp) and test(=tools::see::tests::frame_text_lists_the_titles_on_screen)) or (binary_id(edith_mcp::it) and test(=exit_paths::a_failed_export_after_stdin_closes_is_named_on_stderr)) or (binary_id(edith_mcp::it) and test(=stdout_clean::stdout_is_only_json_rpc)) or (binary_id(engine) and test(=decode::hevc::tests::rext_streams_decode_to_420_within_psnr_of_ffmpeg)) or (binary_id(engine) and test(=deinterlace::session_tests::field_mode_mid_gop_seeks_and_ranges_equal_a_sequential_decode)) or (binary_id(engine) and test(=deinterlace::session_tests::field_mode_reverse_plays_fields_in_reverse_temporal_order)) or (binary_id(engine) and test(=export::tests::a_long_track_is_judged_by_the_middle_of_what_it_samples)) or (binary_id(engine) and test(=export::tests::the_opus_encoder_is_pinned_to_the_band_it_was_measured_in)) or (binary_id(engine) and test(=loudness::tests::gating_ignores_trailing_silence)) or (binary_id(engine) and test(=playback::tests::a_single_paused_tick_inside_the_dissolve_window_is_already_blended)) or (binary_id(engine) and test(=render_cache::tests::a_render_serves_its_frames_until_an_effect_changes)) or (binary_id(engine) and test(=scenes::tests::a_continuous_shot_has_at_most_one_cut)) or (binary_id(engine) and test(=scenes::tests::a_range_agrees_with_the_whole_file)) or (binary_id(engine) and test(=text::tests::a_long_title_reports_its_wrapped_lines_and_its_share_of_the_frame)) or (binary_id(engine) and test(=tonemap::tests::the_grid_is_the_pipeline_on_its_nodes)) or (binary_id(engine) and test(=waveform::tests::a_film_length_source_paints_the_same_frame_in_windows)) or (binary_id(engine::it) and test(=anim_keys::a_keyless_clip_is_untouched_by_the_key_machinery)) or (binary_id(engine::it) and test(=anim_keys::colour_keys_are_exact_at_their_keys_and_held_outside)) or (binary_id(engine::it) and test(=anim_keys::colour_keys_grade_each_frame_like_a_constant_grade_of_the_interpolated_value)) or (binary_id(engine::it) and test(=anim_keys::opacity_keys_follow_the_curve_between_keys)) or (binary_id(engine::it) and test(=anim_keys::opacity_keys_multiply_with_the_fade)) or (binary_id(engine::it) and test(=anim_keys::the_stopwatch_adds_a_key_that_holds_the_picture_and_removes_it_again)) or (binary_id(engine::it) and test(=audio_export::a_mono_voiceover_under_a_stereo_bed_exports_stereo)) or (binary_id(engine::it) and test(=audio_export::the_sound_is_written_at_the_rate_that_was_asked_for)) or (binary_id(engine::it) and test(=audio_files::an_audio_only_project_saves_reloads_and_exports_its_sound)) or (binary_id(engine::it) and test(=av1::a_webm_export_is_av1_with_opus_sound_under_a_webm_doc_type)) or (binary_id(engine::it) and test(=av1::an_av1_export_carries_the_timelines_sound_in_either_container)) or (binary_id(engine::it) and test(=av1::an_av1_export_reopens_through_our_own_demuxer)) or (binary_id(engine::it) and test(=av1::seek_lands_on_the_picture_a_linear_software_decode_delivered)) or (binary_id(engine::it) and test(=av1::the_software_seat_decodes_every_frame)) or (binary_id(engine::it) and test(=av1::the_software_seat_decodes_ten_bit_av1)) or (binary_id(engine::it) and test(=backends::a_mixed_timeline_says_it_re_encodes_and_then_does)) or (binary_id(engine::it) and test(=backends::the_planned_encoders_are_the_ones_the_job_opens)) or (binary_id(engine::it) and test(=backends::the_planned_seat_follows_the_size_and_the_pin)) or (binary_id(engine::it) and test(=creator_tools::normalize_moves_the_mix_to_the_target_in_one_undo_step)) or (binary_id(engine::it) and test(=eq_audio::an_mp4_export_carries_the_boost_a_packet_copy_could_not)) or (binary_id(engine::it) and test(=export_color::a_graded_clip_exports_the_picture_the_preview_showed)) or (binary_id(engine::it) and test(=export_color::an_export_declares_the_space_it_was_written_in)) or (binary_id(engine::it) and test(=export_color::an_hdr_clip_is_tone_mapped_before_it_is_graded)) or (binary_id(engine::it) and test(=export_color::every_format_signals_its_space_in_the_bitstream)) or (binary_id(engine::it) and test(=export_software::a_vp8_source_is_exported_through_the_software_decoder)) or (binary_id(engine::it) and test(=export_software::a_vp9_source_is_exported_through_the_software_decoder)) or (binary_id(engine::it) and test(=invalidation::a_sound_edit_after_the_end_leaves_the_end_where_it_is)) or (binary_id(engine::it) and test(=mixed_fps::a_clip_at_another_rate_trims_to_the_room_it_was_dragged_to)) or (binary_id(engine::it) and test(=mixed_fps::a_speeded_clip_at_another_rate_is_exactly_both)) or (binary_id(engine::it) and test(=mixed_fps::an_export_of_two_rates_runs_at_the_speed_it_was_shot)) or (binary_id(engine::it) and test(=mixed_fps::an_export_runs_at_the_rate_the_project_was_cut_at)) or (binary_id(engine::it) and test(=mixed_fps::playback_shows_the_frame_the_file_holds_there)) or (binary_id(engine::it) and test(=multicam::flattening_keeps_the_render_and_leaves_plain_clips)) or (binary_id(engine::it) and test(=multicam::the_render_shows_the_active_angle_and_a_switch_is_one_undo_step)) or (binary_id(engine::it) and test(=opacity::a_layer_at_half_opacity_is_the_mean_of_the_two_layers)) or (binary_id(engine::it) and test(=opacity::a_single_clip_at_half_opacity_is_half_as_bright)) or (binary_id(engine::it) and test(=probe_duration::engine_duration_matches_ffprobe_for_every_asset)) or (binary_id(engine::it) and test(=project_fuzz::damaged_files_are_refused_or_loaded_never_panic_or_hang)) or (binary_id(engine::it) and test(=project_fuzz::random_projects_save_load_and_save_again_byte_for_byte)) or (binary_id(engine::it) and test(=project_fuzz::wild_values_the_setters_accept_still_save_and_load)) or (binary_id(engine::it) and test(=reverse::a_reversed_clip_shows_the_forward_frames_backwards)) or (binary_id(engine::it) and test(=reverse::backward_playback_crosses_cuts_and_plays_a_reversed_clip_forward_in_the_file)) or (binary_id(engine::it) and test(=reverse::backward_playback_draws_the_frames_from_the_playhead_down)) or (binary_id(engine::it) and test(=reverse::reverse_composes_with_speed)) or (binary_id(engine::it) and test(=saveload::a_refused_project_does_not_hang_on_its_own_decoder)) or (binary_id(engine::it) and test(=sequences::a_compounds_own_placement_and_grade_reach_the_picture)) or (binary_id(engine::it) and test(=sequences::a_nested_render_is_the_flat_render)) or (binary_id(engine::it) and test(=sequences::sequences_round_trip_through_the_file)) or (binary_id(engine::it) and test(=speed_frames::every_trim_wall_of_a_retimed_take_saves_and_reopens)) or (binary_id(engine::it) and test(=speed_ramp_audio::a_ramped_tone_keeps_its_pitch)) or (binary_id(engine::it) and test(=transform_keys::a_head_trim_keeps_the_keys_on_their_footage)) or (binary_id(engine::it) and test(=transform_keys::a_keyed_clip_composes_its_interpolated_placement_at_each_frame)) or (binary_id(engine::it) and test(=transform_keys::a_tail_trim_drops_the_keys_past_the_end_and_undo_restores_them)) or (binary_id(engine::it) and test(=transform_keys::keys_are_divided_by_a_split_and_the_picture_does_not_change)) or (binary_id(engine::it) and test(=transitions::ten_bit_export_dips_to_white_and_wipes_in_ten_bit_codes)) or (binary_id(engine::it) and test(=transitions::wipes_reveal_blue_from_the_side_they_move_toward)) or (binary_id(engine::it) and test(=vp8::ec_vp8_matches_libvpx_picture_for_picture)) or (binary_id(engine::it) and test(=vp8::the_software_seat_decodes_and_seeks_vp8)) or (binary_id(engine::it) and test(=vp9::a_refused_codec_at_a_span_advances_instead_of_stalling)) or (binary_id(engine::it) and test(=vp9::the_software_seat_decodes_and_seeks_vp9)))' diff --git a/scripts/heavy_tests.py b/scripts/heavy_tests.py new file mode 100644 index 0000000..c817163 --- /dev/null +++ b/scripts/heavy_tests.py @@ -0,0 +1,97 @@ +#!/usr/bin/env python3 +"""Print the nextest filterset that keeps the heavy tests out of the `fast` profile. + +Usage: + python3 scripts/heavy_tests.py [threshold_seconds=10] + +Reads PASS/FAIL result lines from a full nextest run log, dedupes them on +(binary id, test name), and prints one TOML literal string for +`default-filter` in the `[profile.fast]` section of .config/nextest.toml. + +Rerun it after a full run when slow tests come or go. +""" +import re +import sys +from collections import defaultdict + +RESULT = re.compile( + r"^\s*(?:PASS|FAIL)\s+\[\s*([\d.]+)s\]\s+\(\s*\d+/\d+\)\s+(\S+)\s+(\S.*?)\s*$" +) +ANSI = re.compile(r"\x1b\[[0-9;]*m") + +# Integration binaries of `engine` other than the merged `it` binary are heavy. +ENGINE_PKG = "engine" +# Binaries whose tests are grouped by the first `::` segment of the name. +MODULE_BINARIES = ("engine::it", "edith_mcp::it") +MODULE_SHARE = 0.6 + + +def load(path): + tests = {} + with open(path, encoding="utf-8", errors="replace") as f: + for line in f: + m = RESULT.match(ANSI.sub("", line)) + if m: + secs, binary, name = m.groups() + tests.setdefault((binary, name), float(secs)) + return tests + + +def in_engine_rule(binary): + """Term (a): integration test binaries of engine, except `it`.""" + pkg, sep, rest = binary.partition("::") + return pkg == ENGINE_PKG and bool(sep) and rest != "it" and not rest.startswith("bin/") + + +def build_terms(tests, threshold): + # Group module-binary tests by module (only names that have a `::`). + groups = defaultdict(lambda: defaultdict(list)) + for (binary, name), secs in tests.items(): + if binary in MODULE_BINARIES and "::" in name: + groups[binary][name.split("::", 1)[0]].append((name, secs)) + + heavy_modules = set() # (binary, module) + for binary, mods in groups.items(): + for module, items in mods.items(): + heavy = sum(1 for _, s in items if s >= threshold) + if heavy / len(items) >= MODULE_SHARE: + heavy_modules.add((binary, module)) + + a_terms = [f"(package({ENGINE_PKG}) and kind(test) and not binary(it))"] + b_terms = [] + for binary, module in sorted(heavy_modules): + b_terms.append(f"(binary_id({binary}) and test(/^{re.escape(module)}::/))") + + c_terms = [] + for (binary, name), secs in sorted(tests.items()): + if secs < threshold: + continue + if in_engine_rule(binary): + continue + if (binary, name.split("::", 1)[0]) in heavy_modules and "::" in name: + continue + c_terms.append(f"(binary_id({binary}) and test(={name}))") + + return a_terms, b_terms, c_terms + + +def toml_literal(expr): + if "'" in expr: + return "'''" + expr + "'''" + return "'" + expr + "'" + + +def main(): + if len(sys.argv) not in (2, 3): + sys.exit("usage: heavy_tests.py [threshold_seconds=10]") + threshold = float(sys.argv[2]) if len(sys.argv) == 3 else 10.0 + tests = load(sys.argv[1]) + a_terms, b_terms, c_terms = build_terms(tests, threshold) + expr = "not (" + " or ".join(a_terms + b_terms + c_terms) + ")" + print(f"{len(tests)} distinct tests, {len(a_terms)} (a), {len(b_terms)} (b), " + f"{len(c_terms)} (c)", file=sys.stderr) + print(toml_literal(expr)) + + +if __name__ == "__main__": + main()