Skip to content

Commit 23bb607

Browse files
committed
Add more tests
1 parent 87d92ee commit 23bb607

File tree

2 files changed

+83
-9
lines changed

2 files changed

+83
-9
lines changed

src/bootstrap/src/core/build_steps/clippy.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,7 @@ macro_rules! lint_any {
447447
}
448448

449449
fn metadata(&self) -> Option<StepMetadata> {
450-
Some(StepMetadata::clippy($readable_name, self.target))
450+
Some(StepMetadata::clippy($readable_name, self.target).built_by(self.build_compiler))
451451
}
452452
}
453453
)+

src/bootstrap/src/core/builder/tests.rs

Lines changed: 82 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2073,12 +2073,11 @@ mod snapshot {
20732073
ctx.config("clippy")
20742074
.path("ci")
20752075
.render_steps(), @r"
2076+
[clippy] rustc 0 <host> -> bootstrap 1 <host>
20762077
[build] llvm <host>
20772078
[build] rustc 0 <host> -> rustc 1 <host>
2078-
[check] rustc 1 <host> -> rustc 2 <host>
20792079
[build] rustc 0 <host> -> clippy-driver 1 <host>
20802080
[build] rustc 0 <host> -> cargo-clippy 1 <host>
2081-
[clippy] bootstrap <host>
20822081
[clippy] rustc 1 <host> -> std 1 <host>
20832082
[clippy] rustc 0 <host> -> rustc 1 <host>
20842083
[clippy] rustc 0 <host> -> rustc_codegen_gcc 1 <host>
@@ -2096,21 +2095,20 @@ mod snapshot {
20962095
[build] llvm <host>
20972096
[build] rustc 0 <host> -> rustc 1 <host>
20982097
[build] rustc 1 <host> -> std 1 <host>
2098+
[build] rustc 0 <host> -> clippy-driver 1 <host>
2099+
[build] rustc 0 <host> -> cargo-clippy 1 <host>
2100+
[clippy] rustc 1 <host> -> bootstrap 2 <host>
20992101
[build] rustc 1 <host> -> rustc 2 <host>
2100-
[check] rustc 2 <host> -> rustc 3 <host>
21012102
[build] rustc 1 <host> -> clippy-driver 2 <host>
21022103
[build] rustc 1 <host> -> cargo-clippy 2 <host>
2103-
[clippy] bootstrap <host>
21042104
[clippy] rustc 2 <host> -> std 2 <host>
2105-
[build] rustc 0 <host> -> clippy-driver 1 <host>
2106-
[build] rustc 0 <host> -> cargo-clippy 1 <host>
21072105
[clippy] rustc 1 <host> -> rustc 2 <host>
21082106
[clippy] rustc 1 <host> -> rustc_codegen_gcc 2 <host>
21092107
");
21102108
}
21112109

21122110
#[test]
2113-
fn clippy_compiler() {
2111+
fn clippy_compiler_stage1() {
21142112
let ctx = TestCtx::new();
21152113
insta::assert_snapshot!(
21162114
ctx.config("clippy")
@@ -2122,7 +2120,24 @@ mod snapshot {
21222120
}
21232121

21242122
#[test]
2125-
fn clippy_std() {
2123+
fn clippy_compiler_stage2() {
2124+
let ctx = TestCtx::new();
2125+
insta::assert_snapshot!(
2126+
ctx.config("clippy")
2127+
.path("compiler")
2128+
.stage(2)
2129+
.render_steps(), @r"
2130+
[build] llvm <host>
2131+
[build] rustc 0 <host> -> rustc 1 <host>
2132+
[build] rustc 1 <host> -> std 1 <host>
2133+
[build] rustc 0 <host> -> clippy-driver 1 <host>
2134+
[build] rustc 0 <host> -> cargo-clippy 1 <host>
2135+
[clippy] rustc 1 <host> -> rustc 2 <host>
2136+
");
2137+
}
2138+
2139+
#[test]
2140+
fn clippy_std_stage1() {
21262141
let ctx = TestCtx::new();
21272142
insta::assert_snapshot!(
21282143
ctx.config("clippy")
@@ -2135,6 +2150,65 @@ mod snapshot {
21352150
[clippy] rustc 1 <host> -> std 1 <host>
21362151
");
21372152
}
2153+
2154+
#[test]
2155+
fn clippy_std_stage2() {
2156+
let ctx = TestCtx::new();
2157+
insta::assert_snapshot!(
2158+
ctx.config("clippy")
2159+
.path("std")
2160+
.stage(2)
2161+
.render_steps(), @r"
2162+
[build] llvm <host>
2163+
[build] rustc 0 <host> -> rustc 1 <host>
2164+
[build] rustc 1 <host> -> std 1 <host>
2165+
[build] rustc 1 <host> -> rustc 2 <host>
2166+
[build] rustc 1 <host> -> clippy-driver 2 <host>
2167+
[build] rustc 1 <host> -> cargo-clippy 2 <host>
2168+
[clippy] rustc 2 <host> -> std 2 <host>
2169+
");
2170+
}
2171+
2172+
#[test]
2173+
fn clippy_miri_stage1() {
2174+
let ctx = TestCtx::new();
2175+
insta::assert_snapshot!(
2176+
ctx.config("clippy")
2177+
.path("miri")
2178+
.stage(1)
2179+
.render_steps(), @r"
2180+
[build] llvm <host>
2181+
[check] rustc 0 <host> -> rustc 1 <host>
2182+
[clippy] rustc 0 <host> -> miri 1 <host>
2183+
");
2184+
}
2185+
2186+
#[test]
2187+
fn clippy_miri_stage2() {
2188+
let ctx = TestCtx::new();
2189+
insta::assert_snapshot!(
2190+
ctx.config("clippy")
2191+
.path("miri")
2192+
.stage(2)
2193+
.render_steps(), @r"
2194+
[build] llvm <host>
2195+
[build] rustc 0 <host> -> rustc 1 <host>
2196+
[build] rustc 1 <host> -> std 1 <host>
2197+
[check] rustc 1 <host> -> rustc 2 <host>
2198+
[build] rustc 0 <host> -> clippy-driver 1 <host>
2199+
[build] rustc 0 <host> -> cargo-clippy 1 <host>
2200+
[clippy] rustc 1 <host> -> miri 2 <host>
2201+
");
2202+
}
2203+
2204+
#[test]
2205+
fn clippy_bootstrap() {
2206+
let ctx = TestCtx::new();
2207+
insta::assert_snapshot!(
2208+
ctx.config("clippy")
2209+
.path("bootstrap")
2210+
.render_steps(), @"[clippy] rustc 0 <host> -> bootstrap 1 <host>");
2211+
}
21382212
}
21392213

21402214
struct ExecutedSteps {

0 commit comments

Comments
 (0)