diff options
| author | 许杰友 Jieyou Xu (Joe) <jieyouxu@outlook.com> | 2024-07-19 10:22:31 +0000 |
|---|---|---|
| committer | 许杰友 Jieyou Xu (Joe) <jieyouxu@outlook.com> | 2024-07-19 14:04:58 +0000 |
| commit | 993d83af71e133695c5b8378443bf3d49bc422ac (patch) | |
| tree | 3c679cd7baa562882c50e00ece31eeda209d0415 | |
| parent | aa22102f2f52f35f0e48688bcc6f90de1ee48b20 (diff) | |
| download | rust-993d83af71e133695c5b8378443bf3d49bc422ac.tar.gz rust-993d83af71e133695c5b8378443bf3d49bc422ac.zip | |
compiletest/rmake: cleanup `stage_std_path` and `recipe_dylib_search_paths` handling
| -rw-r--r-- | src/tools/compiletest/src/runtest.rs | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index 4dffef36af7..9d7585de577 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -3660,27 +3660,35 @@ impl<'test> TestCx<'test> { rustc.arg("--sysroot").arg(&stage0_sysroot); } + // Now run rustc to build the recipe. let res = self.run_command_to_procres(&mut rustc); if !res.status.success() { self.fatal_proc_rec("run-make test failed: could not build `rmake.rs` recipe", &res); } - // FIXME(jieyouxu): explain what the hecc we are doing here. - let mut stage_std_path = PathBuf::new(); - stage_std_path.push(&build_root); - stage_std_path.push(&stage); - stage_std_path.push("lib"); + // To actually run the recipe, we have to provide the recipe with a bunch of information + // provided through env vars. - // FIXME(jieyouxu): explain what the hecc we are doing here. + // Compute stage-specific standard library paths. + let stage_std_path = { + let mut p = build_root.clone(); + p.push(&stage); + p.push("lib"); + p + }; + debug!(?stage_std_path); + + // Compute dynamic library search paths for recipes. let recipe_dylib_search_paths = { let mut paths = base_dylib_search_paths.clone(); paths.push(support_lib_path.parent().unwrap().to_path_buf()); paths.push(stage_std_path.join("rustlib").join(&self.config.host).join("lib")); paths }; + debug!(?recipe_dylib_search_paths); - // FIXME(jieyouxu): explain what the hecc we are doing here. - let target_rpaths = { + // Compute runtime library search paths for recipes. This is target-specific. + let target_runtime_dylib_search_paths = { let mut paths = vec![rmake_out_dir.clone()]; paths.extend(base_dylib_search_paths.iter().cloned()); paths @@ -3693,7 +3701,7 @@ impl<'test> TestCx<'test> { .stdout(Stdio::piped()) .stderr(Stdio::piped()) .env("LD_LIB_PATH_ENVVAR", dylib_env_var()) - .env("TARGET_RPATH_ENV", &env::join_paths(target_rpaths).unwrap()) + .env("TARGET_RPATH_ENV", &env::join_paths(target_runtime_dylib_search_paths).unwrap()) .env(dylib_env_var(), &env::join_paths(recipe_dylib_search_paths).unwrap()) .env("TARGET", &self.config.target) .env("PYTHON", &self.config.python) |
