Skip to content

bootstrap: Apply a clearer naming convention to many of the test steps #135071

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/bootstrap/src/core/build_steps/compile.rs
Original file line number Diff line number Diff line change
@@ -627,7 +627,7 @@ impl Step for StdLink {
let target_compiler = self.target_compiler;
let target = self.target;

// NOTE: intentionally does *not* check `target == builder.build` to avoid having to add the same check in `test::Crate`.
// NOTE: intentionally does *not* check `target == builder.build` to avoid having to add the same check in `test::SelftestLibraryOrOtherCrate`.
let (libdir, hostdir) = if self.force_recompile && builder.download_rustc() {
// NOTE: copies part of `sysroot_libdir` to avoid having to add a new `force_recompile` argument there too
let lib = builder.sysroot_libdir_relative(self.compiler);
4 changes: 2 additions & 2 deletions src/bootstrap/src/core/build_steps/run.rs
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@ use std::path::PathBuf;

use crate::Mode;
use crate::core::build_steps::dist::distdir;
use crate::core::build_steps::test;
use crate::core::build_steps::test::build_miri_sysroot;
use crate::core::build_steps::tool::{self, SourceType, Tool};
use crate::core::builder::{Builder, Kind, RunConfig, ShouldRun, Step};
use crate::core::config::TargetSelection;
@@ -132,7 +132,7 @@ impl Step for Miri {
let host_compiler = builder.compiler(stage - 1, host);

// Get a target sysroot for Miri.
let miri_sysroot = test::Miri::build_miri_sysroot(builder, target_compiler, target);
let miri_sysroot = build_miri_sysroot(builder, target_compiler, target);

// # Run miri.
// Running it via `cargo run` as that figures out the right dylib path.
315 changes: 167 additions & 148 deletions src/bootstrap/src/core/build_steps/test.rs

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions src/bootstrap/src/core/builder/cargo.rs
Original file line number Diff line number Diff line change
@@ -3,8 +3,9 @@ use std::ffi::{OsStr, OsString};
use std::path::{Path, PathBuf};

use super::{Builder, Kind};
use crate::core::build_steps::compile;
use crate::core::build_steps::test::build_miri_sysroot;
use crate::core::build_steps::tool::SourceType;
use crate::core::build_steps::{compile, test};
use crate::core::config::SplitDebuginfo;
use crate::core::config::flags::Color;
use crate::utils::helpers::{
@@ -808,7 +809,7 @@ impl Builder<'_> {
if cmd_kind == Kind::MiriTest {
self.ensure(compile::Std::new(compiler, compiler.host));
let host_sysroot = self.sysroot(compiler);
let miri_sysroot = test::Miri::build_miri_sysroot(self, compiler, target);
let miri_sysroot = build_miri_sysroot(self, compiler, target);
cargo.env("MIRI_SYSROOT", &miri_sysroot);
cargo.env("MIRI_HOST_SYSROOT", &host_sysroot);
}
104 changes: 53 additions & 51 deletions src/bootstrap/src/core/builder/mod.rs
Original file line number Diff line number Diff line change
@@ -705,8 +705,8 @@ impl<'a> ShouldRun<'a> {
/// removing the matches from `paths`.
///
/// NOTE: this returns multiple PathSets to allow for the possibility of multiple units of work
/// within the same step. For example, `test::Crate` allows testing multiple crates in the same
/// cargo invocation, which are put into separate sets because they aren't aliases.
/// within the same step. For example, `test::SelftestLibraryOrOtherCrate` allows testing multiple
/// crates in the same cargo invocation, which are put into separate sets because they aren't aliases.
///
/// The reason we return PathSet instead of PathBuf is to allow for aliases that mean the same thing
/// (for now, just `all_krates` and `paths`, but we may want to add an `aliases` function in the future?)
@@ -939,70 +939,72 @@ impl<'a> Builder<'a> {
),
Kind::Test => describe!(
crate::core::build_steps::toolstate::ToolStateCheck,
test::Tidy,
test::Ui,
test::Crashes,
test::Coverage,
test::CoverageMap,
test::CoverageRun,
test::MirOpt,
test::Codegen,
test::CodegenUnits,
test::Assembly,
test::Incremental,
test::Debuginfo,
test::UiFullDeps,
test::Rustdoc,
test::CoverageRunRustdoc,
test::Pretty,
test::CodegenCranelift,
test::CodegenGCC,
test::Crate,
test::CrateLibrustc,
test::CrateRustdoc,
test::CrateRustdocJsonTypes,
test::CrateBootstrap,
test::InvokeTidy,
test::SuiteUi,
test::SuiteCrashes,
test::SuiteCoverage,
test::SuiteCoverageMap,
test::SuiteCoverageRun,
test::SuiteMirOpt,
test::SuiteCodegen,
test::SuiteCodegenUnits,
test::SuiteAssembly,
test::SuiteIncremental,
test::SuiteDebuginfo,
test::SuiteUiFullDeps,
test::SuiteRustdoc,
test::SuiteCoverageRunRustdoc,
test::SuitePretty,
test::SelftestCodegenCranelift,
test::SelftestCodegenGCC,
test::SelftestLibraryOrOtherCrates,
test::SelftestCompilerCrates,
test::SelftestRustdoc,
test::SelftestRustdocJsonTypes,
test::SelftestMiscBootstrapTools,
test::Linkcheck,
test::TierCheck,
test::Cargotest,
test::Cargo,
test::RustAnalyzer,
test::SelftestCargo,
test::SelftestRustAnalyzer,
test::ErrorIndex,
test::Distcheck,
test::Nomicon,
test::Reference,
test::RustdocBook,
test::RustByExample,
test::TheBook,
test::UnstableBook,
test::RustcBook,
test::BooktestNomicon,
test::BooktestReference,
test::BooktestRustdocBook,
test::BooktestRustByExample,
test::BooktestTheBook,
test::BooktestUnstableBook,
test::BooktestRustcBook,
test::LintDocs,
test::EmbeddedBook,
test::EditionGuide,
test::Rustfmt,
test::Miri,
test::BooktestEmbeddedBook,
test::BooktestEditionGuide,
test::SelftestRustfmt,
test::SelftestMiri,
test::CargoMiri,
test::Clippy,
test::CompiletestTest,
test::CrateRunMakeSupport,
test::CrateBuildHelper,
test::RustdocJSStd,
test::RustdocJSNotStd,
test::RustdocGUI,
test::SelftestClippy,
test::SelftestCompiletest,
test::SelftestRunMakeSupport,
test::SelftestBuildHelper,
test::SuiteRustdocJSStd,
test::SuiteRustdocJSNotStd,
test::SuiteRustdocGUI,
test::RustdocTheme,
test::RustdocUi,
test::RustdocJson,
test::SuiteRustdocUi,
test::SuiteRustdocJson,
test::HtmlCheck,
test::RustInstaller,
test::TestFloatParse,
test::CollectLicenseMetadata,
// Run bootstrap close to the end as it's unlikely to fail
test::Bootstrap,
test::SelftestBootstrap,
// Run run-make last, since these won't pass without make on Windows
test::RunMake,
test::SuiteRunMake,
),
Kind::Miri => describe!(test::Crate),
Kind::Bench => describe!(test::Crate, test::CrateLibrustc),
Kind::Miri => describe!(test::SelftestLibraryOrOtherCrates),
Kind::Bench => {
describe!(test::SelftestLibraryOrOtherCrates, test::SelftestCompilerCrates)
}
Kind::Doc => describe!(
doc::UnstableBook,
doc::UnstableBookGen,
35 changes: 19 additions & 16 deletions src/bootstrap/src/core/builder/tests.rs
Original file line number Diff line number Diff line change
@@ -185,10 +185,10 @@ fn test_exclude() {
let cache = run_build(&[], config);

// Ensure we have really excluded tidy
assert!(!cache.contains::<test::Tidy>());
assert!(!cache.contains::<test::InvokeTidy>());

// Ensure other tests are not affected.
assert!(cache.contains::<test::RustdocUi>());
assert!(cache.contains::<test::SuiteRustdocUi>());
}

#[test]
@@ -197,10 +197,10 @@ fn test_exclude_kind() {

let mut config = configure("test", &[TEST_TRIPLE_1], &[TEST_TRIPLE_1]);
// Ensure our test is valid, and `test::Rustc` would be run without the exclude.
assert!(run_build(&[], config.clone()).contains::<test::CrateLibrustc>());
assert!(run_build(&[], config.clone()).contains::<test::SelftestCompilerCrates>());
// Ensure tests for rustc are not skipped.
config.skip = vec![path.clone()];
assert!(run_build(&[], config.clone()).contains::<test::CrateLibrustc>());
assert!(run_build(&[], config.clone()).contains::<test::SelftestCompilerCrates>());
// Ensure builds for rustc are not skipped.
assert!(run_build(&[], config).contains::<compile::Rustc>());
}
@@ -669,18 +669,21 @@ mod dist {

let host = TargetSelection::from_user(TEST_TRIPLE_1);

builder.run_step_descriptions(&[StepDescription::from::<test::Crate>(Kind::Test)], &[
"library/std".into(),
]);
builder.run_step_descriptions(
&[StepDescription::from::<test::SelftestLibraryOrOtherCrates>(Kind::Test)],
&["library/std".into()],
);

// Ensure we don't build any compiler artifacts.
assert!(!builder.cache.contains::<compile::Rustc>());
assert_eq!(first(builder.cache.all::<test::Crate>()), &[test::Crate {
compiler: Compiler { host, stage: 0 },
target: host,
mode: crate::Mode::Std,
crates: vec!["std".to_owned()],
},]);
assert_eq!(first(builder.cache.all::<test::SelftestLibraryOrOtherCrates>()), &[
test::SelftestLibraryOrOtherCrates {
compiler: Compiler { host, stage: 0 },
target: host,
mode: crate::Mode::Std,
crates: vec!["std".to_owned()],
},
]);
}

#[test]
@@ -822,9 +825,9 @@ fn test_test_compiler() {
let config = configure_with_args(cmd, &[TEST_TRIPLE_1], &[TEST_TRIPLE_1]);
let cache = run_build(&config.paths.clone(), config);

let compiler = cache.contains::<test::CrateLibrustc>();
let cranelift = cache.contains::<test::CodegenCranelift>();
let gcc = cache.contains::<test::CodegenGCC>();
let compiler = cache.contains::<test::SelftestCompilerCrates>();
let cranelift = cache.contains::<test::SelftestCodegenCranelift>();
let gcc = cache.contains::<test::SelftestCodegenGCC>();

assert_eq!((compiler, cranelift, gcc), (true, false, false));
}