summaryrefslogtreecommitdiffstats
path: root/src/bootstrap/test.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:13 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:13 +0000
commit218caa410aa38c29984be31a5229b9fa717560ee (patch)
treec54bd55eeb6e4c508940a30e94c0032fbd45d677 /src/bootstrap/test.rs
parentReleasing progress-linux version 1.67.1+dfsg1-1~progress7.99u1. (diff)
downloadrustc-218caa410aa38c29984be31a5229b9fa717560ee.tar.xz
rustc-218caa410aa38c29984be31a5229b9fa717560ee.zip
Merging upstream version 1.68.2+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/bootstrap/test.rs')
-rw-r--r--src/bootstrap/test.rs120
1 files changed, 77 insertions, 43 deletions
diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs
index 39cedfdac..6078e39ac 100644
--- a/src/bootstrap/test.rs
+++ b/src/bootstrap/test.rs
@@ -11,6 +11,7 @@ use std::iter;
use std::path::{Path, PathBuf};
use std::process::{Command, Stdio};
+use crate::builder::crate_description;
use crate::builder::{Builder, Compiler, Kind, RunConfig, ShouldRun, Step};
use crate::cache::Interned;
use crate::compile;
@@ -377,6 +378,7 @@ impl Step for RustAnalyzer {
SourceType::InTree,
&["sysroot-abi".to_owned()],
);
+ cargo.allow_features(tool::RustAnalyzer::ALLOW_FEATURES);
let dir = builder.src.join(workspace_path);
// needed by rust-analyzer to find its own text fixtures, cf.
@@ -689,7 +691,7 @@ impl Step for CompiletestTest {
// We need `ToolStd` for the locally-built sysroot because
// compiletest uses unstable features of the `test` crate.
builder.ensure(compile::Std::new(compiler, host));
- let cargo = tool::prepare_tool_cargo(
+ let mut cargo = tool::prepare_tool_cargo(
builder,
compiler,
Mode::ToolStd,
@@ -699,6 +701,7 @@ impl Step for CompiletestTest {
SourceType::InTree,
&[],
);
+ cargo.allow_features("test");
try_run(builder, &mut cargo.into());
}
@@ -840,7 +843,7 @@ impl Step for RustdocJSStd {
const ONLY_HOSTS: bool = true;
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
- run.suite_path("src/test/rustdoc-js-std")
+ run.suite_path("tests/rustdoc-js-std")
}
fn make_run(run: RunConfig<'_>) {
@@ -859,10 +862,10 @@ impl Step for RustdocJSStd {
.arg("--doc-folder")
.arg(builder.doc_out(self.target))
.arg("--test-folder")
- .arg(builder.src.join("src/test/rustdoc-js-std"));
+ .arg(builder.src.join("tests/rustdoc-js-std"));
for path in &builder.paths {
if let Some(p) =
- util::is_valid_test_suite_arg(path, "src/test/rustdoc-js-std", builder)
+ util::is_valid_test_suite_arg(path, "tests/rustdoc-js-std", builder)
{
if !p.ends_with(".js") {
eprintln!("A non-js file was given: `{}`", path.display());
@@ -878,7 +881,7 @@ impl Step for RustdocJSStd {
});
builder.run(&mut command);
} else {
- builder.info("No nodejs found, skipping \"src/test/rustdoc-js-std\" tests");
+ builder.info("No nodejs found, skipping \"tests/rustdoc-js-std\" tests");
}
}
}
@@ -895,7 +898,7 @@ impl Step for RustdocJSNotStd {
const ONLY_HOSTS: bool = true;
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
- run.suite_path("src/test/rustdoc-js")
+ run.suite_path("tests/rustdoc-js")
}
fn make_run(run: RunConfig<'_>) {
@@ -910,11 +913,11 @@ impl Step for RustdocJSNotStd {
target: self.target,
mode: "js-doc-test",
suite: "rustdoc-js",
- path: "src/test/rustdoc-js",
+ path: "tests/rustdoc-js",
compare_mode: None,
});
} else {
- builder.info("No nodejs found, skipping \"src/test/rustdoc-js\" tests");
+ builder.info("No nodejs found, skipping \"tests/rustdoc-js\" tests");
}
}
}
@@ -975,7 +978,7 @@ impl Step for RustdocGUI {
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
let builder = run.builder;
- let run = run.suite_path("src/test/rustdoc-gui");
+ let run = run.suite_path("tests/rustdoc-gui");
run.lazy_default_condition(Box::new(move || {
builder.config.nodejs.is_some()
&& builder
@@ -1024,7 +1027,7 @@ impl Step for RustdocGUI {
// We remove existing folder to be sure there won't be artifacts remaining.
builder.clear_if_dirty(&out_dir, &builder.rustdoc(self.compiler));
- let src_path = builder.build.src.join("src/test/rustdoc-gui/src");
+ let src_path = builder.build.src.join("tests/rustdoc-gui/src");
// We generate docs for the libraries present in the rustdoc-gui's src folder.
for entry in src_path.read_dir().expect("read_dir call failed") {
if let Ok(entry) = entry {
@@ -1048,7 +1051,7 @@ impl Step for RustdocGUI {
if entry.file_name() == "link_to_definition" {
cargo.env("RUSTDOCFLAGS", "-Zunstable-options --generate-link-to-definition");
} else if entry.file_name() == "scrape_examples" {
- cargo.arg("-Zrustdoc-scrape-examples=examples");
+ cargo.arg("-Zrustdoc-scrape-examples");
}
builder.run(&mut cargo);
}
@@ -1063,9 +1066,9 @@ impl Step for RustdocGUI {
.arg("--doc-folder")
.arg(out_dir.join("doc"))
.arg("--tests-folder")
- .arg(builder.build.src.join("src/test/rustdoc-gui"));
+ .arg(builder.build.src.join("tests/rustdoc-gui"));
for path in &builder.paths {
- if let Some(p) = util::is_valid_test_suite_arg(path, "src/test/rustdoc-gui", builder) {
+ if let Some(p) = util::is_valid_test_suite_arg(path, "tests/rustdoc-gui", builder) {
if !p.ends_with(".goml") {
eprintln!("A non-goml file was given: `{}`", path.display());
panic!("Cannot run rustdoc-gui tests");
@@ -1142,6 +1145,40 @@ help: to skip test's attempt to check tidiness, pass `--exclude src/tools/tidy`
}
}
+/// Runs tidy's own tests.
+#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
+pub struct TidySelfTest;
+
+impl Step for TidySelfTest {
+ type Output = ();
+ const DEFAULT: bool = true;
+ const ONLY_HOSTS: bool = true;
+
+ fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
+ run.alias("tidyselftest")
+ }
+
+ fn make_run(run: RunConfig<'_>) {
+ run.builder.ensure(TidySelfTest);
+ }
+
+ fn run(self, builder: &Builder<'_>) {
+ let bootstrap_host = builder.config.build;
+ let compiler = builder.compiler(0, bootstrap_host);
+ let cargo = tool::prepare_tool_cargo(
+ builder,
+ compiler,
+ Mode::ToolBootstrap,
+ bootstrap_host,
+ "test",
+ "src/tools/tidy",
+ SourceType::InTree,
+ &[],
+ );
+ try_run(builder, &mut cargo.into());
+ }
+}
+
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub struct ExpandYamlAnchors;
@@ -1273,59 +1310,51 @@ macro_rules! test_definitions {
};
}
-default_test!(Ui { path: "src/test/ui", mode: "ui", suite: "ui" });
+default_test!(Ui { path: "tests/ui", mode: "ui", suite: "ui" });
default_test!(RunPassValgrind {
- path: "src/test/run-pass-valgrind",
+ path: "tests/run-pass-valgrind",
mode: "run-pass-valgrind",
suite: "run-pass-valgrind"
});
-default_test!(MirOpt { path: "src/test/mir-opt", mode: "mir-opt", suite: "mir-opt" });
+default_test!(MirOpt { path: "tests/mir-opt", mode: "mir-opt", suite: "mir-opt" });
-default_test!(Codegen { path: "src/test/codegen", mode: "codegen", suite: "codegen" });
+default_test!(Codegen { path: "tests/codegen", mode: "codegen", suite: "codegen" });
default_test!(CodegenUnits {
- path: "src/test/codegen-units",
+ path: "tests/codegen-units",
mode: "codegen-units",
suite: "codegen-units"
});
-default_test!(Incremental {
- path: "src/test/incremental",
- mode: "incremental",
- suite: "incremental"
-});
+default_test!(Incremental { path: "tests/incremental", mode: "incremental", suite: "incremental" });
default_test_with_compare_mode!(Debuginfo {
- path: "src/test/debuginfo",
+ path: "tests/debuginfo",
mode: "debuginfo",
suite: "debuginfo",
compare_mode: "split-dwarf"
});
-host_test!(UiFullDeps { path: "src/test/ui-fulldeps", mode: "ui", suite: "ui-fulldeps" });
+host_test!(UiFullDeps { path: "tests/ui-fulldeps", mode: "ui", suite: "ui-fulldeps" });
-host_test!(Rustdoc { path: "src/test/rustdoc", mode: "rustdoc", suite: "rustdoc" });
-host_test!(RustdocUi { path: "src/test/rustdoc-ui", mode: "ui", suite: "rustdoc-ui" });
+host_test!(Rustdoc { path: "tests/rustdoc", mode: "rustdoc", suite: "rustdoc" });
+host_test!(RustdocUi { path: "tests/rustdoc-ui", mode: "ui", suite: "rustdoc-ui" });
-host_test!(RustdocJson {
- path: "src/test/rustdoc-json",
- mode: "rustdoc-json",
- suite: "rustdoc-json"
-});
+host_test!(RustdocJson { path: "tests/rustdoc-json", mode: "rustdoc-json", suite: "rustdoc-json" });
-host_test!(Pretty { path: "src/test/pretty", mode: "pretty", suite: "pretty" });
+host_test!(Pretty { path: "tests/pretty", mode: "pretty", suite: "pretty" });
-default_test!(RunMake { path: "src/test/run-make", mode: "run-make", suite: "run-make" });
+default_test!(RunMake { path: "tests/run-make", mode: "run-make", suite: "run-make" });
host_test!(RunMakeFullDeps {
- path: "src/test/run-make-fulldeps",
+ path: "tests/run-make-fulldeps",
mode: "run-make",
suite: "run-make-fulldeps"
});
-default_test!(Assembly { path: "src/test/assembly", mode: "assembly", suite: "assembly" });
+default_test!(Assembly { path: "tests/assembly", mode: "assembly", suite: "assembly" });
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
struct Compiletest {
@@ -1437,7 +1466,7 @@ note: if you're sure you want to do this, please open an issue as to why. In the
cmd.arg("--rust-demangler-path").arg(rust_demangler);
}
- cmd.arg("--src-base").arg(builder.src.join("src/test").join(suite));
+ cmd.arg("--src-base").arg(builder.src.join("tests").join(suite));
cmd.arg("--build-base").arg(testdir(builder, compiler.host).join(suite));
cmd.arg("--sysroot-base").arg(builder.sysroot(compiler));
cmd.arg("--stage-id").arg(format!("stage{}-{}", compiler.stage, target));
@@ -1575,7 +1604,8 @@ note: if you're sure you want to do this, please open an issue as to why. In the
let mut llvm_components_passed = false;
let mut copts_passed = false;
if builder.config.llvm_enabled() {
- let llvm_config = builder.ensure(native::Llvm { target: builder.config.build });
+ let native::LlvmResult { llvm_config, .. } =
+ builder.ensure(native::Llvm { target: builder.config.build });
if !builder.config.dry_run() {
let llvm_version = output(Command::new(&llvm_config).arg("--version"));
let llvm_components = output(Command::new(&llvm_config).arg("--components"));
@@ -1900,7 +1930,7 @@ impl Step for ErrorIndex {
fn make_run(run: RunConfig<'_>) {
// error_index_generator depends on librustdoc. Use the compiler that
// is normally used to build rustdoc for other tests (like compiletest
- // tests in src/test/rustdoc) so that it shares the same artifacts.
+ // tests in tests/rustdoc) so that it shares the same artifacts.
let compiler = run.builder.compiler(run.builder.top_stage, run.builder.config.build);
run.builder.ensure(ErrorIndex { compiler });
}
@@ -2153,8 +2183,12 @@ impl Step for Crate {
}
builder.info(&format!(
- "{} {:?} stage{} ({} -> {})",
- test_kind, self.crates, compiler.stage, &compiler.host, target
+ "{}{} stage{} ({} -> {})",
+ test_kind,
+ crate_description(&self.crates),
+ compiler.stage,
+ &compiler.host,
+ target
));
let _time = util::timeit(&builder);
try_run(builder, &mut cargo.into());
@@ -2193,7 +2227,7 @@ impl Step for CrateRustdoc {
builder.compiler(builder.top_stage, target)
} else {
// Use the previous stage compiler to reuse the artifacts that are
- // created when running compiletest for src/test/rustdoc. If this used
+ // created when running compiletest for tests/rustdoc. If this used
// `compiler`, then it would cause rustdoc to be built *again*, which
// isn't really necessary.
builder.compiler_for(builder.top_stage, target, target)
@@ -2309,7 +2343,7 @@ impl Step for CrateRustdocJsonTypes {
let target = self.host;
// Use the previous stage compiler to reuse the artifacts that are
- // created when running compiletest for src/test/rustdoc. If this used
+ // created when running compiletest for tests/rustdoc. If this used
// `compiler`, then it would cause rustdoc to be built *again*, which
// isn't really necessary.
let compiler = builder.compiler_for(builder.top_stage, target, target);