From 2eb8810d322470d2b7f72ac08c10824cc147a9b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=AE=B8=E6=9D=B0=E5=8F=8B=20Jieyou=20Xu=20=28Joe=29?= Date: Fri, 19 Jul 2024 09:19:44 +0000 Subject: [PATCH] compiletest/rmake: move `stage_std_path` and `recipe_bin` closer to use site --- src/tools/compiletest/src/runtest.rs | 29 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index c8fc84ef3fb1..2efd9820172b 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -3543,19 +3543,6 @@ impl<'test> TestCx<'test> { support_lib_path.push(format!("{}-tools-bin", stage)); support_lib_path.push("librun_make_support.rlib"); - let mut stage_std_path = PathBuf::new(); - stage_std_path.push(&build_root); - stage_std_path.push(&stage); - stage_std_path.push("lib"); - - // Then, we need to build the recipe `rmake.rs` and link in the support library. - // FIXME(jieyouxu): use `std::env::consts::EXE_EXTENSION`. - let recipe_bin = base_dir.join(if self.config.target.contains("windows") { - "rmake.exe" - } else { - "rmake" - }); - // FIXME(jieyouxu): explain what the hecc we are doing here. let mut support_lib_deps = PathBuf::new(); support_lib_deps.push(&build_root); @@ -3583,6 +3570,15 @@ impl<'test> TestCx<'test> { host_dylib_env_paths.extend(orig_dylib_env_paths.iter().cloned()); let host_dylib_env_paths = env::join_paths(host_dylib_env_paths).unwrap(); + // Finally, we need to run the recipe binary to build and run the actual tests. + // FIXME(jieyouxu): use `std::env::consts::EXE_EXTENSION`. + let recipe_bin = base_dir.join(if self.config.target.contains("windows") { + "rmake.exe" + } else { + "rmake" + }); + debug!(?recipe_bin); + // FIXME(jieyouxu): explain what the hecc we are doing here. // FIXME(jieyouxu): audit these env vars. some of them only makes sense for make, not rustc! let mut cmd = Command::new(&self.config.rustc_path); @@ -3624,8 +3620,11 @@ impl<'test> TestCx<'test> { self.fatal_proc_rec("run-make test failed: could not build `rmake.rs` recipe", &res); } - // Finally, we need to run the recipe binary to build and run the actual tests. - debug!(?recipe_bin); + // 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"); // FIXME(jieyouxu): explain what the hecc we are doing here. let mut dylib_env_paths = orig_dylib_env_paths.clone();