Skip to content

Commit b0168d9

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

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
@@ -3608,24 +3608,26 @@ impl<'test> TestCx<'test> {
36083608
// FIXME(jieyouxu): audit these env vars. some of them only makes sense for make, not rustc!
36093609
let mut rustc = Command::new(&self.config.rustc_path);
36103610
rustc
3611+
// Specify output path
36113612
.arg("-o")
36123613
.arg(&recipe_bin)
3614+
// Specify library search paths for `run_make_support`.
36133615
.arg(format!("-Ldependency={}", &support_lib_path.parent().unwrap().to_string_lossy()))
36143616
.arg(format!("-Ldependency={}", &support_lib_deps.to_string_lossy()))
36153617
.arg(format!("-Ldependency={}", &support_lib_deps_deps.to_string_lossy()))
3618+
// Provide `run_make_support` as extern prelude, so test writers don't need to write
3619+
// `extern run_make_support;`.
36163620
.arg("--extern")
36173621
.arg(format!("run_make_support={}", &support_lib_path.to_string_lossy()))
3622+
// Default to Edition 2021.
36183623
.arg("--edition=2021")
3624+
// Specify compilation target.
3625+
.arg("--target")
3626+
.arg(&self.config.target)
3627+
// The recipe file itself.
36193628
.arg(&self.testpaths.file.join("rmake.rs"))
3620-
.env("TARGET", &self.config.target)
3621-
.env("PYTHON", &self.config.python)
3622-
.env("RUST_BUILD_STAGE", &self.config.stage_id)
3623-
.env("RUSTC", &self.config.rustc_path)
3624-
.env("LD_LIB_PATH_ENVVAR", dylib_env_var())
3625-
.env(dylib_env_var(), &env::join_paths(host_dylib_search_paths).unwrap())
3626-
.env("HOST_RPATH_DIR", &self.config.compile_lib_path)
3627-
.env("TARGET_RPATH_DIR", &self.config.run_lib_path)
3628-
.env("LLVM_COMPONENTS", &self.config.llvm_components);
3629+
// Provide necessary library search paths for rustc.
3630+
.env(dylib_env_var(), &env::join_paths(host_dylib_search_paths).unwrap());
36293631

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

0 commit comments

Comments
 (0)