Skip to content

Commit

Permalink
Rollup merge of rust-lang#126112 - Kobzol:runmake-source-root, r=jiey…
Browse files Browse the repository at this point in the history
…ouxu

Clean up source root in run-make tests

The name `S` isn't exactly the most descriptive, and we also shouldn't need to pass it when building (actually I think that most of the env. vars that we pass to `cargo` here are probably not really needed).

Related issue: rust-lang#126071

r? ```@jieyouxu```
  • Loading branch information
matthiaskrgr authored Jun 7, 2024
2 parents ccbd6c2 + eac63b7 commit b8e28d1
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
3 changes: 1 addition & 2 deletions src/tools/compiletest/src/runtest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3515,7 +3515,6 @@ impl<'test> TestCx<'test> {
.arg(&self.testpaths.file.join("rmake.rs"))
.env("TARGET", &self.config.target)
.env("PYTHON", &self.config.python)
.env("S", &src_root)
.env("RUST_BUILD_STAGE", &self.config.stage_id)
.env("RUSTC", cwd.join(&self.config.rustc_path))
.env("TMPDIR", &rmake_out_dir)
Expand Down Expand Up @@ -3567,7 +3566,7 @@ impl<'test> TestCx<'test> {
.env(dylib_env_var(), &dylib_env_paths)
.env("TARGET", &self.config.target)
.env("PYTHON", &self.config.python)
.env("S", &src_root)
.env("SOURCE_ROOT", &src_root)
.env("RUST_BUILD_STAGE", &self.config.stage_id)
.env("RUSTC", cwd.join(&self.config.rustc_path))
.env("TMPDIR", &rmake_out_dir)
Expand Down
2 changes: 1 addition & 1 deletion src/tools/run-make-support/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ pub fn htmldocck() -> Command {

/// Path to the root rust-lang/rust source checkout.
pub fn source_root() -> PathBuf {
env_var("S").into()
env_var("SOURCE_ROOT").into()
}

/// Construct the static library name based on the platform.
Expand Down
4 changes: 2 additions & 2 deletions tests/run-make/CURRENT_RUSTC_VERSION/rmake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

use std::path::PathBuf;

use run_make_support::{aux_build, rustc};
use run_make_support::{aux_build, rustc, source_root};

fn main() {
aux_build().input("stable.rs").emit("metadata").run();
Expand All @@ -17,7 +17,7 @@ fn main() {
rustc().input("main.rs").emit("metadata").extern_("stable", &stable_path).command_output();

let stderr = String::from_utf8_lossy(&output.stderr);
let version = include_str!(concat!(env!("S"), "/src/version"));
let version = std::fs::read_to_string(source_root().join("src/version")).unwrap();
let expected_string = format!("stable since {}", version.trim());
assert!(stderr.contains(&expected_string));
}

0 comments on commit b8e28d1

Please sign in to comment.