Skip to content

Commit 9c5baeb

Browse files
committed
Fix stage 1 compiler tests
1 parent 6b4b852 commit 9c5baeb

File tree

3 files changed

+43
-7
lines changed

3 files changed

+43
-7
lines changed

compiler/rustc_lint_defs/src/builtin.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2309,10 +2309,10 @@ declare_lint! {
23092309
/// ### Example
23102310
///
23112311
/// ```rust
2312-
/// #![feature(sanitize)]
2312+
/// #![cfg_attr(not(bootstrap), feature(sanitize))]
23132313
///
23142314
/// #[inline(always)]
2315-
/// #[sanitize(address = "off")]
2315+
/// #[cfg_attr(not(bootstrap), sanitize(address = "off"))]
23162316
/// fn x() {}
23172317
///
23182318
/// fn main() {
@@ -4832,7 +4832,8 @@ declare_lint! {
48324832
///
48334833
/// ### Example
48344834
///
4835-
/// ```rust,compile_fail
4835+
#[cfg_attr(not(bootstrap), doc = "```rust,compile_fail")]
4836+
#[cfg_attr(bootstrap, doc = "```rust")]
48364837
/// #![doc = in_root!()]
48374838
///
48384839
/// macro_rules! in_root { () => { "" } }

src/bootstrap/src/core/build_steps/test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2728,7 +2728,7 @@ impl Step for CrateLibrustc {
27282728
}
27292729

27302730
fn metadata(&self) -> Option<StepMetadata> {
2731-
Some(StepMetadata::test("CrateLibrustc", self.target))
2731+
Some(StepMetadata::test("CrateLibrustc", self.target).built_by(self.build_compiler))
27322732
}
27332733
}
27342734

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

Lines changed: 38 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1888,7 +1888,7 @@ mod snapshot {
18881888
[test] Pretty <host>
18891889
[build] rustc 1 <host> -> std 1 <host>
18901890
[build] rustc 0 <host> -> std 0 <host>
1891-
[test] CrateLibrustc <host>
1891+
[test] rustc 0 <host> -> CrateLibrustc 1 <host>
18921892
[build] rustc 1 <host> -> rustc 2 <host>
18931893
[test] crate-bootstrap <host> src/tools/coverage-dump
18941894
[test] crate-bootstrap <host> src/tools/jsondoclint
@@ -1938,6 +1938,40 @@ mod snapshot {
19381938
");
19391939
}
19401940

1941+
#[test]
1942+
fn test_compiler_stage_1() {
1943+
let ctx = TestCtx::new();
1944+
insta::assert_snapshot!(
1945+
ctx.config("test")
1946+
.path("compiler")
1947+
.stage(1)
1948+
.render_steps(), @r"
1949+
[build] llvm <host>
1950+
[build] rustc 0 <host> -> rustc 1 <host>
1951+
[build] rustc 0 <host> -> std 0 <host>
1952+
[build] rustdoc 0 <host>
1953+
[test] rustc 0 <host> -> CrateLibrustc 1 <host>
1954+
");
1955+
}
1956+
1957+
#[test]
1958+
fn test_compiler_stage_2() {
1959+
let ctx = TestCtx::new();
1960+
insta::assert_snapshot!(
1961+
ctx.config("test")
1962+
.path("compiler")
1963+
.stage(2)
1964+
.render_steps(), @r"
1965+
[build] llvm <host>
1966+
[build] rustc 0 <host> -> rustc 1 <host>
1967+
[build] rustc 1 <host> -> std 1 <host>
1968+
[build] rustc 1 <host> -> rustc 2 <host>
1969+
[build] rustc 1 <host> -> std 1 <host>
1970+
[build] rustdoc 1 <host>
1971+
[test] rustc 1 <host> -> CrateLibrustc 2 <host>
1972+
");
1973+
}
1974+
19411975
#[test]
19421976
fn test_exclude() {
19431977
let ctx = TestCtx::new();
@@ -1955,13 +1989,14 @@ mod snapshot {
19551989

19561990
let get_steps = |args: &[&str]| ctx.config("test").args(args).get_steps();
19571991

1992+
let rustc_metadata = || StepMetadata::test("CrateLibrustc", host).built_by(Compiler::new(0, host));
19581993
// Ensure our test is valid, and `test::Rustc` would be run without the exclude.
1959-
get_steps(&[]).assert_contains(StepMetadata::test("CrateLibrustc", host));
1994+
get_steps(&[]).assert_contains(rustc_metadata());
19601995

19611996
let steps = get_steps(&["--skip", "compiler/rustc_data_structures"]);
19621997

19631998
// Ensure tests for rustc are not skipped.
1964-
steps.assert_contains(StepMetadata::test("CrateLibrustc", host));
1999+
steps.assert_contains(rustc_metadata());
19652000
steps.assert_contains_fuzzy(StepMetadata::build("rustc", host));
19662001
}
19672002

0 commit comments

Comments
 (0)