mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-30 14:52:56 +03:00
Add snapshot tests for checking compiler, library and rustc tools
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
};
|
||||
use crate::core::build_steps::tool::{COMPILETEST_ALLOW_FEATURES, SourceType, prepare_tool_cargo};
|
||||
use crate::core::builder::{
|
||||
self, Alias, Builder, Kind, RunConfig, ShouldRun, Step, crate_description,
|
||||
self, Alias, Builder, Kind, RunConfig, ShouldRun, Step, StepMetadata, crate_description,
|
||||
};
|
||||
use crate::core::config::TargetSelection;
|
||||
use crate::utils::build_stamp::{self, BuildStamp};
|
||||
@@ -167,6 +167,10 @@ fn run(self, builder: &Builder<'_>) {
|
||||
let _guard = builder.msg_check("library test/bench/example targets", target, Some(stage));
|
||||
run_cargo(builder, cargo, builder.config.free_args.clone(), &stamp, vec![], true, false);
|
||||
}
|
||||
|
||||
fn metadata(&self) -> Option<StepMetadata> {
|
||||
Some(StepMetadata::check("std", self.target))
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||
@@ -258,6 +262,10 @@ fn run(self, builder: &Builder<'_>) {
|
||||
let hostdir = builder.sysroot_target_libdir(compiler, compiler.host);
|
||||
add_to_sysroot(builder, &libdir, &hostdir, &stamp);
|
||||
}
|
||||
|
||||
fn metadata(&self) -> Option<StepMetadata> {
|
||||
Some(StepMetadata::check("rustc", self.target))
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||
@@ -467,6 +475,10 @@ fn run(self, builder: &Builder<'_>) {
|
||||
let Self { target } = self;
|
||||
run_tool_check_step(builder, target, stringify!($name), $path);
|
||||
}
|
||||
|
||||
fn metadata(&self) -> Option<StepMetadata> {
|
||||
Some(StepMetadata::check(stringify!($name), self.target))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -153,6 +153,10 @@ pub fn build(name: &'static str, target: TargetSelection) -> Self {
|
||||
Self::new(name, target, Kind::Build)
|
||||
}
|
||||
|
||||
pub fn check(name: &'static str, target: TargetSelection) -> Self {
|
||||
Self::new(name, target, Kind::Check)
|
||||
}
|
||||
|
||||
pub fn doc(name: &'static str, target: TargetSelection) -> Self {
|
||||
Self::new(name, target, Kind::Doc)
|
||||
}
|
||||
|
||||
@@ -1233,6 +1233,171 @@ fn dist_all_cross() {
|
||||
");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn check_compiler_no_explicit_stage() {
|
||||
let ctx = TestCtx::new();
|
||||
insta::assert_snapshot!(
|
||||
ctx.config("check")
|
||||
.path("compiler")
|
||||
.render_steps(), @r"
|
||||
[check] std <host>
|
||||
[build] llvm <host>
|
||||
[check] rustc <host>
|
||||
");
|
||||
|
||||
insta::assert_snapshot!(
|
||||
ctx.config("check")
|
||||
.path("rustc")
|
||||
.render_steps(), @r"
|
||||
[build] llvm <host>
|
||||
[check] rustc 0 <host> -> rustc 1 <host>
|
||||
");
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[should_panic]
|
||||
fn check_compiler_stage_0() {
|
||||
let ctx = TestCtx::new();
|
||||
ctx.config("check").path("compiler").stage(0).run();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn check_compiler_stage_1() {
|
||||
let ctx = TestCtx::new();
|
||||
insta::assert_snapshot!(
|
||||
ctx.config("check")
|
||||
.path("compiler")
|
||||
.stage(1)
|
||||
.render_steps(), @r"
|
||||
[build] llvm <host>
|
||||
[build] rustc 0 <host> -> rustc 1 <host>
|
||||
[build] rustc 1 <host> -> std 1 <host>
|
||||
[check] rustc <host>
|
||||
");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn check_compiler_stage_2() {
|
||||
let ctx = TestCtx::new();
|
||||
insta::assert_snapshot!(
|
||||
ctx.config("check")
|
||||
.path("compiler")
|
||||
.stage(2)
|
||||
.render_steps(), @r"
|
||||
[build] llvm <host>
|
||||
[build] rustc 0 <host> -> rustc 1 <host>
|
||||
[build] rustc 1 <host> -> std 1 <host>
|
||||
[build] rustc 1 <host> -> rustc 2 <host>
|
||||
[build] rustc 2 <host> -> std 2 <host>
|
||||
[check] rustc <host>
|
||||
");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn check_library_no_explicit_stage() {
|
||||
let ctx = TestCtx::new();
|
||||
insta::assert_snapshot!(
|
||||
ctx.config("check")
|
||||
.path("library")
|
||||
.render_steps(), @r"
|
||||
[build] llvm <host>
|
||||
[build] rustc 0 <host> -> rustc 1 <host>
|
||||
[check] std <host>
|
||||
");
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[should_panic]
|
||||
fn check_library_stage_0() {
|
||||
let ctx = TestCtx::new();
|
||||
ctx.config("check").path("library").stage(0).run();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn check_library_stage_1() {
|
||||
let ctx = TestCtx::new();
|
||||
insta::assert_snapshot!(
|
||||
ctx.config("check")
|
||||
.path("library")
|
||||
.stage(1)
|
||||
.render_steps(), @r"
|
||||
[build] llvm <host>
|
||||
[build] rustc 0 <host> -> rustc 1 <host>
|
||||
[check] std <host>
|
||||
");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn check_library_stage_2() {
|
||||
let ctx = TestCtx::new();
|
||||
insta::assert_snapshot!(
|
||||
ctx.config("check")
|
||||
.path("library")
|
||||
.stage(2)
|
||||
.render_steps(), @r"
|
||||
[build] llvm <host>
|
||||
[build] rustc 0 <host> -> rustc 1 <host>
|
||||
[build] rustc 1 <host> -> std 1 <host>
|
||||
[build] rustc 1 <host> -> rustc 2 <host>
|
||||
[check] std <host>
|
||||
");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn check_miri_no_explicit_stage() {
|
||||
let ctx = TestCtx::new();
|
||||
insta::assert_snapshot!(
|
||||
ctx.config("check")
|
||||
.path("miri")
|
||||
.render_steps(), @r"
|
||||
[check] std <host>
|
||||
[build] llvm <host>
|
||||
[check] rustc <host>
|
||||
[check] Miri <host>
|
||||
");
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[should_panic]
|
||||
fn check_miri_stage_0() {
|
||||
let ctx = TestCtx::new();
|
||||
ctx.config("check").path("miri").stage(0).run();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn check_miri_stage_1() {
|
||||
let ctx = TestCtx::new();
|
||||
insta::assert_snapshot!(
|
||||
ctx.config("check")
|
||||
.path("miri")
|
||||
.stage(1)
|
||||
.render_steps(), @r"
|
||||
[build] llvm <host>
|
||||
[build] rustc 0 <host> -> rustc 1 <host>
|
||||
[build] rustc 1 <host> -> std 1 <host>
|
||||
[check] rustc <host>
|
||||
[check] Miri <host>
|
||||
");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn check_miri_stage_2() {
|
||||
let ctx = TestCtx::new();
|
||||
insta::assert_snapshot!(
|
||||
ctx.config("check")
|
||||
.path("miri")
|
||||
.stage(2)
|
||||
.render_steps(), @r"
|
||||
[build] llvm <host>
|
||||
[build] rustc 0 <host> -> rustc 1 <host>
|
||||
[build] rustc 1 <host> -> std 1 <host>
|
||||
[build] rustc 1 <host> -> rustc 2 <host>
|
||||
[build] rustc 2 <host> -> std 2 <host>
|
||||
[check] rustc <host>
|
||||
[check] Miri <host>
|
||||
");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_exclude() {
|
||||
let ctx = TestCtx::new();
|
||||
|
||||
Reference in New Issue
Block a user