Skip to content

Commit b944144

Browse files
committed
Add step metadata and a few tests for Doc steps
1 parent 6d562b2 commit b944144

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
@@ -1674,6 +1674,101 @@ mod snapshot {
16741674
[doc] std 1 <target1> crates=[alloc,core]
16751675
");
16761676
}
1677+
1678+
#[test]
1679+
fn doc_compiler_stage_0() {
1680+
let ctx = TestCtx::new();
1681+
insta::assert_snapshot!(
1682+
ctx.config("doc")
1683+
.path("compiler")
1684+
.stage(0)
1685+
.render_steps(), @r"
1686+
[build] rustdoc 0 <host>
1687+
[build] llvm <host>
1688+
[doc] rustc 0 <host>
1689+
");
1690+
}
1691+
1692+
#[test]
1693+
fn doc_compiler_stage_1() {
1694+
let ctx = TestCtx::new();
1695+
insta::assert_snapshot!(
1696+
ctx.config("doc")
1697+
.path("compiler")
1698+
.stage(1)
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] rustdoc 0 <host>
1704+
[doc] rustc 1 <host>
1705+
");
1706+
}
1707+
1708+
#[test]
1709+
fn doc_compiler_stage_2() {
1710+
let ctx = TestCtx::new();
1711+
insta::assert_snapshot!(
1712+
ctx.config("doc")
1713+
.path("compiler")
1714+
.stage(2)
1715+
.render_steps(), @r"
1716+
[build] llvm <host>
1717+
[build] rustc 0 <host> -> rustc 1 <host>
1718+
[build] rustc 1 <host> -> std 1 <host>
1719+
[build] rustc 1 <host> -> rustc 2 <host>
1720+
[build] rustc 2 <host> -> std 2 <host>
1721+
[build] rustdoc 1 <host>
1722+
[doc] rustc 2 <host>
1723+
");
1724+
}
1725+
1726+
#[test]
1727+
fn doc_compiletest_stage_0() {
1728+
let ctx = TestCtx::new();
1729+
insta::assert_snapshot!(
1730+
ctx.config("doc")
1731+
.path("src/tools/compiletest")
1732+
.stage(0)
1733+
.render_steps(), @r"
1734+
[build] rustdoc 0 <host>
1735+
[doc] Compiletest <host>
1736+
");
1737+
}
1738+
1739+
#[test]
1740+
fn doc_compiletest_stage_1() {
1741+
let ctx = TestCtx::new();
1742+
insta::assert_snapshot!(
1743+
ctx.config("doc")
1744+
.path("src/tools/compiletest")
1745+
.stage(1)
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] rustdoc 0 <host>
1751+
[doc] Compiletest <host>
1752+
");
1753+
}
1754+
1755+
#[test]
1756+
fn doc_compiletest_stage_2() {
1757+
let ctx = TestCtx::new();
1758+
insta::assert_snapshot!(
1759+
ctx.config("doc")
1760+
.path("src/tools/compiletest")
1761+
.stage(2)
1762+
.render_steps(), @r"
1763+
[build] llvm <host>
1764+
[build] rustc 0 <host> -> rustc 1 <host>
1765+
[build] rustc 1 <host> -> std 1 <host>
1766+
[build] rustc 1 <host> -> rustc 2 <host>
1767+
[build] rustc 2 <host> -> std 2 <host>
1768+
[build] rustdoc 1 <host>
1769+
[doc] Compiletest <host>
1770+
");
1771+
}
16771772
}
16781773

16791774
struct ExecutedSteps {

0 commit comments

Comments
 (0)