Do not use relative paths to Rust source root in run-make tests

This commit is contained in:
Jakub Beránek 2024-06-06 18:35:46 +02:00
parent 67caf52fbc
commit 6e1121b492
No known key found for this signature in database
GPG Key ID: 909CD0D26483516B
8 changed files with 16 additions and 15 deletions

View File

@ -83,11 +83,12 @@ pub fn python_command() -> Command {
pub fn htmldocck() -> Command { pub fn htmldocck() -> Command {
let mut python = python_command(); let mut python = python_command();
python.arg(source_path().join("src/etc/htmldocck.py")); python.arg(source_root().join("src/etc/htmldocck.py"));
python python
} }
pub fn source_path() -> PathBuf { /// Path to the root rust-lang/rust source checkout.
pub fn source_root() -> PathBuf {
env_var("S").into() env_var("S").into()
} }

View File

@ -2,14 +2,14 @@
// when the unstable no_global_oom_handling feature is turned on. // when the unstable no_global_oom_handling feature is turned on.
// See https://github.com/rust-lang/rust/pull/84266 // See https://github.com/rust-lang/rust/pull/84266
use run_make_support::rustc; use run_make_support::{rustc, source_root};
fn main() { fn main() {
rustc() rustc()
.edition("2021") .edition("2021")
.arg("-Dwarnings") .arg("-Dwarnings")
.crate_type("rlib") .crate_type("rlib")
.input("../../../library/alloc/src/lib.rs") .input(source_root().join("library/alloc/src/lib.rs"))
.cfg("no_global_oom_handling") .cfg("no_global_oom_handling")
.run(); .run();
} }

View File

@ -2,14 +2,14 @@
// when the unstable no_rc feature is turned on. // when the unstable no_rc feature is turned on.
// See https://github.com/rust-lang/rust/pull/84266 // See https://github.com/rust-lang/rust/pull/84266
use run_make_support::rustc; use run_make_support::{rustc, source_root};
fn main() { fn main() {
rustc() rustc()
.edition("2021") .edition("2021")
.arg("-Dwarnings") .arg("-Dwarnings")
.crate_type("rlib") .crate_type("rlib")
.input("../../../library/alloc/src/lib.rs") .input(source_root().join("library/alloc/src/lib.rs"))
.cfg("no_rc") .cfg("no_rc")
.run(); .run();
} }

View File

@ -2,14 +2,14 @@
// when the unstable no_sync feature is turned on. // when the unstable no_sync feature is turned on.
// See https://github.com/rust-lang/rust/pull/84266 // See https://github.com/rust-lang/rust/pull/84266
use run_make_support::rustc; use run_make_support::{rustc, source_root};
fn main() { fn main() {
rustc() rustc()
.edition("2021") .edition("2021")
.arg("-Dwarnings") .arg("-Dwarnings")
.crate_type("rlib") .crate_type("rlib")
.input("../../../library/alloc/src/lib.rs") .input(source_root().join("library/alloc/src/lib.rs"))
.cfg("no_sync") .cfg("no_sync")
.run(); .run();
} }

View File

@ -1,14 +1,14 @@
// This test checks that the core library of Rust can be compiled without enabling // This test checks that the core library of Rust can be compiled without enabling
// support for formatting and parsing floating-point numbers. // support for formatting and parsing floating-point numbers.
use run_make_support::rustc; use run_make_support::{rustc, source_root};
fn main() { fn main() {
rustc() rustc()
.edition("2021") .edition("2021")
.arg("-Dwarnings") .arg("-Dwarnings")
.crate_type("rlib") .crate_type("rlib")
.input("../../../library/core/src/lib.rs") .input(source_root().join("library/core/src/lib.rs"))
.cfg("no_fp_fmt_parse") .cfg("no_fp_fmt_parse")
.run(); .run();
} }

View File

@ -2,14 +2,14 @@
// when the no_global_oom_handling feature is turned on. // when the no_global_oom_handling feature is turned on.
// See https://github.com/rust-lang/rust/pull/110649 // See https://github.com/rust-lang/rust/pull/110649
use run_make_support::{rustc, tmp_dir}; use run_make_support::{rustc, source_root, tmp_dir};
fn main() { fn main() {
rustc() rustc()
.edition("2021") .edition("2021")
.arg("-Dwarnings") .arg("-Dwarnings")
.crate_type("rlib") .crate_type("rlib")
.input("../../../library/core/src/lib.rs") .input(source_root().join("library/core/src/lib.rs"))
.sysroot(tmp_dir().join("fakeroot")) .sysroot(tmp_dir().join("fakeroot"))
.cfg("no_global_oom_handling") .cfg("no_global_oom_handling")
.run(); .run();

View File

@ -1,4 +1,4 @@
use run_make_support::{htmldocck, rustc, rustdoc, source_path, tmp_dir}; use run_make_support::{htmldocck, rustc, rustdoc, source_root, tmp_dir};
use std::fs::read_dir; use std::fs::read_dir;
use std::path::Path; use std::path::Path;

View File

@ -1,13 +1,13 @@
// Test that rustdoc will properly load in a theme file and display it in the theme selector. // Test that rustdoc will properly load in a theme file and display it in the theme selector.
use run_make_support::{htmldocck, rustdoc, source_path, tmp_dir}; use run_make_support::{htmldocck, rustdoc, source_root, tmp_dir};
fn main() { fn main() {
let out_dir = tmp_dir().join("rustdoc-themes"); let out_dir = tmp_dir().join("rustdoc-themes");
let test_css = out_dir.join("test.css"); let test_css = out_dir.join("test.css");
let no_script = let no_script =
std::fs::read_to_string(source_path().join("src/librustdoc/html/static/css/noscript.css")) std::fs::read_to_string(source_root().join("src/librustdoc/html/static/css/noscript.css"))
.unwrap(); .unwrap();
let mut test_content = String::new(); let mut test_content = String::new();