Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 0390331

Browse files
committed
compiletest/rmake: prune useless env vars and explain passed rustc options and env vars
1 parent cbf28f3 commit 0390331

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

src/tools/compiletest/src/runtest.rs

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3607,24 +3607,26 @@ impl<'test> TestCx<'test> {
36073607
// FIXME(jieyouxu): audit these env vars. some of them only makes sense for make, not rustc!
36083608
let mut rustc = Command::new(&self.config.rustc_path);
36093609
rustc
3610+
// Specify output path
36103611
.arg("-o")
36113612
.arg(&recipe_bin)
3613+
// Specify library search paths for `run_make_support`.
36123614
.arg(format!("-Ldependency={}", &support_lib_path.parent().unwrap().to_string_lossy()))
36133615
.arg(format!("-Ldependency={}", &support_lib_deps.to_string_lossy()))
36143616
.arg(format!("-Ldependency={}", &support_lib_deps_deps.to_string_lossy()))
3617+
// Provide `run_make_support` as extern prelude, so test writers don't need to write
3618+
// `extern run_make_support;`.
36153619
.arg("--extern")
36163620
.arg(format!("run_make_support={}", &support_lib_path.to_string_lossy()))
3621+
// Default to Edition 2021.
36173622
.arg("--edition=2021")
3623+
// Specify compilation target.
3624+
.arg("--target")
3625+
.arg(&self.config.target)
3626+
// The recipe file itself.
36183627
.arg(&self.testpaths.file.join("rmake.rs"))
3619-
.env("TARGET", &self.config.target)
3620-
.env("PYTHON", &self.config.python)
3621-
.env("RUST_BUILD_STAGE", &self.config.stage_id)
3622-
.env("RUSTC", &self.config.rustc_path)
3623-
.env("LD_LIB_PATH_ENVVAR", dylib_env_var())
3624-
.env(dylib_env_var(), &env::join_paths(host_dylib_search_paths).unwrap())
3625-
.env("HOST_RPATH_DIR", &self.config.compile_lib_path)
3626-
.env("TARGET_RPATH_DIR", &self.config.run_lib_path)
3627-
.env("LLVM_COMPONENTS", &self.config.llvm_components);
3628+
// Provide necessary library search paths for rustc.
3629+
.env(dylib_env_var(), &env::join_paths(host_dylib_search_paths).unwrap());
36283630

36293631
// In test code we want to be very pedantic about values being silently discarded that are
36303632
// annotated with `#[must_use]`.

0 commit comments

Comments
 (0)