| // Copyright 2026 The Fuchsia Authors | |
| // | |
| // Licensed under a BSD-style license <LICENSE-BSD>, Apache License, Version 2.0 | |
| // <LICENSE-APACHE or https://www.apache.org/licenses/LICENSE-2.0>, or the MIT | |
| // license <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your option. | |
| // This file may not be copied, modified, or distributed except according to | |
| // those terms. | |
| //! Miri execution authority discovering `miri` from the active compiler sysroot | |
| //! or explicit environment overrides (never silently skewing toolchains), with | |
| //! offline file-locked `cargo miri setup` sysroot caching and anchored UB | |
| //! diagnostic parsing. | |
| use std::{ | |
| collections::{BTreeMap, BTreeSet}, | |
| env, | |
| ffi::{OsStr, OsString}, | |
| fmt, | |
| fs::{self, File}, | |
| io::{self, Read}, | |
| path::{Path, PathBuf}, | |
| sync::atomic::{AtomicU64, Ordering}, | |
| thread, | |
| time::{Instant, SystemTime, UNIX_EPOCH}, | |
| }; | |
| use anneal_testkit::{Invocation, ProcessOutcome, Termination}; | |
| use serde::{Deserialize, Serialize}; | |
| use sha2::{Digest, Sha256}; | |
| use crate::{ | |
| outcome::{AuthorityRunResult, CallerFrameLaw, TerminalOutcome, sha256_hex}, | |
| rustc_runner::{ | |
| DYLIB_PATH_ENV_VAR, atomic_write_file, build_child_path, | |
| canonicalize_preserving_rustup_proxy_with_suffix, exe_name, exe_name_for_suffix, | |
| forward_env_keys_with_env, forward_platform_temp_and_profile_env_with_env, | |
| is_rustup_executable_name, is_rustup_proxy_executable, join_dylib_path, | |
| parse_and_validate_host_target_triple, resolve_candidate_exe_with_suffix, | |
| resolve_explicit_or_path_exe_with_suffix, resolve_rustup_env_for_sysroot_with_env, | |
| resolve_verified_backing_sysroot_with_suffix, run_probe_supervised, | |
| run_probe_supervised_with_timeout, run_supervised_with_prefix, | |
| sysroots_equivalent_with_suffix, | |
| }, | |
| spec::{ | |
| TraceTestCase, parse_pre_abort_stdout_with_expected_args, parse_pre_entry_slots_stdout, | |
| parse_trace_json_stdout_with_expected_args, render_standalone_rust_harness, | |
| }, | |
| trace_observer::{ObservableSpine, PRE_ABORT_JSON_PREFIX, PRE_ENTRY_JSON_PREFIX}, | |
| }; | |
| mod diagnostics; | |
| mod digest; | |
| mod discovery; | |
| mod identity; | |
| mod invocation; | |
| mod runner; | |
| pub use diagnostics::*; | |
| pub use digest::*; | |
| pub use discovery::*; | |
| pub use identity::*; | |
| pub use invocation::*; | |
| pub use runner::*; | |
| const MIRI_SETUP_TIMEOUT_SECS: u64 = 300; | |
| const MIRI_RUN_TIMEOUT_SECS: u64 = 120; | |
| const MIRI_SYSROOT_IDENTITY_SCHEMA: u32 = 4; | |
| const MIRI_BUILT_ARTIFACTS_SCHEMA: u32 = 1; | |
| const MIRI_BUILT_ARTIFACTS_FILE: &str = ".anneal-itree-miri-artifacts.json"; | |
| const STREAM_HASH_BUF_BYTES: usize = 64 * 1024; | |
| const MAX_TREE_HASH_WORKERS: usize = 8; |