Skip to content

Commit 3b0dcbe

Browse files
committed
compiletest/rmake: prune useless env vars and explain passed rustc options and env vars
1 parent 13c6fe3 commit 3b0dcbe

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
@@ -3613,24 +3613,26 @@ impl<'test> TestCx<'test> {
36133613
// FIXME(jieyouxu): audit these env vars. some of them only makes sense for make, not rustc!
36143614
let mut rustc = Command::new(&self.config.rustc_path);
36153615
rustc
3616+
// Specify output path
36163617
.arg("-o")
36173618
.arg(&recipe_bin)
3619+
// Specify library search paths for `run_make_support`.
36183620
.arg(format!("-Ldependency={}", &support_lib_path.parent().unwrap().to_string_lossy()))
36193621
.arg(format!("-Ldependency={}", &support_lib_deps.to_string_lossy()))
36203622
.arg(format!("-Ldependency={}", &support_lib_deps_deps.to_string_lossy()))
3623+
// Provide `run_make_support` as extern prelude, so test writers don't need to write
3624+
// `extern run_make_support;`.
36213625
.arg("--extern")
36223626
.arg(format!("run_make_support={}", &support_lib_path.to_string_lossy()))
3627+
// Default to Edition 2021.
36233628
.arg("--edition=2021")
3629+
// Specify compilation target.
3630+
.arg("--target")
3631+
.arg(&self.config.target)
3632+
// The recipe file itself.
36243633
.arg(&self.testpaths.file.join("rmake.rs"))
3625-
.env("TARGET", &self.config.target)
3626-
.env("PYTHON", &self.config.python)
3627-
.env("RUST_BUILD_STAGE", &self.config.stage_id)
3628-
.env("RUSTC", &self.config.rustc_path)
3629-
.env("LD_LIB_PATH_ENVVAR", dylib_env_var())
3630-
.env(dylib_env_var(), &env::join_paths(host_dylib_search_paths).unwrap())
3631-
.env("HOST_RPATH_DIR", &self.config.compile_lib_path)
3632-
.env("TARGET_RPATH_DIR", &self.config.run_lib_path)
3633-
.env("LLVM_COMPONENTS", &self.config.llvm_components);
3634+
// Provide necessary library search paths for rustc.
3635+
.env(dylib_env_var(), &env::join_paths(host_dylib_search_paths).unwrap());
36343636

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

0 commit comments

Comments
 (0)