From 7eff2d9b2268eff7289ed969fa158c83e1077026 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Ber=C3=A1nek?= Date: Fri, 7 Jun 2024 09:20:25 +0200 Subject: [PATCH 1/2] Do not pass source root when building run-make tests --- src/tools/compiletest/src/runtest.rs | 1 - tests/run-make/CURRENT_RUSTC_VERSION/rmake.rs | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index 2c425a07b2acd..db08d9b54ba2c 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -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) diff --git a/tests/run-make/CURRENT_RUSTC_VERSION/rmake.rs b/tests/run-make/CURRENT_RUSTC_VERSION/rmake.rs index 1bdb634757120..827a1b7ce67d5 100644 --- a/tests/run-make/CURRENT_RUSTC_VERSION/rmake.rs +++ b/tests/run-make/CURRENT_RUSTC_VERSION/rmake.rs @@ -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(); @@ -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)); } From eac63b77257d69d2a89a50f165ac58971689a31d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Ber=C3=A1nek?= Date: Fri, 7 Jun 2024 09:20:58 +0200 Subject: [PATCH 2/2] Rename `S` environment variable to `SOURCE_ROOT` in run-make tests --- src/tools/compiletest/src/runtest.rs | 2 +- src/tools/run-make-support/src/lib.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index db08d9b54ba2c..41972b6994c60 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -3566,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) diff --git a/src/tools/run-make-support/src/lib.rs b/src/tools/run-make-support/src/lib.rs index d74a0272a627e..0f9d5a3b6c365 100644 --- a/src/tools/run-make-support/src/lib.rs +++ b/src/tools/run-make-support/src/lib.rs @@ -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.