a bunch of changes

This commit is contained in:
许杰友 Jieyou Xu (Joe) 2025-02-02 20:59:04 +08:00
parent 8239a37f9c
commit ab3a01388f
62 changed files with 229 additions and 227 deletions

View File

@ -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 {

View File

@ -215,15 +215,22 @@ pub struct Config {
/// `None` then these tests will be ignored.
pub run_clang_based_tests_with: Option<String>,
/// The directory containing the tests to run
pub src_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,
/// The directory where programs should be built
pub build_base: 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_base: 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`.

View File

@ -1034,19 +1034,6 @@ impl Config {
}
}
pub fn find_rust_src_root(&self) -> Option<PathBuf> {
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<String> {
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

View File

@ -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",

View File

@ -61,9 +61,17 @@ pub fn parse_config(args: Vec<String>) -> 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<String>) -> 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::<u32>().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<String>) -> 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<Config>) {
// 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<Config>) -> Vec<test::TestDescAndFn> {
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<Config>) -> Vec<test::TestDescAndFn> {
/// 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(),

View File

@ -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

View File

@ -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)

View File

@ -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")

View File

@ -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/<host_triple>/test/run-make`. But we want `build/<host_triple>/`. 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-<target_triple>`, 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/<target_triple>/ // <- 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 <https://github.com/rust-lang/rust/pull/122248> 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 {

View File

@ -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");
}

View File

@ -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),
);

View File

@ -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());

View File

@ -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

View File

@ -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 {

View File

@ -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"]

View File

@ -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;

View File

@ -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;

View File

@ -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

View File

@ -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"]

View File

@ -8,6 +8,6 @@ extern crate std;
//
//@ 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() {}

View File

@ -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() {}

View File

@ -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

View File

@ -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

View File

@ -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");

View File

@ -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");

View File

@ -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");

View File

@ -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");

View File

@ -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");

View File

@ -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");

View File

@ -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");

View File

@ -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"

View File

@ -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

View File

@ -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"

View File

@ -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"

View File

@ -1,7 +1,7 @@
// Regression test for remapped paths in rustdoc errors
// <https://github.com/rust-lang/rust/issues/69264>.
//@ 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)]

View File

@ -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

View File

@ -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();

View File

@ -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 _;

View File

@ -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/")]

View File

@ -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

View File

@ -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");

View File

@ -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");

View File

@ -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");

View File

@ -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");

View File

@ -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");

View File

@ -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");

View File

@ -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");

View File

@ -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]

View File

@ -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`"

View File

@ -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

View File

@ -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.

View File

@ -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;

View File

@ -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.

View File

@ -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.

View File

@ -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

View File

@ -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.

View File

@ -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

View File

@ -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};

View File

@ -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() {
}

View File

@ -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() {
}

View File

@ -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");

View File

@ -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");