Skip to content

Commit 993d83a

Browse files
committed
compiletest/rmake: cleanup stage_std_path and recipe_dylib_search_paths handling
1 parent aa22102 commit 993d83a

File tree

1 file changed

+17
-9
lines changed

1 file changed

+17
-9
lines changed

src/tools/compiletest/src/runtest.rs

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3660,27 +3660,35 @@ impl<'test> TestCx<'test> {
36603660
rustc.arg("--sysroot").arg(&stage0_sysroot);
36613661
}
36623662

3663+
// Now run rustc to build the recipe.
36633664
let res = self.run_command_to_procres(&mut rustc);
36643665
if !res.status.success() {
36653666
self.fatal_proc_rec("run-make test failed: could not build `rmake.rs` recipe", &res);
36663667
}
36673668

3668-
// FIXME(jieyouxu): explain what the hecc we are doing here.
3669-
let mut stage_std_path = PathBuf::new();
3670-
stage_std_path.push(&build_root);
3671-
stage_std_path.push(&stage);
3672-
stage_std_path.push("lib");
3669+
// To actually run the recipe, we have to provide the recipe with a bunch of information
3670+
// provided through env vars.
36733671

3674-
// FIXME(jieyouxu): explain what the hecc we are doing here.
3672+
// Compute stage-specific standard library paths.
3673+
let stage_std_path = {
3674+
let mut p = build_root.clone();
3675+
p.push(&stage);
3676+
p.push("lib");
3677+
p
3678+
};
3679+
debug!(?stage_std_path);
3680+
3681+
// Compute dynamic library search paths for recipes.
36753682
let recipe_dylib_search_paths = {
36763683
let mut paths = base_dylib_search_paths.clone();
36773684
paths.push(support_lib_path.parent().unwrap().to_path_buf());
36783685
paths.push(stage_std_path.join("rustlib").join(&self.config.host).join("lib"));
36793686
paths
36803687
};
3688+
debug!(?recipe_dylib_search_paths);
36813689

3682-
// FIXME(jieyouxu): explain what the hecc we are doing here.
3683-
let target_rpaths = {
3690+
// Compute runtime library search paths for recipes. This is target-specific.
3691+
let target_runtime_dylib_search_paths = {
36843692
let mut paths = vec![rmake_out_dir.clone()];
36853693
paths.extend(base_dylib_search_paths.iter().cloned());
36863694
paths
@@ -3693,7 +3701,7 @@ impl<'test> TestCx<'test> {
36933701
.stdout(Stdio::piped())
36943702
.stderr(Stdio::piped())
36953703
.env("LD_LIB_PATH_ENVVAR", dylib_env_var())
3696-
.env("TARGET_RPATH_ENV", &env::join_paths(target_rpaths).unwrap())
3704+
.env("TARGET_RPATH_ENV", &env::join_paths(target_runtime_dylib_search_paths).unwrap())
36973705
.env(dylib_env_var(), &env::join_paths(recipe_dylib_search_paths).unwrap())
36983706
.env("TARGET", &self.config.target)
36993707
.env("PYTHON", &self.config.python)

0 commit comments

Comments
 (0)