Skip to content

Commit e932c98

Browse files
committed
Add step metadata and a few tests for Doc steps
1 parent 9ee6d1c commit e932c98

File tree

2 files changed

+103
-0
lines changed

2 files changed

+103
-0
lines changed

src/bootstrap/src/core/build_steps/doc.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -901,6 +901,10 @@ impl Step for Rustc {
901901
builder.open_in_browser(index);
902902
}
903903
}
904+
905+
fn metadata(&self) -> Option<StepMetadata> {
906+
Some(StepMetadata::doc("rustc", self.target).stage(self.stage))
907+
}
904908
}
905909

906910
macro_rules! tool_doc {
@@ -1018,6 +1022,10 @@ macro_rules! tool_doc {
10181022
})?
10191023
}
10201024
}
1025+
1026+
fn metadata(&self) -> Option<StepMetadata> {
1027+
Some(StepMetadata::doc(stringify!($tool), self.target))
1028+
}
10211029
}
10221030
}
10231031
}

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

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1658,6 +1658,101 @@ mod snapshot {
16581658
[doc] std 1 <target1> crates=[alloc,core]
16591659
");
16601660
}
1661+
1662+
#[test]
1663+
fn doc_compiler_stage_0() {
1664+
let ctx = TestCtx::new();
1665+
insta::assert_snapshot!(
1666+
ctx.config("doc")
1667+
.path("compiler")
1668+
.stage(0)
1669+
.render_steps(), @r"
1670+
[build] rustdoc 0 <host>
1671+
[build] llvm <host>
1672+
[doc] rustc 0 <host>
1673+
");
1674+
}
1675+
1676+
#[test]
1677+
fn doc_compiler_stage_1() {
1678+
let ctx = TestCtx::new();
1679+
insta::assert_snapshot!(
1680+
ctx.config("doc")
1681+
.path("compiler")
1682+
.stage(1)
1683+
.render_steps(), @r"
1684+
[build] llvm <host>
1685+
[build] rustc 0 <host> -> rustc 1 <host>
1686+
[build] rustc 1 <host> -> std 1 <host>
1687+
[build] rustdoc 0 <host>
1688+
[doc] rustc 1 <host>
1689+
");
1690+
}
1691+
1692+
#[test]
1693+
fn doc_compiler_stage_2() {
1694+
let ctx = TestCtx::new();
1695+
insta::assert_snapshot!(
1696+
ctx.config("doc")
1697+
.path("compiler")
1698+
.stage(2)
1699+
.render_steps(), @r"
1700+
[build] llvm <host>
1701+
[build] rustc 0 <host> -> rustc 1 <host>
1702+
[build] rustc 1 <host> -> std 1 <host>
1703+
[build] rustc 1 <host> -> rustc 2 <host>
1704+
[build] rustc 2 <host> -> std 2 <host>
1705+
[build] rustdoc 1 <host>
1706+
[doc] rustc 2 <host>
1707+
");
1708+
}
1709+
1710+
#[test]
1711+
fn doc_compiletest_stage_0() {
1712+
let ctx = TestCtx::new();
1713+
insta::assert_snapshot!(
1714+
ctx.config("doc")
1715+
.path("src/tools/compiletest")
1716+
.stage(0)
1717+
.render_steps(), @r"
1718+
[build] rustdoc 0 <host>
1719+
[doc] Compiletest <host>
1720+
");
1721+
}
1722+
1723+
#[test]
1724+
fn doc_compiletest_stage_1() {
1725+
let ctx = TestCtx::new();
1726+
insta::assert_snapshot!(
1727+
ctx.config("doc")
1728+
.path("src/tools/compiletest")
1729+
.stage(1)
1730+
.render_steps(), @r"
1731+
[build] llvm <host>
1732+
[build] rustc 0 <host> -> rustc 1 <host>
1733+
[build] rustc 1 <host> -> std 1 <host>
1734+
[build] rustdoc 0 <host>
1735+
[doc] Compiletest <host>
1736+
");
1737+
}
1738+
1739+
#[test]
1740+
fn doc_compiletest_stage_2() {
1741+
let ctx = TestCtx::new();
1742+
insta::assert_snapshot!(
1743+
ctx.config("doc")
1744+
.path("src/tools/compiletest")
1745+
.stage(2)
1746+
.render_steps(), @r"
1747+
[build] llvm <host>
1748+
[build] rustc 0 <host> -> rustc 1 <host>
1749+
[build] rustc 1 <host> -> std 1 <host>
1750+
[build] rustc 1 <host> -> rustc 2 <host>
1751+
[build] rustc 2 <host> -> std 2 <host>
1752+
[build] rustdoc 1 <host>
1753+
[doc] Compiletest <host>
1754+
");
1755+
}
16611756
}
16621757

16631758
struct ExecutedSteps {

0 commit comments

Comments
 (0)