Skip to content

Commit

Permalink
Auto merge of #85959 - RalfJung:miri-stage-0, r=Mark-Simulacrum
Browse files Browse the repository at this point in the history
fix testing Miri with --stage 0

Fixes #78778 for Miri.

The issue remains open for error_index_generator, which has its own dylib logic:
https://github.com/rust-lang/rust/blob/903e369c831d52726a5292f847e384622189d9a0/src/bootstrap/tool.rs#L396-L400
`@jyn514` I could just copy the logic from `add_rustc_lib_path`, but that does not seem great. Any other suggestions?

Also I wonder if maybe `prepare_tool_cargo` should already call `add_rustc_lib_path`.
  • Loading branch information
bors committed Jun 4, 2021
2 parents 4afa3a8 + 9e674af commit c4c2ab5
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
10 changes: 9 additions & 1 deletion src/bootstrap/builder.rs
Expand Up @@ -709,7 +709,15 @@ impl<'a> Builder<'a> {
return;
}

add_dylib_path(vec![self.rustc_libdir(compiler)], cmd);
let mut dylib_dirs = vec![self.rustc_libdir(compiler)];

// Ensure that the downloaded LLVM libraries can be found.
if self.config.llvm_from_ci {
let ci_llvm_lib = self.out.join(&*compiler.host.triple).join("ci-llvm").join("lib");
dylib_dirs.push(ci_llvm_lib);
}

add_dylib_path(dylib_dirs, cmd);
}

/// Gets a path to the compiler specified.
Expand Down
4 changes: 2 additions & 2 deletions src/bootstrap/test.rs
Expand Up @@ -449,6 +449,7 @@ impl Step for Miri {
SourceType::Submodule,
&[],
);
cargo.add_rustc_lib_path(builder, compiler);
cargo.arg("--").arg("miri").arg("setup");

// Tell `cargo miri setup` where to find the sources.
Expand Down Expand Up @@ -500,6 +501,7 @@ impl Step for Miri {
SourceType::Submodule,
&[],
);
cargo.add_rustc_lib_path(builder, compiler);

// miri tests need to know about the stage sysroot
cargo.env("MIRI_SYSROOT", miri_sysroot);
Expand All @@ -508,8 +510,6 @@ impl Step for Miri {

cargo.arg("--").args(builder.config.cmd.test_args());

cargo.add_rustc_lib_path(builder, compiler);

let mut cargo = Command::from(cargo);
if !try_run(builder, &mut cargo) {
return;
Expand Down
1 change: 1 addition & 0 deletions src/bootstrap/util.rs
Expand Up @@ -45,6 +45,7 @@ pub fn libdir(target: TargetSelection) -> &'static str {
}

/// Adds a list of lookup paths to `cmd`'s dynamic library lookup path.
/// If The dylib_path_par is already set for this cmd, the old value will be overwritten!
pub fn add_dylib_path(path: Vec<PathBuf>, cmd: &mut Command) {
let mut list = dylib_path();
for path in path {
Expand Down

0 comments on commit c4c2ab5

Please sign in to comment.