Merge pull request #4842 from RalfJung/miri-run
`./miri run --dep`: do not run Miri during the dependency build
This commit is contained in:
commit
d17eefa90f
3 changed files with 20 additions and 9 deletions
|
|
@ -63,6 +63,9 @@ pub fn phase_cargo_miri(mut args: impl Iterator<Item = String>) {
|
|||
"setup" => MiriCommand::Setup,
|
||||
"test" | "t" | "run" | "r" | "nextest" => MiriCommand::Forward(subcommand),
|
||||
"clean" => MiriCommand::Clean,
|
||||
// For use by the `./miri test` dependency builder.
|
||||
"build" if env::var_os("MIRI_BUILD_TEST_DEPS").is_some() =>
|
||||
MiriCommand::Forward("build".into()),
|
||||
_ => {
|
||||
// Check for version and help flags.
|
||||
if has_arg_flag("--help") || has_arg_flag("-h") {
|
||||
|
|
|
|||
|
|
@ -1 +1,3 @@
|
|||
fn main() {}
|
||||
fn main() {
|
||||
unreachable!()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -132,14 +132,19 @@ fn miri_config(
|
|||
// (It's a separate crate, so we don't get an env var from cargo.)
|
||||
program: miri_path()
|
||||
.with_file_name(format!("cargo-miri{}", env::consts::EXE_SUFFIX)),
|
||||
// There is no `cargo miri build` so we just use `cargo miri run`.
|
||||
// Add `-Zbinary-dep-depinfo` since it is needed for bootstrap builds (and doesn't harm otherwise).
|
||||
args: ["miri", "run", "--quiet", "-Zbinary-dep-depinfo"]
|
||||
args: ["miri", "build", "-Zbinary-dep-depinfo"]
|
||||
.into_iter()
|
||||
.map(Into::into)
|
||||
.collect(),
|
||||
// Reset `RUSTFLAGS` to work around <https://github.com/rust-lang/rust/pull/119574#issuecomment-1876878344>.
|
||||
envs: vec![("RUSTFLAGS".into(), None)],
|
||||
envs: vec![
|
||||
// Reset `RUSTFLAGS` to work around <https://github.com/rust-lang/rust/pull/119574#issuecomment-1876878344>.
|
||||
("RUSTFLAGS".into(), None),
|
||||
// Reset `MIRIFLAGS` because it caused trouble in the past and should not be needed.
|
||||
("MIRIFLAGS".into(), None),
|
||||
// Allow `cargo miri build`.
|
||||
("MIRI_BUILD_TEST_DEPS".into(), Some("1".into())),
|
||||
],
|
||||
..CommandBuilder::cargo()
|
||||
},
|
||||
crate_manifest_path: Path::new("tests/deps").join("Cargo.toml"),
|
||||
|
|
@ -361,15 +366,16 @@ fn run_dep_mode(target: String, args: impl Iterator<Item = OsString>) -> Result<
|
|||
miri_config(&target, "", Mode::RunDep, Some(WithDependencies { bless: false }));
|
||||
config.comment_defaults.base().custom.remove("edition"); // `./miri` adds an `--edition` in `args`, so don't set it twice
|
||||
config.fill_host_and_target()?;
|
||||
let dep_builder = BuildManager::one_off(config.clone());
|
||||
// Only set these for the actual run, not the dep builder, so invalid flags do not fail
|
||||
// the dependency build.
|
||||
config.program.args = args.collect();
|
||||
let test_config = TestConfig::one_off_runner(config, PathBuf::new());
|
||||
|
||||
let test_config = TestConfig::one_off_runner(config.clone(), PathBuf::new());
|
||||
|
||||
let build_manager = BuildManager::one_off(config);
|
||||
let mut cmd = test_config.config.program.build(&test_config.config.out_dir);
|
||||
cmd.arg("--target").arg(test_config.config.target.as_ref().unwrap());
|
||||
// Build dependencies
|
||||
test_config.apply_custom(&mut cmd, &build_manager).unwrap();
|
||||
test_config.apply_custom(&mut cmd, &dep_builder).expect("failed to build dependencies");
|
||||
|
||||
if cmd.spawn()?.wait()?.success() { Ok(()) } else { std::process::exit(1) }
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue