Port more tests to snapshot tests
This commit is contained in:
parent
809f75058e
commit
62639c9b56
7 changed files with 615 additions and 648 deletions
|
|
@ -23,7 +23,7 @@ use crate::core::build_steps::doc::DocumentationFormat;
|
|||
use crate::core::build_steps::tool::{self, Tool};
|
||||
use crate::core::build_steps::vendor::{VENDOR_DIR, Vendor};
|
||||
use crate::core::build_steps::{compile, llvm};
|
||||
use crate::core::builder::{Builder, Kind, RunConfig, ShouldRun, Step};
|
||||
use crate::core::builder::{Builder, Kind, RunConfig, ShouldRun, Step, StepMetadata};
|
||||
use crate::core::config::TargetSelection;
|
||||
use crate::utils::build_stamp::{self, BuildStamp};
|
||||
use crate::utils::channel::{self, Info};
|
||||
|
|
@ -84,6 +84,10 @@ impl Step for Docs {
|
|||
tarball.add_file(builder.src.join("src/doc/robots.txt"), dest, FileType::Regular);
|
||||
Some(tarball.generate())
|
||||
}
|
||||
|
||||
fn metadata(&self) -> Option<StepMetadata> {
|
||||
Some(StepMetadata::dist("docs", self.host))
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialOrd, Ord, Clone, Hash, PartialEq, Eq)]
|
||||
|
|
@ -354,6 +358,10 @@ impl Step for Mingw {
|
|||
|
||||
Some(tarball.generate())
|
||||
}
|
||||
|
||||
fn metadata(&self) -> Option<StepMetadata> {
|
||||
Some(StepMetadata::dist("mingw", self.host))
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialOrd, Ord, Clone, Hash, PartialEq, Eq)]
|
||||
|
|
@ -540,6 +548,10 @@ impl Step for Rustc {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn metadata(&self) -> Option<StepMetadata> {
|
||||
Some(StepMetadata::dist("rustc", self.compiler.host))
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Hash, PartialEq, Eq)]
|
||||
|
|
@ -723,6 +735,10 @@ impl Step for Std {
|
|||
|
||||
Some(tarball.generate())
|
||||
}
|
||||
|
||||
fn metadata(&self) -> Option<StepMetadata> {
|
||||
Some(StepMetadata::dist("std", self.target).built_by(self.compiler))
|
||||
}
|
||||
}
|
||||
|
||||
/// Tarball containing the compiler that gets downloaded and used by
|
||||
|
|
@ -1002,6 +1018,10 @@ impl Step for Src {
|
|||
|
||||
tarball.generate()
|
||||
}
|
||||
|
||||
fn metadata(&self) -> Option<StepMetadata> {
|
||||
Some(StepMetadata::dist("src", TargetSelection::default()))
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialOrd, Ord, Clone, Hash, PartialEq, Eq)]
|
||||
|
|
|
|||
|
|
@ -14,7 +14,8 @@ use std::{env, fs, mem};
|
|||
use crate::core::build_steps::compile;
|
||||
use crate::core::build_steps::tool::{self, SourceType, Tool, prepare_tool_cargo};
|
||||
use crate::core::builder::{
|
||||
self, Alias, Builder, Compiler, Kind, RunConfig, ShouldRun, Step, crate_description,
|
||||
self, Alias, Builder, Compiler, Kind, RunConfig, ShouldRun, Step, StepMetadata,
|
||||
crate_description,
|
||||
};
|
||||
use crate::core::config::{Config, TargetSelection};
|
||||
use crate::helpers::{submodule_path_of, symlink_dir, t, up_to_date};
|
||||
|
|
@ -662,6 +663,10 @@ impl Step for Std {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn metadata(&self) -> Option<StepMetadata> {
|
||||
Some(StepMetadata::doc("std", self.target).stage(self.stage))
|
||||
}
|
||||
}
|
||||
|
||||
/// Name of the crates that are visible to consumers of the standard library.
|
||||
|
|
|
|||
|
|
@ -19,7 +19,8 @@ use crate::core::build_steps::tool::{self, COMPILETEST_ALLOW_FEATURES, SourceTyp
|
|||
use crate::core::build_steps::toolstate::ToolState;
|
||||
use crate::core::build_steps::{compile, dist, llvm};
|
||||
use crate::core::builder::{
|
||||
self, Alias, Builder, Compiler, Kind, RunConfig, ShouldRun, Step, crate_description,
|
||||
self, Alias, Builder, Compiler, Kind, RunConfig, ShouldRun, Step, StepMetadata,
|
||||
crate_description,
|
||||
};
|
||||
use crate::core::config::TargetSelection;
|
||||
use crate::core::config::flags::{Subcommand, get_completion};
|
||||
|
|
@ -1174,6 +1175,10 @@ HELP: to skip test's attempt to check tidiness, pass `--skip src/tools/tidy` to
|
|||
fn make_run(run: RunConfig<'_>) {
|
||||
run.builder.ensure(Tidy);
|
||||
}
|
||||
|
||||
fn metadata(&self) -> Option<StepMetadata> {
|
||||
Some(StepMetadata::test("tidy", TargetSelection::default()))
|
||||
}
|
||||
}
|
||||
|
||||
fn testdir(builder: &Builder<'_>, host: TargetSelection) -> PathBuf {
|
||||
|
|
@ -1236,6 +1241,12 @@ macro_rules! test {
|
|||
}),
|
||||
})
|
||||
}
|
||||
|
||||
fn metadata(&self) -> Option<StepMetadata> {
|
||||
Some(
|
||||
StepMetadata::test(stringify!($name), self.target)
|
||||
)
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
@ -2483,6 +2494,10 @@ impl Step for CrateLibrustc {
|
|||
crates: self.crates,
|
||||
});
|
||||
}
|
||||
|
||||
fn metadata(&self) -> Option<StepMetadata> {
|
||||
Some(StepMetadata::test("CrateLibrustc", self.target))
|
||||
}
|
||||
}
|
||||
|
||||
/// Given a `cargo test` subcommand, add the appropriate flags and run it.
|
||||
|
|
|
|||
|
|
@ -786,6 +786,16 @@ impl Step for Rustdoc {
|
|||
ToolBuildResult { tool_path, build_compiler, target_compiler }
|
||||
}
|
||||
}
|
||||
|
||||
fn metadata(&self) -> Option<StepMetadata> {
|
||||
Some(
|
||||
StepMetadata::build("rustdoc", self.compiler.host)
|
||||
// rustdoc is ToolRustc, so stage N rustdoc is built by stage N-1 rustc
|
||||
// FIXME: make this stage deduction automatic somehow
|
||||
// FIXME: log the compiler that actually built ToolRustc steps
|
||||
.stage(self.compiler.stage.saturating_sub(1)),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Hash, PartialEq, Eq)]
|
||||
|
|
|
|||
|
|
@ -140,7 +140,7 @@ pub trait Step: 'static + Clone + Debug + PartialEq + Eq + Hash {
|
|||
|
||||
/// Metadata that describes an executed step, mostly for testing and tracing.
|
||||
#[allow(unused)]
|
||||
#[derive(Debug)]
|
||||
#[derive(Debug, PartialEq, Eq)]
|
||||
pub struct StepMetadata {
|
||||
name: &'static str,
|
||||
kind: Kind,
|
||||
|
|
@ -151,7 +151,23 @@ pub struct StepMetadata {
|
|||
|
||||
impl StepMetadata {
|
||||
pub fn build(name: &'static str, target: TargetSelection) -> Self {
|
||||
Self { name, kind: Kind::Build, target, built_by: None, stage: None }
|
||||
Self::new(name, target, Kind::Build)
|
||||
}
|
||||
|
||||
pub fn doc(name: &'static str, target: TargetSelection) -> Self {
|
||||
Self::new(name, target, Kind::Doc)
|
||||
}
|
||||
|
||||
pub fn dist(name: &'static str, target: TargetSelection) -> Self {
|
||||
Self::new(name, target, Kind::Dist)
|
||||
}
|
||||
|
||||
pub fn test(name: &'static str, target: TargetSelection) -> Self {
|
||||
Self::new(name, target, Kind::Test)
|
||||
}
|
||||
|
||||
fn new(name: &'static str, target: TargetSelection, kind: Kind) -> Self {
|
||||
Self { name, kind, target, built_by: None, stage: None }
|
||||
}
|
||||
|
||||
pub fn built_by(mut self, compiler: Compiler) -> Self {
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -51,12 +51,38 @@ impl ConfigBuilder {
|
|||
self
|
||||
}
|
||||
|
||||
pub fn paths(mut self, paths: &[&str]) -> Self {
|
||||
for path in paths {
|
||||
self = self.path(path);
|
||||
}
|
||||
self
|
||||
}
|
||||
|
||||
pub fn hosts(mut self, targets: &[&str]) -> Self {
|
||||
self.args.push("--host".to_string());
|
||||
self.args.push(targets.join(","));
|
||||
self
|
||||
}
|
||||
|
||||
pub fn targets(mut self, targets: &[&str]) -> Self {
|
||||
self.args.push("--target".to_string());
|
||||
self.args.push(targets.join(","));
|
||||
self
|
||||
}
|
||||
|
||||
pub fn stage(mut self, stage: u32) -> Self {
|
||||
self.args.push("--stage".to_string());
|
||||
self.args.push(stage.to_string());
|
||||
self
|
||||
}
|
||||
|
||||
pub fn args(mut self, args: &[&str]) -> Self {
|
||||
for arg in args {
|
||||
self.args.push(arg.to_string());
|
||||
}
|
||||
self
|
||||
}
|
||||
|
||||
pub fn create_config(mut self) -> Config {
|
||||
// Run in dry-check, otherwise the test would be too slow
|
||||
self.args.push("--dry-run".to_string());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue