(&self)
| 2640 | "[123/456] _private.Std.Tactic.BVDecide.LRAT.Internal.Formula.Proof"; |
| 2641 | let compact = compact_in_flight_label(label, 40); |
| 2642 | assert!(compact.starts_with("[123/456] ...")); |
| 2643 | assert!(compact.ends_with("Internal.Formula.Proof")); |
| 2644 | assert!(compact.chars().count() <= 40); |
| 2645 | } |
| 2646 | |
| 2647 | #[test] |
| 2648 | fn compact_in_flight_label_handles_tiny_limits() { |
| 2649 | assert_eq!(compact_in_flight_label("[1/2] Very.Long.Name", 0), ""); |
| 2650 | assert_eq!(compact_in_flight_label("[1/2] Very.Long.Name", 2), "[1"); |
| 2651 | } |
| 2652 | } |
| 2653 | |
| 2654 | /// Default threshold at and above which a completed check is "slow" enough to |
| 2655 | /// keep a persistent line in quiet mode. Override with |
| 2656 | /// `IX_KERNEL_CHECK_SLOW_MS`. |
| 2657 | const DEFAULT_SLOW_THRESHOLD: Duration = Duration::from_secs(7); |
| 2658 | |
| 2659 | /// Default threshold for a one-shot "still checking ..." line when an active |
| 2660 | /// parallel check has been in-flight for a long time. Override with |
| 2661 | /// `IX_KERNEL_CHECK_ACTIVE_SLOW_MS`; set it to `0` to disable the notice. |
| 2662 | const DEFAULT_ACTIVE_SLOW_THRESHOLD: Duration = Duration::from_secs(30); |
| 2663 | |
| 2664 | const DEFAULT_IN_FLIGHT_LIMIT: usize = 3; |
| 2665 | const DEFAULT_IN_FLIGHT_LABEL_CHARS: usize = 120; |
| 2666 | const DEFAULT_CHECK_CLEAR_EVERY: usize = 1; |
| 2667 | |
| 2668 | fn env_duration_ms(var: &str, default: Duration) -> Duration { |
| 2669 | std::env::var(var) |
| 2670 | .ok() |
| 2671 | .and_then(|s| s.parse::<u64>().ok()) |
| 2672 | .map_or(default, Duration::from_millis) |
| 2673 | } |
| 2674 | |
| 2675 | fn env_duration_ms_optional(var: &str, default: Duration) -> Option<Duration> { |
| 2676 | let ms = std::env::var(var) |
| 2677 | .ok() |
| 2678 | .and_then(|s| s.parse::<u64>().ok()) |
| 2679 | .unwrap_or_else(|| u64::try_from(default.as_millis()).unwrap_or(u64::MAX)); |
| 2680 | if ms == 0 { None } else { Some(Duration::from_millis(ms)) } |
| 2681 | } |
| 2682 | |
| 2683 | fn env_usize(var: &str, default: usize) -> usize { |
| 2684 | std::env::var(var) |
| 2685 | .ok() |
| 2686 | .and_then(|s| s.parse::<usize>().ok()) |
| 2687 | .unwrap_or(default) |
| 2688 | } |
| 2689 | |
| 2690 | fn kernel_check_slow_threshold() -> Duration { |
| 2691 | env_duration_ms("IX_KERNEL_CHECK_SLOW_MS", DEFAULT_SLOW_THRESHOLD) |
| 2692 | } |
| 2693 | |
| 2694 | fn kernel_check_clear_every() -> usize { |
| 2695 | env_usize("IX_KERNEL_CHECK_CLEAR_EVERY", DEFAULT_CHECK_CLEAR_EVERY).max(1) |
| 2696 | } |
| 2697 | |
| 2698 | /// Threshold (max cache len) above which a per-block diagnostic line is |
| 2699 | /// emitted, when `IX_KERNEL_CHECK_DIAG=1`. Default 100k entries — empirically |
no test coverage detected