Skip to content

Commit

Permalink
FIX: Add debug info, ready to debug
Browse files Browse the repository at this point in the history
  • Loading branch information
badumbatish committed Sep 10, 2024
1 parent 2920eba commit 08668c7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 2 additions & 0 deletions cargo-miri/src/phases.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ pub fn phase_cargo_miri(mut args: impl Iterator<Item = String>) {
let target_dir = get_target_dir(&metadata);
cmd.arg("--target-dir").arg(target_dir);

eprintln!("Getting miri flags in phase_cargo_miri");
cmd.args(get_miriflags());
// Store many-seeds argument.
let mut many_seeds = None;
Expand Down Expand Up @@ -642,6 +643,7 @@ pub fn phase_runner(mut binary_args: impl Iterator<Item = String>, phase: Runner
}
}
// Respect miriflags.
eprintln!("Get miri flags in phase_runner");
cmd.args(get_miriflags());
// Set the current seed.
if let Some(seed) = seed {
Expand Down
11 changes: 8 additions & 3 deletions cargo-miri/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,25 +116,30 @@ pub fn get_miriflags() -> Vec<String> {
// if --config doesn't exist, we check offical env var MIRIFLAGS (3)
//
// if MIRIFLAGS is non-existent, we then check for toml (4)
let cargo_dash_dash_config = cargo_extra_flags();
if let Ok(cargo_encoded_miri_flags) = env::var("CARGO_ENCODED_MIRIFLAGS") {
// (1)
eprintln!("Choice 1");
flagsplit(cargo_encoded_miri_flags.as_str())
} else if cargo_dash_dash_config.contains(&"miri".to_string()) {
} else if cargo_extra_flags().iter().any(|s| s.contains(&"-Zmiri".to_string())) {
// (2)
eprintln!("Choice 2");
let cargo_dash_dash_config = cargo_extra_flags();
let miri_flags_vec = cargo_dash_dash_config
.into_iter()
.filter(|arg| arg.contains(&"miri".to_string()))
.filter(|arg| arg.contains(&"-Zmiri".to_string()))
.collect::<Vec<String>>();
let miri_flags_string = miri_flags_vec.join(" ");
env::set_var("CARGO_ENCODED_MIRIFLAGS", miri_flags_string);
miri_flags_vec
} else if let Ok(a) = env::var("MIRIFLAGS") {
// (3)
// This code is taken from `RUSTFLAGS` handling in cargo.
eprintln!("Choice 3");
eprintln!("{}", a);
a.split(' ').map(str::trim).filter(|s| !s.is_empty()).map(str::to_string).collect()
} else {
// (4)
eprintln!("Choice 4");
serde_json::from_str::<Vec<String>>(config_miriflags).unwrap_or_default()
}
}
Expand Down

0 comments on commit 08668c7

Please sign in to comment.