Skip to content

Commit

Permalink
Refator DependencyBuilder construction
Browse files Browse the repository at this point in the history
  • Loading branch information
oli-obk committed Sep 16, 2024
1 parent 5a6a408 commit b798ee3
Showing 1 changed file with 15 additions and 14 deletions.
29 changes: 15 additions & 14 deletions tests/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,22 +118,23 @@ fn miri_config(target: &str, path: &str, mode: Mode, with_dependencies: bool) ->
config.comment_defaults.base().add_custom("edition", Edition("2021".into()));

if with_dependencies {
// Set the `cargo-miri` binary, which we expect to be in the same folder as the `miri` binary.
// (It's a separate crate, so we don't get an env var from cargo.)
let mut program = CommandBuilder::cargo();
program.program = {
let mut prog = miri_path();
prog.set_file_name(format!("cargo-miri{}", env::consts::EXE_SUFFIX));
prog
};
let builder_args = ["miri", "run"]; // There is no `cargo miri build` so we just use `cargo miri run`.
program.args = builder_args.into_iter().map(Into::into).collect();
let crate_manifest_path = Path::new("test_dependencies").join("Cargo.toml");
// Reset `RUSTFLAGS` to work around <https://github.com/rust-lang/rust/pull/119574#issuecomment-1876878344>.
program.envs.push(("RUSTFLAGS".into(), None));
config.comment_defaults.base().set_custom(
"dependencies",
DependencyBuilder { program, crate_manifest_path, build_std: None },
DependencyBuilder {
program: CommandBuilder {
// Set the `cargo-miri` binary, which we expect to be in the same folder as the `miri` binary.
// (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`.
args: ["miri", "run"].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)],
..CommandBuilder::cargo()
},
crate_manifest_path: Path::new("test_dependencies").join("Cargo.toml"),
build_std: None,
},
);
}
config
Expand Down

0 comments on commit b798ee3

Please sign in to comment.