From ab3a01388fa9f3c61eb18c5b778146e3f2eff8ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=AE=B8=E6=9D=B0=E5=8F=8B=20Jieyou=20Xu=20=28Joe=29?= <39484203+jieyouxu@users.noreply.github.com> Date: Sun, 2 Feb 2025 20:59:04 +0800 Subject: [PATCH] a bunch of changes --- src/bootstrap/src/core/build_steps/test.rs | 40 +++++--- src/tools/compiletest/src/common.rs | 27 ++++-- src/tools/compiletest/src/header.rs | 42 ++++---- src/tools/compiletest/src/header/tests.rs | 2 + src/tools/compiletest/src/lib.rs | 96 ++++++++++++------- src/tools/compiletest/src/runtest.rs | 33 +++---- .../compiletest/src/runtest/debuginfo.rs | 38 +++----- src/tools/compiletest/src/runtest/js_doc.rs | 11 ++- src/tools/compiletest/src/runtest/run_make.rs | 57 +++-------- src/tools/compiletest/src/runtest/rustdoc.rs | 5 +- .../compiletest/src/runtest/rustdoc_json.rs | 3 +- src/tools/compiletest/src/runtest/ui.rs | 2 +- tests/codegen/debug-compile-unit-path.rs | 2 +- .../auxiliary/remap_path_prefix_aux.rs | 2 +- .../auxiliary/xcrate-generic.rs | 2 +- tests/codegen/remap_path_prefix/main.rs | 2 +- .../auxiliary/circular-dependencies-aux.rs | 2 +- tests/incremental/circular-dependencies.rs | 2 +- .../auxiliary/extern_crate.rs | 2 +- tests/pretty/expanded-and-path-remap-80832.pp | 2 +- tests/pretty/expanded-and-path-remap-80832.rs | 2 +- tests/pretty/tests-are-sorted.pp | 2 +- tests/pretty/tests-are-sorted.rs | 2 +- .../commandline-argfile-badutf8-windows.rs | 2 +- .../argfile/commandline-argfile-badutf8.rs | 2 +- .../commandline-argfile-missing-windows.rs | 2 +- .../argfile/commandline-argfile-missing.rs | 2 +- .../commandline-argfile-multiple-windows.rs | 2 +- .../argfile/commandline-argfile-multiple.rs | 2 +- .../rustdoc-ui/argfile/commandline-argfile.rs | 2 +- tests/rustdoc-ui/doctest/run-directory.rs | 4 +- tests/rustdoc-ui/invalid-theme-name.rs | 2 +- ...remap-path-prefix-failed-doctest-output.rs | 2 +- .../remap-path-prefix-invalid-doctest.rs | 2 +- tests/rustdoc-ui/remap-path-prefix-lint.rs | 2 +- ...remap-path-prefix-passed-doctest-output.rs | 2 +- .../scrape-examples-fail-if-type-error.rs | 2 +- .../scrape-examples/scrape-examples-ice.rs | 2 +- tests/rustdoc/auxiliary/external-macro-src.rs | 2 +- tests/ui-fulldeps/obtain-borrowck.rs | 2 +- .../commandline-argfile-badutf8-windows.rs | 2 +- .../ui/argfile/commandline-argfile-badutf8.rs | 2 +- .../commandline-argfile-missing-windows.rs | 2 +- .../ui/argfile/commandline-argfile-missing.rs | 2 +- .../commandline-argfile-multiple-windows.rs | 2 +- .../argfile/commandline-argfile-multiple.rs | 2 +- tests/ui/argfile/commandline-argfile.rs | 2 +- tests/ui/check-cfg/values-target-json.rs | 2 +- tests/ui/codegen/mismatched-data-layouts.rs | 2 +- tests/ui/crate-loading/invalid-rlib.rs | 2 +- tests/ui/errors/auxiliary/remapped_dep.rs | 2 +- .../ui/errors/issue-104621-extern-bad-file.rs | 2 +- tests/ui/errors/remap-path-prefix-macro.rs | 2 +- tests/ui/errors/remap-path-prefix-reverse.rs | 4 +- tests/ui/errors/remap-path-prefix-sysroot.rs | 4 +- tests/ui/errors/remap-path-prefix.rs | 2 +- tests/ui/meta/revision-bad.rs | 2 +- tests/ui/sanitizer/dataflow.rs | 2 +- .../shell-argfiles-badquotes-windows.rs | 2 +- .../shell-argfiles-badquotes.rs | 2 +- .../shell-argfiles-via-argfile.rs | 2 +- tests/ui/shell-argfiles/shell-argfiles.rs | 2 +- 62 files changed, 232 insertions(+), 230 deletions(-) diff --git a/src/bootstrap/src/core/build_steps/test.rs b/src/bootstrap/src/core/build_steps/test.rs index 825e5452f0e6a..c2388b20c7878 100644 --- a/src/bootstrap/src/core/build_steps/test.rs +++ b/src/bootstrap/src/core/build_steps/test.rs @@ -1646,18 +1646,22 @@ NOTE: if you're sure you want to do this, please open an issue as to why. In the // part test the *API* of the compiler, not how it compiles a given file. As a result, we // can run them against the stage 1 sources as long as we build them with the stage 0 // bootstrap compiler. - // NOTE: Only stage 1 is special cased because we need the rustc_private artifacts to match the - // running compiler in stage 2 when plugins run. - let stage_id = if suite == "ui-fulldeps" && compiler.stage == 1 { - // At stage 0 (stage - 1) we are using the beta compiler. Using `self.target` can lead finding - // an incorrect compiler path on cross-targets, as the stage 0 beta compiler is always equal - // to `build.build` in the configuration. + // + // NOTE: Only stage 1 is special cased because we need the `rustc_private` artifacts to + // match the running compiler in stage 2 when plugins run. + let (stage_id, test_stage) = if suite == "ui-fulldeps" && compiler.stage == 1 { + // At stage 0 (stage - 1) we are using the beta compiler. Using `self.target` can lead + // finding an incorrect compiler path on cross-targets, as the stage 0 beta compiler is + // always equal to `build.build` in the configuration. let build = builder.build.build; compiler = builder.compiler(compiler.stage - 1, build); - format!("stage{}-{}", compiler.stage + 1, build) + + let test_stage = compiler.stage + 1; + + (format!("stage{}-{}", test_stage, build), test_stage) } else { - format!("stage{}-{}", compiler.stage, target) + (format!("stage{}-{}", compiler.stage, target), compiler.stage) }; if suite.ends_with("fulldeps") { @@ -1757,22 +1761,30 @@ NOTE: if you're sure you want to do this, please open an issue as to why. In the cmd.arg("--coverage-dump-path").arg(coverage_dump); } - cmd.arg("--src-base").arg(builder.src.join("tests").join(suite)); - cmd.arg("--build-base").arg(testdir(builder, compiler.host).join(suite)); + cmd.arg("--src-root").arg(&builder.src); + cmd.arg("--src-test-suite-root").arg(builder.src.join("tests").join(suite)); + // Note: this is the *root* build directory, does not include target triple! + cmd.arg("--build-root").arg(&builder.out); + cmd.arg("--build-test-suite-root").arg(testdir(builder, compiler.host).join(suite)); // When top stage is 0, that means that we're testing an externally provided compiler. // In that case we need to use its specific sysroot for tests to pass. let sysroot = if builder.top_stage == 0 { builder.initial_sysroot.clone() } else { - builder.sysroot(compiler).to_path_buf() + builder.sysroot(compiler) }; - cmd.arg("--sysroot-base").arg(sysroot); + cmd.arg("--sysroot").arg(sysroot); + cmd.arg("--stage-id").arg(stage_id); + cmd.arg("--stage").arg(test_stage.to_string()); + + cmd.arg("--host").arg(&*compiler.host.triple); + cmd.arg("--target").arg(target.rustc_target_arg()); + cmd.arg("--suite").arg(suite); cmd.arg("--mode").arg(mode); - cmd.arg("--target").arg(target.rustc_target_arg()); - cmd.arg("--host").arg(&*compiler.host.triple); + cmd.arg("--llvm-filecheck").arg(builder.llvm_filecheck(builder.config.build)); if builder.build.config.llvm_enzyme { diff --git a/src/tools/compiletest/src/common.rs b/src/tools/compiletest/src/common.rs index 00821fc9f9db2..25c440b3023a9 100644 --- a/src/tools/compiletest/src/common.rs +++ b/src/tools/compiletest/src/common.rs @@ -215,15 +215,22 @@ pub struct Config { /// `None` then these tests will be ignored. pub run_clang_based_tests_with: Option, - /// The directory containing the tests to run - pub src_base: PathBuf, - - /// The directory where programs should be built - pub build_base: PathBuf, - - /// The directory containing the compiler sysroot - pub sysroot_base: PathBuf, - + /// Path to directory containing rust-lang/rust sources. + pub src_root: PathBuf, + /// Path to the directory containg the test suite sources. Expected to be a subdirectory of + /// `src_root`. + pub src_test_suite_root: PathBuf, + + /// Bootstrap build directory. + pub build_root: PathBuf, + /// Bootstrap test suite build directory. Expected to be a subdirectory of `build_root`. + pub build_test_suite_root: PathBuf, + + /// The directory containing the compiler sysroot. + pub sysroot: PathBuf, + + /// Stage number. + pub stage: u32, /// The name of the stage being built (stage1, etc) pub stage_id: String, @@ -802,7 +809,7 @@ pub const UI_COVERAGE_MAP: &str = "cov-map"; /// /path/to/build/host-tuple/test/ui/relative/ /// This is created early when tests are collected to avoid race conditions. pub fn output_relative_path(config: &Config, relative_dir: &Path) -> PathBuf { - config.build_base.join(relative_dir) + config.build_test_suite_root.join(relative_dir) } /// Generates a unique name for the test, such as `testname.revision.mode`. diff --git a/src/tools/compiletest/src/header.rs b/src/tools/compiletest/src/header.rs index 8c96554738e68..5ff4bf60ccc03 100644 --- a/src/tools/compiletest/src/header.rs +++ b/src/tools/compiletest/src/header.rs @@ -1034,19 +1034,6 @@ impl Config { } } - pub fn find_rust_src_root(&self) -> Option { - let mut path = self.src_base.clone(); - let path_postfix = Path::new("src/etc/lldb_batchmode.py"); - - while path.pop() { - if path.join(&path_postfix).is_file() { - return Some(path); - } - } - - None - } - fn parse_edition(&self, line: &str) -> Option { self.parse_name_value_directive(line, "edition") } @@ -1093,9 +1080,9 @@ impl Config { fn expand_variables(mut value: String, config: &Config) -> String { const CWD: &str = "{{cwd}}"; - const SRC_BASE: &str = "{{src-base}}"; - const BUILD_BASE: &str = "{{build-base}}"; - const RUST_SRC_BASE: &str = "{{rust-src-base}}"; + const TEST_SUITE_SRC_BASE: &str = "{{test-suite-src-base}}"; + const TEST_SUITE_BUILD_BASE: &str = "{{test-suite-build-base}}"; + const SYSROOT_RUST_SRC_BASE: &str = "{{sysroot-rust-src-base}}"; const SYSROOT_BASE: &str = "{{sysroot-base}}"; const TARGET_LINKER: &str = "{{target-linker}}"; const TARGET: &str = "{{target}}"; @@ -1105,16 +1092,17 @@ fn expand_variables(mut value: String, config: &Config) -> String { value = value.replace(CWD, &cwd.to_string_lossy()); } - if value.contains(SRC_BASE) { - value = value.replace(SRC_BASE, &config.src_base.to_string_lossy()); + if value.contains(TEST_SUITE_SRC_BASE) { + value = value.replace(TEST_SUITE_SRC_BASE, &config.src_test_suite_root.to_string_lossy()); } - if value.contains(BUILD_BASE) { - value = value.replace(BUILD_BASE, &config.build_base.to_string_lossy()); + if value.contains(TEST_SUITE_BUILD_BASE) { + value = + value.replace(TEST_SUITE_BUILD_BASE, &config.build_test_suite_root.to_string_lossy()); } if value.contains(SYSROOT_BASE) { - value = value.replace(SYSROOT_BASE, &config.sysroot_base.to_string_lossy()); + value = value.replace(SYSROOT_BASE, &config.sysroot.to_string_lossy()); } if value.contains(TARGET_LINKER) { @@ -1125,11 +1113,13 @@ fn expand_variables(mut value: String, config: &Config) -> String { value = value.replace(TARGET, &config.target); } - if value.contains(RUST_SRC_BASE) { - let src_base = config.sysroot_base.join("lib/rustlib/src/rust"); - src_base.try_exists().expect(&*format!("{} should exists", src_base.display())); - let src_base = src_base.read_link().unwrap_or(src_base); - value = value.replace(RUST_SRC_BASE, &src_base.to_string_lossy()); + if value.contains(SYSROOT_RUST_SRC_BASE) { + let sysroot_rust_src_base = config.sysroot.join("lib/rustlib/src/rust"); + sysroot_rust_src_base + .try_exists() + .expect(&*format!("{} should exists", sysroot_rust_src_base.display())); + let src_base = sysroot_rust_src_base.read_link().unwrap_or(sysroot_rust_src_base); + value = value.replace(SYSROOT_RUST_SRC_BASE, &src_base.to_string_lossy()); } value diff --git a/src/tools/compiletest/src/header/tests.rs b/src/tools/compiletest/src/header/tests.rs index ebba16d41f9e8..a8204a05e0ce2 100644 --- a/src/tools/compiletest/src/header/tests.rs +++ b/src/tools/compiletest/src/header/tests.rs @@ -158,6 +158,8 @@ impl ConfigBuilder { "--android-cross-path=", "--stage-id", self.stage_id.as_deref().unwrap_or("stage2-x86_64-unknown-linux-gnu"), + "--stage", + "2", "--channel", self.channel.as_deref().unwrap_or("nightly"), "--host", diff --git a/src/tools/compiletest/src/lib.rs b/src/tools/compiletest/src/lib.rs index 27a046ba5bc4a..6bcdc6f82bd76 100644 --- a/src/tools/compiletest/src/lib.rs +++ b/src/tools/compiletest/src/lib.rs @@ -61,9 +61,17 @@ pub fn parse_config(args: Vec) -> Config { .optopt("", "jsondoclint-path", "path to jsondoclint to use for doc tests", "PATH") .optopt("", "run-clang-based-tests-with", "path to Clang executable", "PATH") .optopt("", "llvm-filecheck", "path to LLVM's FileCheck binary", "DIR") - .reqopt("", "src-base", "directory to scan for test files", "PATH") - .reqopt("", "build-base", "directory to deposit test outputs", "PATH") - .reqopt("", "sysroot-base", "directory containing the compiler sysroot", "PATH") + .reqopt("", "src-root", "root directory of rust-lang/rust source files", "PATH") + .reqopt( + "", + "src-test-suite-root", + "root directory of the test suite (e.g. `tests/ui/`)", + "PATH", + ) + .reqopt("", "build-root", "build directory", "PATH") + .reqopt("", "build-test-suite-root", "directory to deposit test outputs", "PATH") + .reqopt("", "sysroot", "directory containing the compiler sysroot", "PATH") + .reqopt("", "stage", "test stage", "N") .reqopt("", "stage-id", "the target-stage identifier", "stageN-TARGET") .reqopt( "", @@ -242,7 +250,12 @@ pub fn parse_config(args: Vec) -> Config { || header::extract_llvm_version_from_binary(&matches.opt_str("llvm-filecheck")?), ); - let src_base = opt_path(matches, "src-base"); + let stage = if let Some(ref stage) = matches.opt_str("stage") { + stage.parse::().expect("expected `--stage` to be a non-negative integer") + } else { + panic!("expected `--stage` number") + }; + let run_ignored = matches.opt_present("ignored"); let with_rustc_debug_assertions = matches.opt_present("with-rustc-debug-assertions"); let with_std_debug_assertions = matches.opt_present("with-std-debug-assertions"); @@ -308,10 +321,18 @@ pub fn parse_config(args: Vec) -> Config { run_clang_based_tests_with: matches.opt_str("run-clang-based-tests-with"), llvm_filecheck: matches.opt_str("llvm-filecheck").map(PathBuf::from), llvm_bin_dir: matches.opt_str("llvm-bin-dir").map(PathBuf::from), - src_base, - build_base: opt_path(matches, "build-base"), - sysroot_base: opt_path(matches, "sysroot-base"), + + src_root: opt_path(matches, "src-root"), + src_test_suite_root: opt_path(matches, "src-test-suite-root"), + + build_root: opt_path(matches, "build-root"), + build_test_suite_root: opt_path(matches, "build-test-suite-root"), + + sysroot: opt_path(matches, "sysroot"), + + stage, stage_id: matches.opt_str("stage-id").unwrap(), + mode, suite: matches.opt_str("suite").unwrap(), debugger: matches.opt_str("debugger").map(|debugger| { @@ -413,9 +434,16 @@ pub fn log_config(config: &Config) { logv(c, format!("rustc_path: {:?}", config.rustc_path.display())); logv(c, format!("cargo_path: {:?}", config.cargo_path)); logv(c, format!("rustdoc_path: {:?}", config.rustdoc_path)); - logv(c, format!("src_base: {:?}", config.src_base.display())); - logv(c, format!("build_base: {:?}", config.build_base.display())); + + logv(c, format!("src_root: {:?}", config.src_root.display())); + logv(c, format!("src_test_suite_root: {:?}", config.src_test_suite_root.display())); + + logv(c, format!("build_root: {:?}", config.build_root.display())); + logv(c, format!("build_test_suite_root: {:?}", config.build_test_suite_root.display())); + + logv(c, format!("stage: {}", config.stage)); logv(c, format!("stage_id: {}", config.stage_id)); + logv(c, format!("mode: {}", config.mode)); logv(c, format!("run_ignored: {}", config.run_ignored)); logv(c, format!("filters: {:?}", config.filters)); @@ -463,7 +491,7 @@ pub fn run_tests(config: Arc) { // we first make sure that the coverage file does not exist. // It will be created later on. if config.rustfix_coverage { - let mut coverage_file_path = config.build_base.clone(); + let mut coverage_file_path = config.build_test_suite_root.clone(); coverage_file_path.push("rustfix_missing_coverage.txt"); if coverage_file_path.exists() { if let Err(e) = fs::remove_file(&coverage_file_path) { @@ -610,20 +638,29 @@ struct TestCollector { /// regardless of whether any filters/tests were specified on the command-line, /// because filtering is handled later by libtest. pub fn collect_and_make_tests(config: Arc) -> Vec { - debug!("making tests from {:?}", config.src_base.display()); + debug!("making tests from {:?}", config.src_root.display()); let common_inputs_stamp = common_inputs_stamp(&config); - let modified_tests = modified_tests(&config, &config.src_base).unwrap_or_else(|err| { - panic!("modified_tests got error from dir: {}, error: {}", config.src_base.display(), err) - }); + let modified_tests = + modified_tests(&config, &config.src_test_suite_root).unwrap_or_else(|err| { + panic!( + "modified_tests got error from dir: {}, error: {}", + config.src_root.display(), + err + ) + }); let cache = HeadersCache::load(&config); let cx = TestCollectorCx { config, cache, common_inputs_stamp, modified_tests }; let mut collector = TestCollector { tests: vec![], found_path_stems: HashSet::new(), poisoned: false }; - collect_tests_from_dir(&cx, &mut collector, &cx.config.src_base, Path::new("")).unwrap_or_else( - |reason| panic!("Could not read tests from {}: {reason}", cx.config.src_base.display()), - ); + collect_tests_from_dir(&cx, &mut collector, &cx.config.src_test_suite_root, Path::new("")) + .unwrap_or_else(|reason| { + panic!( + "Could not read tests from {}: {reason}", + cx.config.src_test_suite_root.display() + ) + }); let TestCollector { tests, found_path_stems, poisoned } = collector; @@ -645,8 +682,7 @@ pub fn collect_and_make_tests(config: Arc) -> Vec { /// common to some subset of tests, and are hopefully unlikely to be modified /// while working on other tests.) fn common_inputs_stamp(config: &Config) -> Stamp { - let rust_src_dir = config.find_rust_src_root().expect("Could not find Rust source root"); - + let src_root = &config.src_root; let mut stamp = Stamp::from_path(&config.rustc_path); // Relevant pretty printer files @@ -660,17 +696,17 @@ fn common_inputs_stamp(config: &Config) -> Stamp { "src/etc/lldb_providers.py", ]; for file in &pretty_printer_files { - let path = rust_src_dir.join(file); + let path = src_root.join(file); stamp.add_path(&path); } - stamp.add_dir(&rust_src_dir.join("src/etc/natvis")); + stamp.add_dir(&src_root.join("src").join("etc").join("natvis")); stamp.add_dir(&config.run_lib_path); if let Some(ref rustdoc_path) = config.rustdoc_path { stamp.add_path(&rustdoc_path); - stamp.add_path(&rust_src_dir.join("src/etc/htmldocck.py")); + stamp.add_path(&src_root.join("src/etc/htmldocck.py")); } // Re-run coverage tests if the `coverage-dump` tool was modified, @@ -679,10 +715,10 @@ fn common_inputs_stamp(config: &Config) -> Stamp { stamp.add_path(coverage_dump_path) } - stamp.add_dir(&rust_src_dir.join("src/tools/run-make-support")); + stamp.add_dir(&src_root.join("src/tools/run-make-support")); // Compiletest itself. - stamp.add_dir(&rust_src_dir.join("src/tools/compiletest/")); + stamp.add_dir(&src_root.join("src/tools/compiletest/")); stamp } @@ -923,10 +959,7 @@ fn files_related_to_test( } // `minicore.rs` test auxiliary: we need to make sure tests get rerun if this changes. - // - // FIXME(jieyouxu): untangle these paths, we should provide both a path to root `tests/` or - // `tests/auxiliary/` and the test suite in question. `src_base` is also a terrible name. - related.push(config.src_base.parent().unwrap().join("auxiliary").join("minicore.rs")); + related.push(config.src_root.join("tests").join("auxiliary").join("minicore.rs")); related } @@ -1016,10 +1049,9 @@ fn make_test_name( testpaths: &TestPaths, revision: Option<&str>, ) -> test::TestName { - // Print the name of the file, relative to the repository root. - // `src_base` looks like `/path/to/rust/tests/ui` - let root_directory = config.src_base.parent().unwrap().parent().unwrap(); - let path = testpaths.file.strip_prefix(root_directory).unwrap(); + // Print the name of the file, relative to the repository root. `src_base` looks like + // `/path/to/rust/tests/ui`. + let path = testpaths.file.strip_prefix(&config.src_test_suite_root).unwrap(); let debugger = match config.debugger { Some(d) => format!("-{}", d), None => String::new(), diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index ca48abda5fc16..bfbaa320a8cdd 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -535,7 +535,7 @@ impl<'test> TestCx<'test> { .arg(&out_dir) .arg(&format!("--target={}", target)) .arg("-L") - .arg(&self.config.build_base) + .arg(&self.config.build_test_suite_root) .arg("-L") .arg(aux_dir) .arg("-A") @@ -1365,8 +1365,8 @@ impl<'test> TestCx<'test> { // // Note: avoid adding a subdirectory of an already filtered directory here, otherwise the // same slice of text will be double counted and the truncation might not happen. - add_path(&self.config.src_base); - add_path(&self.config.build_base); + add_path(&self.config.src_test_suite_root); + add_path(&self.config.build_test_suite_root); read2_abbreviated(child, &filter_paths_from_len).expect("failed to read output") } @@ -1417,13 +1417,11 @@ impl<'test> TestCx<'test> { } fn is_rustdoc(&self) -> bool { - self.config.src_base.ends_with("rustdoc-ui") - || self.config.src_base.ends_with("rustdoc-js") - || self.config.src_base.ends_with("rustdoc-json") + matches!(self.config.suite.as_str(), "rustdoc-ui" | "rustdoc-js" | "rustdoc-json") } fn get_mir_dump_dir(&self) -> PathBuf { - let mut mir_dump_dir = PathBuf::from(self.config.build_base.as_path()); + let mut mir_dump_dir = self.config.build_test_suite_root.clone(); debug!("input_file: {:?}", self.testpaths.file); mir_dump_dir.push(&self.testpaths.relative_dir); mir_dump_dir.push(self.testpaths.file.file_stem().unwrap()); @@ -1473,7 +1471,7 @@ impl<'test> TestCx<'test> { // Similarly, vendored sources shouldn't be shown when running from a dist tarball. rustc.arg("-Z").arg(format!( "ignore-directory-in-diagnostics-source-blocks={}", - self.config.find_rust_src_root().unwrap().join("vendor").display(), + self.config.src_root.join("vendor").to_str().unwrap(), )); // Optionally prevent default --sysroot if specified in test compile-flags. @@ -1481,7 +1479,7 @@ impl<'test> TestCx<'test> { && !self.config.host_rustcflags.iter().any(|flag| flag == "--sysroot") { // In stage 0, make sure we use `stage0-sysroot` instead of the bootstrap sysroot. - rustc.arg("--sysroot").arg(&self.config.sysroot_base); + rustc.arg("--sysroot").arg(&self.config.sysroot); } // Optionally prevent default --target if specified in test compile-flags. @@ -1497,7 +1495,7 @@ impl<'test> TestCx<'test> { if !is_rustdoc { if let Some(ref incremental_dir) = self.props.incremental_dir { - rustc.args(&["-C", &format!("incremental={}", incremental_dir.display())]); + rustc.args(&["-C", &format!("incremental={}", incremental_dir.to_str().unwrap())]); rustc.args(&["-Z", "incremental-verify-ich"]); } @@ -1634,7 +1632,7 @@ impl<'test> TestCx<'test> { if self.props.remap_src_base { rustc.arg(format!( "--remap-path-prefix={}={}", - self.config.src_base.display(), + self.config.src_test_suite_root.to_str().unwrap(), FAKE_SRC_BASE, )); } @@ -2407,19 +2405,18 @@ impl<'test> TestCx<'test> { normalize_path(&base_dir.join("compiler"), "$COMPILER_DIR"); // Real paths into the libstd/libcore - let rust_src_dir = &self.config.sysroot_base.join("lib/rustlib/src/rust"); + let rust_src_dir = &self.config.sysroot.join("lib/rustlib/src/rust"); rust_src_dir.try_exists().expect(&*format!("{} should exists", rust_src_dir.display())); let rust_src_dir = rust_src_dir.read_link().unwrap_or(rust_src_dir.to_path_buf()); normalize_path(&rust_src_dir.join("library"), "$SRC_DIR_REAL"); - // Paths into the build directory - let test_build_dir = &self.config.build_base; - let parent_build_dir = test_build_dir.parent().unwrap().parent().unwrap().parent().unwrap(); - // eg. /home/user/rust/build/x86_64-unknown-linux-gnu/test/ui - normalize_path(test_build_dir, "$TEST_BUILD_DIR"); + normalize_path(&self.config.build_test_suite_root, "$TEST_BUILD_DIR"); + eprintln!("build_test_suite_root = {:?}", self.config.build_test_suite_root.display()); + // eg. /home/user/rust/build - normalize_path(parent_build_dir, "$BUILD_DIR"); + normalize_path(&self.config.build_root, "$BUILD_DIR"); + eprintln!("build_root = {:?}", self.config.build_root.display()); if json { // escaped newlines in json strings should be readable diff --git a/src/tools/compiletest/src/runtest/debuginfo.rs b/src/tools/compiletest/src/runtest/debuginfo.rs index b236b06756903..8bc511a82a832 100644 --- a/src/tools/compiletest/src/runtest/debuginfo.rs +++ b/src/tools/compiletest/src/runtest/debuginfo.rs @@ -257,11 +257,8 @@ impl TestCx<'_> { println!("Adb process is already finished."); } } else { - let rust_src_root = - self.config.find_rust_src_root().expect("Could not find Rust source root"); - let rust_pp_module_rel_path = Path::new("./src/etc"); - let rust_pp_module_abs_path = - rust_src_root.join(rust_pp_module_rel_path).to_str().unwrap().to_owned(); + let rust_pp_module_abs_path = self.config.src_root.join("src").join("etc"); + let rust_pp_module_abs_path = rust_pp_module_abs_path.to_str().unwrap(); // write debugger script let mut script_str = String::with_capacity(2048); script_str.push_str(&format!("set charset {}\n", Self::charset())); @@ -279,14 +276,12 @@ impl TestCx<'_> { rust_pp_module_abs_path.replace(r"\", r"\\") )); - let output_base_dir = self.output_base_dir().to_str().unwrap().to_owned(); - // Add the directory containing the output binary to // include embedded pretty printers to GDB's script // auto loading safe path script_str.push_str(&format!( "add-auto-load-safe-path {}\n", - output_base_dir.replace(r"\", r"\\") + self.output_base_dir().to_str().unwrap().replace(r"\", r"\\") )); } } @@ -336,9 +331,9 @@ impl TestCx<'_> { let mut gdb = Command::new(self.config.gdb.as_ref().unwrap()); let pythonpath = if let Ok(pp) = std::env::var("PYTHONPATH") { - format!("{pp}:{rust_pp_module_abs_path}") + format!("{pp}:{}", rust_pp_module_abs_path) } else { - rust_pp_module_abs_path + rust_pp_module_abs_path.to_string() }; gdb.args(debugger_opts).env("PYTHONPATH", pythonpath); @@ -407,15 +402,12 @@ impl TestCx<'_> { // Make LLDB emit its version, so we have it documented in the test output script_str.push_str("version\n"); - // Switch LLDB into "Rust mode" - let rust_src_root = - self.config.find_rust_src_root().expect("Could not find Rust source root"); - let rust_pp_module_rel_path = Path::new("./src/etc"); - let rust_pp_module_abs_path = rust_src_root.join(rust_pp_module_rel_path); + // Switch LLDB into "Rust mode". + let rust_pp_module_abs_path = self.config.src_root.join("src").join("etc"); script_str.push_str(&format!( "command script import {}/lldb_lookup.py\n", - rust_pp_module_abs_path.to_str().unwrap() + rust_pp_module_abs_path.display() )); File::open(rust_pp_module_abs_path.join("lldb_commands")) .and_then(|mut file| file.read_to_string(&mut script_str)) @@ -445,7 +437,7 @@ impl TestCx<'_> { let debugger_script = self.make_out_name("debugger.script"); // Let LLDB execute the script via lldb_batchmode.py - let debugger_run_result = self.run_lldb(&exe_file, &debugger_script, &rust_src_root); + let debugger_run_result = self.run_lldb(&exe_file, &debugger_script); if !debugger_run_result.status.success() { self.fatal_proc_rec("Error while running LLDB", &debugger_run_result); @@ -456,18 +448,14 @@ impl TestCx<'_> { } } - fn run_lldb( - &self, - test_executable: &Path, - debugger_script: &Path, - rust_src_root: &Path, - ) -> ProcRes { + fn run_lldb(&self, test_executable: &Path, debugger_script: &Path) -> ProcRes { // Prepare the lldb_batchmode which executes the debugger script - let lldb_script_path = rust_src_root.join("src/etc/lldb_batchmode.py"); + let lldb_script_path = + self.config.src_root.join("src").join("etc").join("lldb_batchmode.py"); let pythonpath = if let Ok(pp) = std::env::var("PYTHONPATH") { format!("{pp}:{}", self.config.lldb_python_dir.as_ref().unwrap()) } else { - self.config.lldb_python_dir.as_ref().unwrap().to_string() + self.config.lldb_python_dir.clone().unwrap() }; self.run_command_to_procres( Command::new(&self.config.python) diff --git a/src/tools/compiletest/src/runtest/js_doc.rs b/src/tools/compiletest/src/runtest/js_doc.rs index a83bcd70c8718..75fe355b7c84a 100644 --- a/src/tools/compiletest/src/runtest/js_doc.rs +++ b/src/tools/compiletest/src/runtest/js_doc.rs @@ -8,13 +8,18 @@ impl TestCx<'_> { let out_dir = self.output_base_dir(); self.document(&out_dir, &self.testpaths); - - let root = self.config.find_rust_src_root().unwrap(); let file_stem = self.testpaths.file.file_stem().and_then(|f| f.to_str()).expect("no file stem"); let res = self.run_command_to_procres( Command::new(&nodejs) - .arg(root.join("src/tools/rustdoc-js/tester.js")) + .arg( + self.config + .src_root + .join("src") + .join("tools") + .join("rustdoc-js") + .join("tester.js"), + ) .arg("--doc-folder") .arg(out_dir) .arg("--crate-name") diff --git a/src/tools/compiletest/src/runtest/run_make.rs b/src/tools/compiletest/src/runtest/run_make.rs index 7ef16e4a9667b..49f83d7881f71 100644 --- a/src/tools/compiletest/src/runtest/run_make.rs +++ b/src/tools/compiletest/src/runtest/run_make.rs @@ -21,8 +21,6 @@ impl TestCx<'_> { fn run_rmake_legacy_test(&self) { let cwd = env::current_dir().unwrap(); - let src_root = self.config.src_base.parent().unwrap().parent().unwrap(); - let src_root = cwd.join(&src_root); // FIXME(Zalathar): This should probably be `output_base_dir` to avoid // an unnecessary extra subdirectory, but since legacy Makefile tests @@ -51,7 +49,7 @@ impl TestCx<'_> { .stderr(Stdio::piped()) .env("TARGET", &self.config.target) .env("PYTHON", &self.config.python) - .env("S", src_root) + .env("S", &self.config.src_root) .env("RUST_BUILD_STAGE", &self.config.stage_id) .env("RUSTC", cwd.join(&self.config.rustc_path)) .env("TMPDIR", &tmpdir) @@ -197,14 +195,7 @@ impl TestCx<'_> { // ``` // `source_root` is the top-level directory containing the rust-lang/rust checkout. - let source_root = - self.config.find_rust_src_root().expect("could not determine rust source root"); - // `self.config.build_base` is actually the build base folder + "test" + test suite name, it - // looks like `build//test/run-make`. But we want `build//`. Note - // that the `build` directory does not need to be called `build`, nor does it need to be - // under `source_root`, so we must compute it based off of `self.config.build_base`. - let build_root = - self.config.build_base.parent().and_then(Path::parent).unwrap().to_path_buf(); + let host_build_root = self.config.build_root.join(&self.config.host); // We construct the following directory tree for each rmake.rs test: // ``` @@ -239,30 +230,6 @@ impl TestCx<'_> { } } - // `self.config.stage_id` looks like `stage1-`, but we only want - // the `stage1` part as that is what the output directories of bootstrap are prefixed with. - // Note that this *assumes* build layout from bootstrap is produced as: - // - // ``` - // build// // <- this is `build_root` - // ├── stage0 - // ├── stage0-bootstrap-tools - // ├── stage0-codegen - // ├── stage0-rustc - // ├── stage0-std - // ├── stage0-sysroot - // ├── stage0-tools - // ├── stage0-tools-bin - // ├── stage1 - // ├── stage1-std - // ├── stage1-tools - // ├── stage1-tools-bin - // └── test - // ``` - // FIXME(jieyouxu): improve the communication between bootstrap and compiletest here so - // we don't have to hack out a `stageN`. - let stage = self.config.stage_id.split('-').next().unwrap(); - // In order to link in the support library as a rlib when compiling recipes, we need three // paths: // 1. Path of the built support library rlib itself. @@ -284,10 +251,12 @@ impl TestCx<'_> { // support lib and its deps are organized, can't we copy them to the tools-bin dir as // well?), but this seems to work for now. - let stage_tools_bin = build_root.join(format!("{stage}-tools-bin")); + let stage = self.config.stage; + + let stage_tools_bin = host_build_root.join(format!("stage{stage}-tools-bin")); let support_lib_path = stage_tools_bin.join("librun_make_support.rlib"); - let stage_tools = build_root.join(format!("{stage}-tools")); + let stage_tools = host_build_root.join(format!("stage{stage}-tools")); let support_lib_deps = stage_tools.join(&self.config.host).join("release").join("deps"); let support_lib_deps_deps = stage_tools.join("release").join("deps"); @@ -353,7 +322,7 @@ impl TestCx<'_> { // to work correctly. // // See for more background. - let stage0_sysroot = build_root.join("stage0-sysroot"); + let stage0_sysroot = host_build_root.join("stage0-sysroot"); if std::env::var_os("COMPILETEST_FORCE_STAGE0").is_some() { rustc.arg("--sysroot").arg(&stage0_sysroot); } @@ -368,7 +337,7 @@ impl TestCx<'_> { // provided through env vars. // Compute stage-specific standard library paths. - let stage_std_path = build_root.join(&stage).join("lib"); + let stage_std_path = host_build_root.join(format!("stage{stage}")).join("lib"); // Compute dynamic library search paths for recipes. let recipe_dylib_search_paths = { @@ -413,9 +382,9 @@ impl TestCx<'_> { .env("PYTHON", &self.config.python) // Provide path to checkout root. This is the top-level directory containing // rust-lang/rust checkout. - .env("SOURCE_ROOT", &source_root) - // Path to the build directory. This is usually the same as `source_root.join("build").join("host")`. - .env("BUILD_ROOT", &build_root) + .env("SOURCE_ROOT", &self.config.src_root) + // Path to `$build_dir/$host_triple/`. + .env("BUILD_ROOT", &host_build_root) // Provide path to stage-corresponding rustc. .env("RUSTC", &self.config.rustc_path) // Provide the directory to libraries that are needed to run the *compiler*. This is not @@ -430,11 +399,11 @@ impl TestCx<'_> { .env("LLVM_COMPONENTS", &self.config.llvm_components); if let Some(ref cargo) = self.config.cargo_path { - cmd.env("CARGO", source_root.join(cargo)); + cmd.env("CARGO", cargo); } if let Some(ref rustdoc) = self.config.rustdoc_path { - cmd.env("RUSTDOC", source_root.join(rustdoc)); + cmd.env("RUSTDOC", rustdoc); } if let Some(ref node) = self.config.nodejs { diff --git a/src/tools/compiletest/src/runtest/rustdoc.rs b/src/tools/compiletest/src/runtest/rustdoc.rs index 3f33862d2cfe2..0a05c6cef81b3 100644 --- a/src/tools/compiletest/src/runtest/rustdoc.rs +++ b/src/tools/compiletest/src/runtest/rustdoc.rs @@ -17,9 +17,10 @@ impl TestCx<'_> { if self.props.check_test_line_numbers_match { self.check_rustdoc_test_option(proc_res); } else { - let root = self.config.find_rust_src_root().unwrap(); let mut cmd = Command::new(&self.config.python); - cmd.arg(root.join("src/etc/htmldocck.py")).arg(&out_dir).arg(&self.testpaths.file); + cmd.arg(self.config.src_root.join("src").join("etc").join("htmldocck.py")) + .arg(&out_dir) + .arg(&self.testpaths.file); if self.config.bless { cmd.arg("--bless"); } diff --git a/src/tools/compiletest/src/runtest/rustdoc_json.rs b/src/tools/compiletest/src/runtest/rustdoc_json.rs index 31fdb0a5d13bd..bf7eb2e109a46 100644 --- a/src/tools/compiletest/src/runtest/rustdoc_json.rs +++ b/src/tools/compiletest/src/runtest/rustdoc_json.rs @@ -16,13 +16,12 @@ impl TestCx<'_> { self.fatal_proc_rec("rustdoc failed!", &proc_res); } - let root = self.config.find_rust_src_root().unwrap(); let mut json_out = out_dir.join(self.testpaths.file.file_stem().unwrap()); json_out.set_extension("json"); let res = self.run_command_to_procres( Command::new(self.config.jsondocck_path.as_ref().unwrap()) .arg("--doc-dir") - .arg(root.join(&out_dir)) + .arg(&out_dir) .arg("--template") .arg(&self.testpaths.file), ); diff --git a/src/tools/compiletest/src/runtest/ui.rs b/src/tools/compiletest/src/runtest/ui.rs index 0c6d46188e6f4..3329e10745f8d 100644 --- a/src/tools/compiletest/src/runtest/ui.rs +++ b/src/tools/compiletest/src/runtest/ui.rs @@ -66,7 +66,7 @@ impl TestCx<'_> { && !self.props.run_rustfix && !self.props.rustfix_only_machine_applicable { - let mut coverage_file_path = self.config.build_base.clone(); + let mut coverage_file_path = self.config.build_test_suite_root.clone(); coverage_file_path.push("rustfix_missing_coverage.txt"); debug!("coverage_file_path: {}", coverage_file_path.display()); diff --git a/tests/codegen/debug-compile-unit-path.rs b/tests/codegen/debug-compile-unit-path.rs index 6131d9d7351a6..b689bdd5dd8e9 100644 --- a/tests/codegen/debug-compile-unit-path.rs +++ b/tests/codegen/debug-compile-unit-path.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -g --remap-path-prefix={{cwd}}=/cwd/ --remap-path-prefix={{src-base}}=/base/ +//@ compile-flags: -g --remap-path-prefix={{cwd}}=/cwd/ --remap-path-prefix={{test-suite-src-base}}=/base/ // // // Ensure that we remap the compile unit directory and that we set it to the compilers current diff --git a/tests/codegen/remap_path_prefix/auxiliary/remap_path_prefix_aux.rs b/tests/codegen/remap_path_prefix/auxiliary/remap_path_prefix_aux.rs index 7afc16ec72f3b..930af330fd387 100644 --- a/tests/codegen/remap_path_prefix/auxiliary/remap_path_prefix_aux.rs +++ b/tests/codegen/remap_path_prefix/auxiliary/remap_path_prefix_aux.rs @@ -1,6 +1,6 @@ // -//@ compile-flags: -g --remap-path-prefix={{cwd}}=/the/aux-cwd --remap-path-prefix={{src-base}}/remap_path_prefix/auxiliary=/the/aux-src +//@ compile-flags: -g --remap-path-prefix={{cwd}}=/the/aux-cwd --remap-path-prefix={{test-suite-src-base}}/remap_path_prefix/auxiliary=/the/aux-src #[inline] pub fn some_aux_function() -> i32 { diff --git a/tests/codegen/remap_path_prefix/auxiliary/xcrate-generic.rs b/tests/codegen/remap_path_prefix/auxiliary/xcrate-generic.rs index 9d5cdfe063b64..8cc324f4e97d5 100644 --- a/tests/codegen/remap_path_prefix/auxiliary/xcrate-generic.rs +++ b/tests/codegen/remap_path_prefix/auxiliary/xcrate-generic.rs @@ -1,5 +1,5 @@ // -//@ compile-flags: -g --remap-path-prefix={{cwd}}=/the/aux-cwd --remap-path-prefix={{src-base}}/remap_path_prefix/auxiliary=/the/aux-src +//@ compile-flags: -g --remap-path-prefix={{cwd}}=/the/aux-cwd --remap-path-prefix={{test-suite-src-base}}/remap_path_prefix/auxiliary=/the/aux-src #![crate_type = "lib"] diff --git a/tests/codegen/remap_path_prefix/main.rs b/tests/codegen/remap_path_prefix/main.rs index bfbccfe0df80a..a04e1a02fdb01 100644 --- a/tests/codegen/remap_path_prefix/main.rs +++ b/tests/codegen/remap_path_prefix/main.rs @@ -1,7 +1,7 @@ //@ ignore-windows // -//@ compile-flags: -g -C no-prepopulate-passes --remap-path-prefix={{cwd}}=/the/cwd --remap-path-prefix={{src-base}}=/the/src -Zinline-mir=no +//@ compile-flags: -g -C no-prepopulate-passes --remap-path-prefix={{cwd}}=/the/cwd --remap-path-prefix={{test-suite-src-base}}=/the/src -Zinline-mir=no //@ aux-build:remap_path_prefix_aux.rs extern crate remap_path_prefix_aux; diff --git a/tests/incremental/auxiliary/circular-dependencies-aux.rs b/tests/incremental/auxiliary/circular-dependencies-aux.rs index e28a6a2ca0e01..4a1e5502a1fd9 100644 --- a/tests/incremental/auxiliary/circular-dependencies-aux.rs +++ b/tests/incremental/auxiliary/circular-dependencies-aux.rs @@ -1,5 +1,5 @@ //@ edition: 2021 -//@ compile-flags: --crate-type lib --extern circular_dependencies={{build-base}}/circular-dependencies/libcircular_dependencies.rmeta --emit dep-info,metadata +//@ compile-flags: --crate-type lib --extern circular_dependencies={{test-suite-build-base}}/circular-dependencies/libcircular_dependencies.rmeta --emit dep-info,metadata use circular_dependencies::Foo; diff --git a/tests/incremental/circular-dependencies.rs b/tests/incremental/circular-dependencies.rs index c7b5b931fbbec..c228656f78925 100644 --- a/tests/incremental/circular-dependencies.rs +++ b/tests/incremental/circular-dependencies.rs @@ -3,7 +3,7 @@ //@ edition: 2021 //@ [cpass1] compile-flags: --crate-type lib --emit dep-info,metadata //@ [cfail2] aux-build: circular-dependencies-aux.rs -//@ [cfail2] compile-flags: --test --extern aux={{build-base}}/circular-dependencies/auxiliary/libcircular_dependencies_aux.rmeta -L dependency={{build-base}}/circular-dependencies +//@ [cfail2] compile-flags: --test --extern aux={{test-suite-build-base}}/circular-dependencies/auxiliary/libcircular_dependencies_aux.rmeta -L dependency={{test-suite-build-base}}/circular-dependencies pub struct Foo; //[cfail2]~^ NOTE the crate `circular_dependencies` is compiled multiple times, possibly with different configurations diff --git a/tests/incremental/remapped_paths_cc/auxiliary/extern_crate.rs b/tests/incremental/remapped_paths_cc/auxiliary/extern_crate.rs index 166000f3214bd..9dfa5d6b24204 100644 --- a/tests/incremental/remapped_paths_cc/auxiliary/extern_crate.rs +++ b/tests/incremental/remapped_paths_cc/auxiliary/extern_crate.rs @@ -1,6 +1,6 @@ //@[rpass1] compile-flags: -g //@[rpass2] compile-flags: -g -//@[rpass3] compile-flags: -g --remap-path-prefix={{src-base}}=/the/src +//@[rpass3] compile-flags: -g --remap-path-prefix={{test-suite-src-base}}=/the/src #![feature(rustc_attrs)] #![crate_type="rlib"] diff --git a/tests/pretty/expanded-and-path-remap-80832.pp b/tests/pretty/expanded-and-path-remap-80832.pp index 5b3922bb32946..04e01184cd67b 100644 --- a/tests/pretty/expanded-and-path-remap-80832.pp +++ b/tests/pretty/expanded-and-path-remap-80832.pp @@ -8,6 +8,6 @@ // //@ pretty-mode:expanded //@ pp-exact:expanded-and-path-remap-80832.pp -//@ compile-flags: --remap-path-prefix {{src-base}}=the/src +//@ compile-flags: --remap-path-prefix {{test-suite-src-base}}=the/src fn main() {} diff --git a/tests/pretty/expanded-and-path-remap-80832.rs b/tests/pretty/expanded-and-path-remap-80832.rs index 2e5dacfc0c17a..7e56e974a5e81 100644 --- a/tests/pretty/expanded-and-path-remap-80832.rs +++ b/tests/pretty/expanded-and-path-remap-80832.rs @@ -2,6 +2,6 @@ // //@ pretty-mode:expanded //@ pp-exact:expanded-and-path-remap-80832.pp -//@ compile-flags: --remap-path-prefix {{src-base}}=the/src +//@ compile-flags: --remap-path-prefix {{test-suite-src-base}}=the/src fn main() {} diff --git a/tests/pretty/tests-are-sorted.pp b/tests/pretty/tests-are-sorted.pp index 31449b51dc3e1..c84f3def418e3 100644 --- a/tests/pretty/tests-are-sorted.pp +++ b/tests/pretty/tests-are-sorted.pp @@ -4,7 +4,7 @@ use ::std::prelude::rust_2015::*; #[macro_use] extern crate std; -//@ compile-flags: --crate-type=lib --test --remap-path-prefix={{src-base}}/=/the/src/ --remap-path-prefix={{src-base}}\=/the/src/ +//@ compile-flags: --crate-type=lib --test --remap-path-prefix={{test-suite-src-base}}/=/the/src/ --remap-path-prefix={{test-suite-src-base}}\=/the/src/ //@ pretty-compare-only //@ pretty-mode:expanded //@ pp-exact:tests-are-sorted.pp diff --git a/tests/pretty/tests-are-sorted.rs b/tests/pretty/tests-are-sorted.rs index 0326eba4a4496..ed2f9df1687c4 100644 --- a/tests/pretty/tests-are-sorted.rs +++ b/tests/pretty/tests-are-sorted.rs @@ -1,4 +1,4 @@ -//@ compile-flags: --crate-type=lib --test --remap-path-prefix={{src-base}}/=/the/src/ --remap-path-prefix={{src-base}}\=/the/src/ +//@ compile-flags: --crate-type=lib --test --remap-path-prefix={{test-suite-src-base}}/=/the/src/ --remap-path-prefix={{test-suite-src-base}}\=/the/src/ //@ pretty-compare-only //@ pretty-mode:expanded //@ pp-exact:tests-are-sorted.pp diff --git a/tests/rustdoc-ui/argfile/commandline-argfile-badutf8-windows.rs b/tests/rustdoc-ui/argfile/commandline-argfile-badutf8-windows.rs index eba17ca6f7e92..04590e0672c43 100644 --- a/tests/rustdoc-ui/argfile/commandline-argfile-badutf8-windows.rs +++ b/tests/rustdoc-ui/argfile/commandline-argfile-badutf8-windows.rs @@ -5,7 +5,7 @@ // line arguments and is only run on windows. // //@ only-windows -//@ compile-flags: --cfg cmdline_set @{{src-base}}\argfile\commandline-argfile-badutf8.args +//@ compile-flags: --cfg cmdline_set @{{test-suite-src-base}}\argfile\commandline-argfile-badutf8.args #[cfg(not(cmdline_set))] compile_error!("cmdline_set not set"); diff --git a/tests/rustdoc-ui/argfile/commandline-argfile-badutf8.rs b/tests/rustdoc-ui/argfile/commandline-argfile-badutf8.rs index 1b2e52af762f1..4ddf83e61c9fb 100644 --- a/tests/rustdoc-ui/argfile/commandline-argfile-badutf8.rs +++ b/tests/rustdoc-ui/argfile/commandline-argfile-badutf8.rs @@ -6,7 +6,7 @@ // windows. // //@ ignore-windows -//@ compile-flags: --cfg cmdline_set @{{src-base}}/argfile/commandline-argfile-badutf8.args +//@ compile-flags: --cfg cmdline_set @{{test-suite-src-base}}/argfile/commandline-argfile-badutf8.args #[cfg(not(cmdline_set))] compile_error!("cmdline_set not set"); diff --git a/tests/rustdoc-ui/argfile/commandline-argfile-missing-windows.rs b/tests/rustdoc-ui/argfile/commandline-argfile-missing-windows.rs index 1a1cf6b9e75e8..f55e03cb3aeae 100644 --- a/tests/rustdoc-ui/argfile/commandline-argfile-missing-windows.rs +++ b/tests/rustdoc-ui/argfile/commandline-argfile-missing-windows.rs @@ -7,7 +7,7 @@ //@ only-windows //@ normalize-stderr: "os error \d+" -> "os error $$ERR" //@ normalize-stderr: "commandline-argfile-missing.args:[^(]*" -> "commandline-argfile-missing.args: $$FILE_MISSING " -//@ compile-flags: --cfg cmdline_set @{{src-base}}\argfile\commandline-argfile-missing.args +//@ compile-flags: --cfg cmdline_set @{{test-suite-src-base}}\argfile\commandline-argfile-missing.args #[cfg(not(cmdline_set))] compile_error!("cmdline_set not set"); diff --git a/tests/rustdoc-ui/argfile/commandline-argfile-missing.rs b/tests/rustdoc-ui/argfile/commandline-argfile-missing.rs index 8d9335f5add5d..4cba1f7a04c97 100644 --- a/tests/rustdoc-ui/argfile/commandline-argfile-missing.rs +++ b/tests/rustdoc-ui/argfile/commandline-argfile-missing.rs @@ -8,7 +8,7 @@ //@ ignore-windows //@ normalize-stderr: "os error \d+" -> "os error $$ERR" //@ normalize-stderr: "commandline-argfile-missing.args:[^(]*" -> "commandline-argfile-missing.args: $$FILE_MISSING " -//@ compile-flags: --cfg cmdline_set @{{src-base}}/argfile/commandline-argfile-missing.args +//@ compile-flags: --cfg cmdline_set @{{test-suite-src-base}}/argfile/commandline-argfile-missing.args #[cfg(not(cmdline_set))] compile_error!("cmdline_set not set"); diff --git a/tests/rustdoc-ui/argfile/commandline-argfile-multiple-windows.rs b/tests/rustdoc-ui/argfile/commandline-argfile-multiple-windows.rs index 9cbbd505c57b6..ac7a73fb321cb 100644 --- a/tests/rustdoc-ui/argfile/commandline-argfile-multiple-windows.rs +++ b/tests/rustdoc-ui/argfile/commandline-argfile-multiple-windows.rs @@ -8,7 +8,7 @@ //@ normalize-stderr: "os error \d+" -> "os error $$ERR" //@ normalize-stderr: "commandline-argfile-missing.args:[^(]*" -> "commandline-argfile-missing.args: $$FILE_MISSING " //@ normalize-stderr: "commandline-argfile-missing2.args:[^(]*" -> "commandline-argfile-missing2.args: $$FILE_MISSING " -//@ compile-flags: --cfg cmdline_set @{{src-base}}\argfile\commandline-argfile-missing.args @{{src-base}}\argfile\commandline-argfile-badutf8.args @{{src-base}}\argfile\commandline-argfile-missing2.args +//@ compile-flags: --cfg cmdline_set @{{test-suite-src-base}}\argfile\commandline-argfile-missing.args @{{test-suite-src-base}}\argfile\commandline-argfile-badutf8.args @{{test-suite-src-base}}\argfile\commandline-argfile-missing2.args #[cfg(not(cmdline_set))] compile_error!("cmdline_set not set"); diff --git a/tests/rustdoc-ui/argfile/commandline-argfile-multiple.rs b/tests/rustdoc-ui/argfile/commandline-argfile-multiple.rs index f211a50892c5b..8af060ed70579 100644 --- a/tests/rustdoc-ui/argfile/commandline-argfile-multiple.rs +++ b/tests/rustdoc-ui/argfile/commandline-argfile-multiple.rs @@ -9,7 +9,7 @@ //@ normalize-stderr: "os error \d+" -> "os error $$ERR" //@ normalize-stderr: "commandline-argfile-missing.args:[^(]*" -> "commandline-argfile-missing.args: $$FILE_MISSING " //@ normalize-stderr: "commandline-argfile-missing2.args:[^(]*" -> "commandline-argfile-missing2.args: $$FILE_MISSING " -//@ compile-flags: --cfg cmdline_set @{{src-base}}/argfile/commandline-argfile-missing.args @{{src-base}}/argfile/commandline-argfile-badutf8.args @{{src-base}}/argfile/commandline-argfile-missing2.args +//@ compile-flags: --cfg cmdline_set @{{test-suite-src-base}}/argfile/commandline-argfile-missing.args @{{test-suite-src-base}}/argfile/commandline-argfile-badutf8.args @{{test-suite-src-base}}/argfile/commandline-argfile-missing2.args #[cfg(not(cmdline_set))] compile_error!("cmdline_set not set"); diff --git a/tests/rustdoc-ui/argfile/commandline-argfile.rs b/tests/rustdoc-ui/argfile/commandline-argfile.rs index d5a1cd0a5ed7a..0cad8c2e3c790 100644 --- a/tests/rustdoc-ui/argfile/commandline-argfile.rs +++ b/tests/rustdoc-ui/argfile/commandline-argfile.rs @@ -2,7 +2,7 @@ // //@ check-pass //@ compile-flags: --cfg cmdline_set --check-cfg=cfg(cmdline_set,unbroken) -//@ compile-flags: @{{src-base}}/argfile/commandline-argfile.args +//@ compile-flags: @{{test-suite-src-base}}/argfile/commandline-argfile.args #[cfg(not(cmdline_set))] compile_error!("cmdline_set not set"); diff --git a/tests/rustdoc-ui/doctest/run-directory.rs b/tests/rustdoc-ui/doctest/run-directory.rs index 090bd19c4d90b..4d1fba79b5b27 100644 --- a/tests/rustdoc-ui/doctest/run-directory.rs +++ b/tests/rustdoc-ui/doctest/run-directory.rs @@ -2,8 +2,8 @@ //@ revisions: correct incorrect //@ check-pass -//@ [correct]compile-flags:--test --test-run-directory={{src-base}} -//@ [incorrect]compile-flags:--test --test-run-directory={{src-base}}/coverage +//@ [correct]compile-flags:--test --test-run-directory={{test-suite-src-base}} +//@ [incorrect]compile-flags:--test --test-run-directory={{test-suite-src-base}}/coverage //@ normalize-stdout: "tests/rustdoc-ui/doctest" -> "$$DIR" //@ normalize-stdout: "finished in \d+\.\d+s" -> "finished in $$TIME" diff --git a/tests/rustdoc-ui/invalid-theme-name.rs b/tests/rustdoc-ui/invalid-theme-name.rs index d632a08ebc805..b932dc6d1e320 100644 --- a/tests/rustdoc-ui/invalid-theme-name.rs +++ b/tests/rustdoc-ui/invalid-theme-name.rs @@ -1,3 +1,3 @@ -//@ compile-flags:--theme {{src-base}}/invalid-theme-name.rs +//@ compile-flags:--theme {{test-suite-src-base}}/invalid-theme-name.rs //@ error-pattern: invalid argument //@ error-pattern: must have a .css extension diff --git a/tests/rustdoc-ui/remap-path-prefix-failed-doctest-output.rs b/tests/rustdoc-ui/remap-path-prefix-failed-doctest-output.rs index 72c3330709a7c..b3f4c51c37e63 100644 --- a/tests/rustdoc-ui/remap-path-prefix-failed-doctest-output.rs +++ b/tests/rustdoc-ui/remap-path-prefix-failed-doctest-output.rs @@ -2,7 +2,7 @@ // adapted to use that, and that normalize line can go away //@ failure-status: 101 -//@ compile-flags:--test -Z unstable-options --remap-path-prefix={{src-base}}=remapped_path --test-args --test-threads=1 +//@ compile-flags:--test -Z unstable-options --remap-path-prefix={{test-suite-src-base}}=remapped_path --test-args --test-threads=1 //@ rustc-env:RUST_BACKTRACE=0 //@ normalize-stdout: "finished in \d+\.\d+s" -> "finished in $$TIME" //@ normalize-stdout: "exit (status|code): 101" -> "exit status: 101" diff --git a/tests/rustdoc-ui/remap-path-prefix-invalid-doctest.rs b/tests/rustdoc-ui/remap-path-prefix-invalid-doctest.rs index c18a416d43f08..f1490c31d09d1 100644 --- a/tests/rustdoc-ui/remap-path-prefix-invalid-doctest.rs +++ b/tests/rustdoc-ui/remap-path-prefix-invalid-doctest.rs @@ -2,7 +2,7 @@ // adapted to use that, and that normalize line can go away //@ failure-status: 101 -//@ compile-flags:--test -Z unstable-options --remap-path-prefix={{src-base}}=remapped_path --test-args --test-threads=1 +//@ compile-flags:--test -Z unstable-options --remap-path-prefix={{test-suite-src-base}}=remapped_path --test-args --test-threads=1 //@ rustc-env:RUST_BACKTRACE=0 //@ normalize-stdout: "finished in \d+\.\d+s" -> "finished in $$TIME" diff --git a/tests/rustdoc-ui/remap-path-prefix-lint.rs b/tests/rustdoc-ui/remap-path-prefix-lint.rs index f27863e825d93..c2e034cf6b97b 100644 --- a/tests/rustdoc-ui/remap-path-prefix-lint.rs +++ b/tests/rustdoc-ui/remap-path-prefix-lint.rs @@ -1,7 +1,7 @@ // Regression test for remapped paths in rustdoc errors // . -//@ compile-flags:-Z unstable-options --remap-path-prefix={{src-base}}=remapped_path +//@ compile-flags:-Z unstable-options --remap-path-prefix={{test-suite-src-base}}=remapped_path //@ rustc-env:RUST_BACKTRACE=0 #![deny(rustdoc::invalid_html_tags)] diff --git a/tests/rustdoc-ui/remap-path-prefix-passed-doctest-output.rs b/tests/rustdoc-ui/remap-path-prefix-passed-doctest-output.rs index 6fa04ef77f32b..9632cd7a02c7b 100644 --- a/tests/rustdoc-ui/remap-path-prefix-passed-doctest-output.rs +++ b/tests/rustdoc-ui/remap-path-prefix-passed-doctest-output.rs @@ -4,7 +4,7 @@ // FIXME: if/when the output of the test harness can be tested on its own, this test should be // adapted to use that, and that normalize line can go away -//@ compile-flags:--test -Z unstable-options --remap-path-prefix={{src-base}}=remapped_path --test-args --test-threads=1 +//@ compile-flags:--test -Z unstable-options --remap-path-prefix={{test-suite-src-base}}=remapped_path --test-args --test-threads=1 //@ normalize-stdout: "finished in \d+\.\d+s" -> "finished in $$TIME" // doctest passes at runtime diff --git a/tests/rustdoc-ui/scrape-examples/scrape-examples-fail-if-type-error.rs b/tests/rustdoc-ui/scrape-examples/scrape-examples-fail-if-type-error.rs index 4fb5c9ab36fa3..561deb1a8cc92 100644 --- a/tests/rustdoc-ui/scrape-examples/scrape-examples-fail-if-type-error.rs +++ b/tests/rustdoc-ui/scrape-examples/scrape-examples-fail-if-type-error.rs @@ -1,5 +1,5 @@ //@ check-fail -//@ compile-flags: -Z unstable-options --scrape-examples-output-path {{build-base}}/t.calls --scrape-examples-target-crate foobar +//@ compile-flags: -Z unstable-options --scrape-examples-output-path {{test-suite-build-base}}/t.calls --scrape-examples-target-crate foobar pub fn foo() { INVALID_FUNC(); diff --git a/tests/rustdoc-ui/scrape-examples/scrape-examples-ice.rs b/tests/rustdoc-ui/scrape-examples/scrape-examples-ice.rs index 0c7aeb800dcc7..b9153d287ff6c 100644 --- a/tests/rustdoc-ui/scrape-examples/scrape-examples-ice.rs +++ b/tests/rustdoc-ui/scrape-examples/scrape-examples-ice.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -Z unstable-options --scrape-examples-output-path {{build-base}}/t.calls --scrape-examples-target-crate foobar +//@ compile-flags: -Z unstable-options --scrape-examples-output-path {{test-suite-build-base}}/t.calls --scrape-examples-target-crate foobar //@ check-pass #![no_std] use core as _; diff --git a/tests/rustdoc/auxiliary/external-macro-src.rs b/tests/rustdoc/auxiliary/external-macro-src.rs index 79df5dc98ebab..fedcd1649ad1b 100644 --- a/tests/rustdoc/auxiliary/external-macro-src.rs +++ b/tests/rustdoc/auxiliary/external-macro-src.rs @@ -1,4 +1,4 @@ -//@ compile-flags:--remap-path-prefix={{src-base}}=/does-not-exist +//@ compile-flags:--remap-path-prefix={{test-suite-src-base}}=/does-not-exist #![doc(html_root_url = "https://example.com/")] diff --git a/tests/ui-fulldeps/obtain-borrowck.rs b/tests/ui-fulldeps/obtain-borrowck.rs index f8064c245a872..c6721dc2e6ec4 100644 --- a/tests/ui-fulldeps/obtain-borrowck.rs +++ b/tests/ui-fulldeps/obtain-borrowck.rs @@ -1,7 +1,7 @@ //@ edition: 2021 //@ run-pass //@ check-run-results -//@ run-flags: --sysroot {{sysroot-base}} --edition=2021 {{src-base}}/auxiliary/obtain-borrowck-input.rs +//@ run-flags: --sysroot {{sysroot-base}} --edition=2021 {{test-suite-src-base}}/auxiliary/obtain-borrowck-input.rs //@ ignore-stage1 (requires matching sysroot built with in-tree compiler) // ignore-tidy-linelength diff --git a/tests/ui/argfile/commandline-argfile-badutf8-windows.rs b/tests/ui/argfile/commandline-argfile-badutf8-windows.rs index eba17ca6f7e92..04590e0672c43 100644 --- a/tests/ui/argfile/commandline-argfile-badutf8-windows.rs +++ b/tests/ui/argfile/commandline-argfile-badutf8-windows.rs @@ -5,7 +5,7 @@ // line arguments and is only run on windows. // //@ only-windows -//@ compile-flags: --cfg cmdline_set @{{src-base}}\argfile\commandline-argfile-badutf8.args +//@ compile-flags: --cfg cmdline_set @{{test-suite-src-base}}\argfile\commandline-argfile-badutf8.args #[cfg(not(cmdline_set))] compile_error!("cmdline_set not set"); diff --git a/tests/ui/argfile/commandline-argfile-badutf8.rs b/tests/ui/argfile/commandline-argfile-badutf8.rs index 1b2e52af762f1..4ddf83e61c9fb 100644 --- a/tests/ui/argfile/commandline-argfile-badutf8.rs +++ b/tests/ui/argfile/commandline-argfile-badutf8.rs @@ -6,7 +6,7 @@ // windows. // //@ ignore-windows -//@ compile-flags: --cfg cmdline_set @{{src-base}}/argfile/commandline-argfile-badutf8.args +//@ compile-flags: --cfg cmdline_set @{{test-suite-src-base}}/argfile/commandline-argfile-badutf8.args #[cfg(not(cmdline_set))] compile_error!("cmdline_set not set"); diff --git a/tests/ui/argfile/commandline-argfile-missing-windows.rs b/tests/ui/argfile/commandline-argfile-missing-windows.rs index 1a1cf6b9e75e8..f55e03cb3aeae 100644 --- a/tests/ui/argfile/commandline-argfile-missing-windows.rs +++ b/tests/ui/argfile/commandline-argfile-missing-windows.rs @@ -7,7 +7,7 @@ //@ only-windows //@ normalize-stderr: "os error \d+" -> "os error $$ERR" //@ normalize-stderr: "commandline-argfile-missing.args:[^(]*" -> "commandline-argfile-missing.args: $$FILE_MISSING " -//@ compile-flags: --cfg cmdline_set @{{src-base}}\argfile\commandline-argfile-missing.args +//@ compile-flags: --cfg cmdline_set @{{test-suite-src-base}}\argfile\commandline-argfile-missing.args #[cfg(not(cmdline_set))] compile_error!("cmdline_set not set"); diff --git a/tests/ui/argfile/commandline-argfile-missing.rs b/tests/ui/argfile/commandline-argfile-missing.rs index 8d9335f5add5d..4cba1f7a04c97 100644 --- a/tests/ui/argfile/commandline-argfile-missing.rs +++ b/tests/ui/argfile/commandline-argfile-missing.rs @@ -8,7 +8,7 @@ //@ ignore-windows //@ normalize-stderr: "os error \d+" -> "os error $$ERR" //@ normalize-stderr: "commandline-argfile-missing.args:[^(]*" -> "commandline-argfile-missing.args: $$FILE_MISSING " -//@ compile-flags: --cfg cmdline_set @{{src-base}}/argfile/commandline-argfile-missing.args +//@ compile-flags: --cfg cmdline_set @{{test-suite-src-base}}/argfile/commandline-argfile-missing.args #[cfg(not(cmdline_set))] compile_error!("cmdline_set not set"); diff --git a/tests/ui/argfile/commandline-argfile-multiple-windows.rs b/tests/ui/argfile/commandline-argfile-multiple-windows.rs index 9cbbd505c57b6..ac7a73fb321cb 100644 --- a/tests/ui/argfile/commandline-argfile-multiple-windows.rs +++ b/tests/ui/argfile/commandline-argfile-multiple-windows.rs @@ -8,7 +8,7 @@ //@ normalize-stderr: "os error \d+" -> "os error $$ERR" //@ normalize-stderr: "commandline-argfile-missing.args:[^(]*" -> "commandline-argfile-missing.args: $$FILE_MISSING " //@ normalize-stderr: "commandline-argfile-missing2.args:[^(]*" -> "commandline-argfile-missing2.args: $$FILE_MISSING " -//@ compile-flags: --cfg cmdline_set @{{src-base}}\argfile\commandline-argfile-missing.args @{{src-base}}\argfile\commandline-argfile-badutf8.args @{{src-base}}\argfile\commandline-argfile-missing2.args +//@ compile-flags: --cfg cmdline_set @{{test-suite-src-base}}\argfile\commandline-argfile-missing.args @{{test-suite-src-base}}\argfile\commandline-argfile-badutf8.args @{{test-suite-src-base}}\argfile\commandline-argfile-missing2.args #[cfg(not(cmdline_set))] compile_error!("cmdline_set not set"); diff --git a/tests/ui/argfile/commandline-argfile-multiple.rs b/tests/ui/argfile/commandline-argfile-multiple.rs index f211a50892c5b..8af060ed70579 100644 --- a/tests/ui/argfile/commandline-argfile-multiple.rs +++ b/tests/ui/argfile/commandline-argfile-multiple.rs @@ -9,7 +9,7 @@ //@ normalize-stderr: "os error \d+" -> "os error $$ERR" //@ normalize-stderr: "commandline-argfile-missing.args:[^(]*" -> "commandline-argfile-missing.args: $$FILE_MISSING " //@ normalize-stderr: "commandline-argfile-missing2.args:[^(]*" -> "commandline-argfile-missing2.args: $$FILE_MISSING " -//@ compile-flags: --cfg cmdline_set @{{src-base}}/argfile/commandline-argfile-missing.args @{{src-base}}/argfile/commandline-argfile-badutf8.args @{{src-base}}/argfile/commandline-argfile-missing2.args +//@ compile-flags: --cfg cmdline_set @{{test-suite-src-base}}/argfile/commandline-argfile-missing.args @{{test-suite-src-base}}/argfile/commandline-argfile-badutf8.args @{{test-suite-src-base}}/argfile/commandline-argfile-missing2.args #[cfg(not(cmdline_set))] compile_error!("cmdline_set not set"); diff --git a/tests/ui/argfile/commandline-argfile.rs b/tests/ui/argfile/commandline-argfile.rs index b7f1e8ed6aaa9..9b82324eeb14e 100644 --- a/tests/ui/argfile/commandline-argfile.rs +++ b/tests/ui/argfile/commandline-argfile.rs @@ -2,7 +2,7 @@ // //@ build-pass //@ compile-flags: --cfg cmdline_set --check-cfg=cfg(cmdline_set,unbroken) -//@ compile-flags: @{{src-base}}/argfile/commandline-argfile.args +//@ compile-flags: @{{test-suite-src-base}}/argfile/commandline-argfile.args #[cfg(not(cmdline_set))] compile_error!("cmdline_set not set"); diff --git a/tests/ui/check-cfg/values-target-json.rs b/tests/ui/check-cfg/values-target-json.rs index b52decdf6c0c4..03e4297825e00 100644 --- a/tests/ui/check-cfg/values-target-json.rs +++ b/tests/ui/check-cfg/values-target-json.rs @@ -3,7 +3,7 @@ //@ check-pass //@ no-auto-check-cfg //@ needs-llvm-components: x86 -//@ compile-flags: --crate-type=lib --check-cfg=cfg() --target={{src-base}}/check-cfg/my-awesome-platform.json +//@ compile-flags: --crate-type=lib --check-cfg=cfg() --target={{test-suite-src-base}}/check-cfg/my-awesome-platform.json #![feature(lang_items, no_core, auto_traits)] #![no_core] diff --git a/tests/ui/codegen/mismatched-data-layouts.rs b/tests/ui/codegen/mismatched-data-layouts.rs index 955f917ee3328..54e92c5f70ca0 100644 --- a/tests/ui/codegen/mismatched-data-layouts.rs +++ b/tests/ui/codegen/mismatched-data-layouts.rs @@ -2,7 +2,7 @@ // //@ build-fail //@ needs-llvm-components: x86 -//@ compile-flags: --crate-type=lib --target={{src-base}}/codegen/mismatched-data-layout.json -Z unstable-options +//@ compile-flags: --crate-type=lib --target={{test-suite-src-base}}/codegen/mismatched-data-layout.json -Z unstable-options //@ error-pattern: differs from LLVM target's //@ normalize-stderr: "`, `[A-Za-z0-9-:]*`" -> "`, `normalized data layout`" //@ normalize-stderr: "layout, `[A-Za-z0-9-:]*`" -> "layout, `normalized data layout`" diff --git a/tests/ui/crate-loading/invalid-rlib.rs b/tests/ui/crate-loading/invalid-rlib.rs index 6b46352624452..f47bb2e43fd72 100644 --- a/tests/ui/crate-loading/invalid-rlib.rs +++ b/tests/ui/crate-loading/invalid-rlib.rs @@ -1,4 +1,4 @@ -//@ compile-flags: --crate-type lib --extern foo={{src-base}}/crate-loading/auxiliary/libfoo.rlib +//@ compile-flags: --crate-type lib --extern foo={{test-suite-src-base}}/crate-loading/auxiliary/libfoo.rlib //@ normalize-stderr: "failed to mmap file '.*auxiliary/libfoo.rlib':.*" -> "failed to mmap file 'auxiliary/libfoo.rlib'" // don't emit warn logging, it's basically the same as the errors and it's annoying to normalize //@ rustc-env:RUSTC_LOG=error diff --git a/tests/ui/errors/auxiliary/remapped_dep.rs b/tests/ui/errors/auxiliary/remapped_dep.rs index 36d4699a30600..e2e5503b6bc4e 100644 --- a/tests/ui/errors/auxiliary/remapped_dep.rs +++ b/tests/ui/errors/auxiliary/remapped_dep.rs @@ -1,4 +1,4 @@ -//@ compile-flags: --remap-path-prefix={{src-base}}/errors/auxiliary=remapped-aux +//@ compile-flags: --remap-path-prefix={{test-suite-src-base}}/errors/auxiliary=remapped-aux // no-remap-src-base: Manually remap, so the remapped path remains in .stderr file. pub struct SomeStruct {} // This line should be show as part of the error. diff --git a/tests/ui/errors/issue-104621-extern-bad-file.rs b/tests/ui/errors/issue-104621-extern-bad-file.rs index f675a4a3a4fec..7c15ea49a6e7b 100644 --- a/tests/ui/errors/issue-104621-extern-bad-file.rs +++ b/tests/ui/errors/issue-104621-extern-bad-file.rs @@ -1,4 +1,4 @@ -//@ compile-flags: --extern foo={{src-base}}/errors/issue-104621-extern-bad-file.rs +//@ compile-flags: --extern foo={{test-suite-src-base}}/errors/issue-104621-extern-bad-file.rs //@ only-linux extern crate foo; diff --git a/tests/ui/errors/remap-path-prefix-macro.rs b/tests/ui/errors/remap-path-prefix-macro.rs index 665156027c995..105b32fe3fffe 100644 --- a/tests/ui/errors/remap-path-prefix-macro.rs +++ b/tests/ui/errors/remap-path-prefix-macro.rs @@ -2,7 +2,7 @@ //@ check-run-results //@ revisions: normal with-macro-scope without-macro-scope -//@ compile-flags: --remap-path-prefix={{src-base}}=remapped +//@ compile-flags: --remap-path-prefix={{test-suite-src-base}}=remapped //@ [with-macro-scope]compile-flags: -Zremap-path-scope=macro,diagnostics //@ [without-macro-scope]compile-flags: -Zremap-path-scope=diagnostics // no-remap-src-base: Manually remap, so the remapped path remains in .stderr file. diff --git a/tests/ui/errors/remap-path-prefix-reverse.rs b/tests/ui/errors/remap-path-prefix-reverse.rs index 7743e38f50f08..59f07d3c98d9a 100644 --- a/tests/ui/errors/remap-path-prefix-reverse.rs +++ b/tests/ui/errors/remap-path-prefix-reverse.rs @@ -1,8 +1,8 @@ //@ aux-build:remapped_dep.rs -//@ compile-flags: --remap-path-prefix={{src-base}}/errors/auxiliary=remapped-aux +//@ compile-flags: --remap-path-prefix={{test-suite-src-base}}/errors/auxiliary=remapped-aux //@ revisions: local-self remapped-self -// [local-self] no-remap-src-base: The hack should work regardless of remapping. +// The hack should work regardless of remapping. //@ [remapped-self] remap-src-base // Verify that the expected source code is shown. diff --git a/tests/ui/errors/remap-path-prefix-sysroot.rs b/tests/ui/errors/remap-path-prefix-sysroot.rs index 7281e6da09440..e5805f8b9b2ff 100644 --- a/tests/ui/errors/remap-path-prefix-sysroot.rs +++ b/tests/ui/errors/remap-path-prefix-sysroot.rs @@ -1,7 +1,7 @@ //@ revisions: with-remap without-remap //@ compile-flags: -g -Ztranslate-remapped-path-to-local-path=yes -//@ [with-remap]compile-flags: --remap-path-prefix={{rust-src-base}}=remapped -//@ [with-remap]compile-flags: --remap-path-prefix={{src-base}}=remapped-tests-ui +//@ [with-remap]compile-flags: --remap-path-prefix={{sysroot-rust-src-base}}=remapped +//@ [with-remap]compile-flags: --remap-path-prefix={{test-suite-src-base}}=remapped-tests-ui //@ [without-remap]compile-flags: //@ error-pattern: E0507 diff --git a/tests/ui/errors/remap-path-prefix.rs b/tests/ui/errors/remap-path-prefix.rs index 8809caa4d4f19..c4dd2332d0294 100644 --- a/tests/ui/errors/remap-path-prefix.rs +++ b/tests/ui/errors/remap-path-prefix.rs @@ -1,5 +1,5 @@ //@ revisions: normal with-diagnostic-scope without-diagnostic-scope -//@ compile-flags: --remap-path-prefix={{src-base}}=remapped +//@ compile-flags: --remap-path-prefix={{test-suite-src-base}}=remapped //@ [with-diagnostic-scope]compile-flags: -Zremap-path-scope=diagnostics //@ [without-diagnostic-scope]compile-flags: -Zremap-path-scope=object // no-remap-src-base: Manually remap, so the remapped path remains in .stderr file. diff --git a/tests/ui/meta/revision-bad.rs b/tests/ui/meta/revision-bad.rs index 0af5624ff9c59..e7ced9ca5543a 100644 --- a/tests/ui/meta/revision-bad.rs +++ b/tests/ui/meta/revision-bad.rs @@ -5,7 +5,7 @@ //@ revisions: foo bar //@ should-fail //@ needs-run-enabled -//@ compile-flags: --remap-path-prefix={{src-base}}=remapped +//@ compile-flags: --remap-path-prefix={{test-suite-src-base}}=remapped //@[foo] error-pattern:bar //@[bar] error-pattern:foo diff --git a/tests/ui/sanitizer/dataflow.rs b/tests/ui/sanitizer/dataflow.rs index 658a9e4808664..4c7a360c8194a 100644 --- a/tests/ui/sanitizer/dataflow.rs +++ b/tests/ui/sanitizer/dataflow.rs @@ -4,7 +4,7 @@ //@ needs-sanitizer-support //@ needs-sanitizer-dataflow //@ run-pass -//@ compile-flags: -Zsanitizer=dataflow -Zsanitizer-dataflow-abilist={{src-base}}/sanitizer/dataflow-abilist.txt +//@ compile-flags: -Zsanitizer=dataflow -Zsanitizer-dataflow-abilist={{test-suite-src-base}}/sanitizer/dataflow-abilist.txt use std::mem::size_of; use std::os::raw::{c_int, c_long, c_void}; diff --git a/tests/ui/shell-argfiles/shell-argfiles-badquotes-windows.rs b/tests/ui/shell-argfiles/shell-argfiles-badquotes-windows.rs index ef90937b2217f..8db0a7cf60e1e 100644 --- a/tests/ui/shell-argfiles/shell-argfiles-badquotes-windows.rs +++ b/tests/ui/shell-argfiles/shell-argfiles-badquotes-windows.rs @@ -5,7 +5,7 @@ // line arguments and is only run on windows. // //@ only-windows -//@ compile-flags: --cfg cmdline_set -Z shell-argfiles @shell:{{src-base}}\shell-argfiles\shell-argfiles-badquotes.args +//@ compile-flags: --cfg cmdline_set -Z shell-argfiles @shell:{{test-suite-src-base}}\shell-argfiles\shell-argfiles-badquotes.args fn main() { } diff --git a/tests/ui/shell-argfiles/shell-argfiles-badquotes.rs b/tests/ui/shell-argfiles/shell-argfiles-badquotes.rs index 1edb69c3f2bbc..b04b4275acb27 100644 --- a/tests/ui/shell-argfiles/shell-argfiles-badquotes.rs +++ b/tests/ui/shell-argfiles/shell-argfiles-badquotes.rs @@ -6,7 +6,7 @@ // windows. // //@ ignore-windows -//@ compile-flags: --cfg cmdline_set -Z shell-argfiles @shell:{{src-base}}/shell-argfiles/shell-argfiles-badquotes.args +//@ compile-flags: --cfg cmdline_set -Z shell-argfiles @shell:{{test-suite-src-base}}/shell-argfiles/shell-argfiles-badquotes.args fn main() { } diff --git a/tests/ui/shell-argfiles/shell-argfiles-via-argfile.rs b/tests/ui/shell-argfiles/shell-argfiles-via-argfile.rs index 2c07542bd75e5..3da295b654cbc 100644 --- a/tests/ui/shell-argfiles/shell-argfiles-via-argfile.rs +++ b/tests/ui/shell-argfiles/shell-argfiles-via-argfile.rs @@ -2,7 +2,7 @@ // //@ build-pass //@ no-auto-check-cfg -//@ compile-flags: @{{src-base}}/shell-argfiles/shell-argfiles-via-argfile.args @shell:{{src-base}}/shell-argfiles/shell-argfiles-via-argfile-shell.args +//@ compile-flags: @{{test-suite-src-base}}/shell-argfiles/shell-argfiles-via-argfile.args @shell:{{test-suite-src-base}}/shell-argfiles/shell-argfiles-via-argfile-shell.args #[cfg(not(shell_args_set))] compile_error!("shell_args_set not set"); diff --git a/tests/ui/shell-argfiles/shell-argfiles.rs b/tests/ui/shell-argfiles/shell-argfiles.rs index f9ebef68f5a14..3cd11b99fa111 100644 --- a/tests/ui/shell-argfiles/shell-argfiles.rs +++ b/tests/ui/shell-argfiles/shell-argfiles.rs @@ -1,7 +1,7 @@ // Check to see if we can get parameters from an @argsfile file // //@ build-pass -//@ compile-flags: --cfg cmdline_set -Z shell-argfiles @shell:{{src-base}}/shell-argfiles/shell-argfiles.args +//@ compile-flags: --cfg cmdline_set -Z shell-argfiles @shell:{{test-suite-src-base}}/shell-argfiles/shell-argfiles.args #[cfg(not(cmdline_set))] compile_error!("cmdline_set not set");