about summary refs log tree commit diff
diff options
context:
space:
mode:
author许杰友 Jieyou Xu (Joe) <jieyouxu@outlook.com>2024-07-19 09:56:53 +0000
committer许杰友 Jieyou Xu (Joe) <jieyouxu@outlook.com>2024-07-19 14:04:58 +0000
commit2383e9dd4f61d9a6f9f4334ec8a10ae0116ad107 (patch)
treebe46091b10be2ac1b16693c24329980009cd4dbb
parentf5488f0c4b12aa56744da0cb212df7b7152ea580 (diff)
downloadrust-2383e9dd4f61d9a6f9f4334ec8a10ae0116ad107.tar.gz
rust-2383e9dd4f61d9a6f9f4334ec8a10ae0116ad107.zip
compiletest/rmake: prune useless env vars and explain passed rustc options and env vars
-rw-r--r--src/tools/compiletest/src/runtest.rs17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs
index ba7bac18c9d..ea9b928a29c 100644
--- a/src/tools/compiletest/src/runtest.rs
+++ b/src/tools/compiletest/src/runtest.rs
@@ -3611,24 +3611,23 @@ impl<'test> TestCx<'test> {
         // FIXME(jieyouxu): audit these env vars. some of them only makes sense for make, not rustc!
         let mut rustc = Command::new(&self.config.rustc_path);
         rustc
+            // Specify output path
             .arg("-o")
             .arg(&recipe_bin)
+            // Specify library search paths for `run_make_support`.
             .arg(format!("-Ldependency={}", &support_lib_path.parent().unwrap().to_string_lossy()))
             .arg(format!("-Ldependency={}", &support_lib_deps.to_string_lossy()))
             .arg(format!("-Ldependency={}", &support_lib_deps_deps.to_string_lossy()))
+            // Provide `run_make_support` as extern prelude, so test writers don't need to write
+            // `extern run_make_support;`.
             .arg("--extern")
             .arg(format!("run_make_support={}", &support_lib_path.to_string_lossy()))
+            // Default to Edition 2021.
             .arg("--edition=2021")
+            // The recipe file itself.
             .arg(&self.testpaths.file.join("rmake.rs"))
-            .env("TARGET", &self.config.target)
-            .env("PYTHON", &self.config.python)
-            .env("RUST_BUILD_STAGE", &self.config.stage_id)
-            .env("RUSTC", &self.config.rustc_path)
-            .env("LD_LIB_PATH_ENVVAR", dylib_env_var())
-            .env(dylib_env_var(), &env::join_paths(host_dylib_search_paths).unwrap())
-            .env("HOST_RPATH_DIR", &self.config.compile_lib_path)
-            .env("TARGET_RPATH_DIR", &self.config.run_lib_path)
-            .env("LLVM_COMPONENTS", &self.config.llvm_components);
+            // Provide necessary library search paths for rustc.
+            .env(dylib_env_var(), &env::join_paths(host_dylib_search_paths).unwrap());
 
         // In test code we want to be very pedantic about values being silently discarded that are
         // annotated with `#[must_use]`.