-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Remove unnecessary stage2 host builds from cross-compiled dist builders #145874
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1133,8 +1133,7 @@ mod snapshot { | |
[dist] mingw <host> | ||
[build] rustc 0 <host> -> GenerateCopyright 1 <host> | ||
[dist] rustc <host> | ||
[build] rustc 2 <host> -> std 2 <host> | ||
[dist] rustc 2 <host> -> std 2 <host> | ||
[dist] rustc 1 <host> -> std 1 <host> | ||
[dist] rustc 1 <host> -> rustc-dev 2 <host> | ||
[dist] src <> | ||
[dist] reproducible-artifacts <host> | ||
|
@@ -1198,8 +1197,7 @@ mod snapshot { | |
[build] rustc 1 <host> -> rust-analyzer-proc-macro-srv 2 <host> | ||
[build] rustc 0 <host> -> GenerateCopyright 1 <host> | ||
[dist] rustc <host> | ||
[build] rustc 2 <host> -> std 2 <host> | ||
[dist] rustc 2 <host> -> std 2 <host> | ||
[dist] rustc 1 <host> -> std 1 <host> | ||
[dist] rustc 1 <host> -> rustc-dev 2 <host> | ||
[dist] rustc 1 <host> -> analysis 2 <host> | ||
[dist] src <> | ||
|
@@ -1216,7 +1214,6 @@ mod snapshot { | |
[build] rustc 1 <host> -> miri 2 <host> | ||
[build] rustc 1 <host> -> cargo-miri 2 <host> | ||
[dist] rustc 1 <host> -> miri 2 <host> | ||
[dist] rustc 1 <host> -> std 1 <host> | ||
[dist] rustc 1 <host> -> extended 2 <host> | ||
[dist] reproducible-artifacts <host> | ||
"); | ||
|
@@ -1287,8 +1284,7 @@ mod snapshot { | |
[dist] mingw <target1> | ||
[build] rustc 0 <host> -> GenerateCopyright 1 <host> | ||
[dist] rustc <host> | ||
[build] rustc 2 <host> -> std 2 <host> | ||
[dist] rustc 2 <host> -> std 2 <host> | ||
[dist] rustc 1 <host> -> std 1 <host> | ||
[build] rustc 2 <host> -> std 2 <target1> | ||
[dist] rustc 2 <host> -> std 2 <target1> | ||
[dist] rustc 1 <host> -> rustc-dev 2 <host> | ||
|
@@ -1350,8 +1346,7 @@ mod snapshot { | |
[dist] rustc <host> | ||
[build] rustdoc 2 <target1> | ||
[dist] rustc <target1> | ||
[build] rustc 2 <host> -> std 2 <host> | ||
[dist] rustc 2 <host> -> std 2 <host> | ||
[dist] rustc 1 <host> -> std 1 <host> | ||
[dist] rustc 1 <host> -> rustc-dev 2 <host> | ||
[dist] rustc 1 <host> -> rustc-dev 2 <target1> | ||
[dist] src <> | ||
|
@@ -1433,10 +1428,8 @@ mod snapshot { | |
[dist] rustc <host> | ||
[build] rustdoc 2 <target1> | ||
[dist] rustc <target1> | ||
[build] rustc 2 <host> -> std 2 <host> | ||
[dist] rustc 2 <host> -> std 2 <host> | ||
[build] rustc 2 <host> -> std 2 <target1> | ||
[dist] rustc 2 <host> -> std 2 <target1> | ||
[dist] rustc 1 <host> -> std 1 <host> | ||
[dist] rustc 1 <host> -> std 1 <target1> | ||
[dist] rustc 1 <host> -> rustc-dev 2 <host> | ||
[dist] rustc 1 <host> -> rustc-dev 2 <target1> | ||
[dist] src <> | ||
|
@@ -1490,10 +1483,8 @@ mod snapshot { | |
"); | ||
} | ||
|
||
/// This also serves as an important regression test for <https://github.com/rust-lang/rust/issues/138123> | ||
/// and <https://github.com/rust-lang/rust/issues/138004>. | ||
#[test] | ||
fn dist_all_cross() { | ||
fn dist_all_cross_extended() { | ||
let ctx = TestCtx::new(); | ||
insta::assert_snapshot!( | ||
ctx | ||
|
@@ -1545,8 +1536,7 @@ mod snapshot { | |
[build] rustc 1 <host> -> rust-analyzer-proc-macro-srv 2 <target1> | ||
[build] rustc 0 <host> -> GenerateCopyright 1 <host> | ||
[dist] rustc <target1> | ||
[build] rustc 2 <host> -> std 2 <target1> | ||
[dist] rustc 2 <host> -> std 2 <target1> | ||
[dist] rustc 1 <host> -> std 1 <target1> | ||
[dist] rustc 1 <host> -> rustc-dev 2 <target1> | ||
[dist] rustc 1 <host> -> analysis 2 <target1> | ||
[dist] src <> | ||
|
@@ -1564,15 +1554,82 @@ mod snapshot { | |
[build] rustc 1 <host> -> cargo-miri 2 <target1> | ||
[dist] rustc 1 <host> -> miri 2 <target1> | ||
[build] rustc 1 <host> -> LlvmBitcodeLinker 2 <target1> | ||
[dist] rustc 1 <host> -> std 1 <target1> | ||
[doc] rustc 2 <target1> -> std 2 <target1> crates=[] | ||
[dist] rustc 1 <host> -> extended 2 <target1> | ||
[dist] reproducible-artifacts <target1> | ||
"); | ||
} | ||
|
||
// Enable dist cranelift tarball by default with `x dist` if cranelift is enabled in | ||
// `rust.codegen-backends`. | ||
/// Simulates e.g. the powerpc64 builder, which is fully cross-compiled from x64, but it does | ||
/// not build docs. Crutically, it shouldn't build host stage 2 rustc. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Crucially or Critically? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Haha :D Thanks, I'll fix it in a followup PR. |
||
/// | ||
/// This is a regression test for <https://github.com/rust-lang/rust/issues/138123> | ||
/// and <https://github.com/rust-lang/rust/issues/138004>. | ||
#[test] | ||
fn dist_all_cross_extended_no_docs() { | ||
let ctx = TestCtx::new(); | ||
let steps = ctx | ||
.config("dist") | ||
.hosts(&[TEST_TRIPLE_1]) | ||
.targets(&[TEST_TRIPLE_1]) | ||
.args(&[ | ||
"--set", | ||
"rust.channel=nightly", | ||
"--set", | ||
"build.extended=true", | ||
"--set", | ||
"build.docs=false", | ||
]) | ||
.get_steps(); | ||
|
||
// Make sure that we don't build stage2 host rustc | ||
steps.assert_no_match(|m| { | ||
m.name == "rustc" | ||
&& m.built_by.map(|b| b.stage) == Some(1) | ||
&& *m.target.triple == host_target() | ||
}); | ||
|
||
insta::assert_snapshot!( | ||
steps.render(), @r" | ||
[dist] mingw <target1> | ||
[build] llvm <host> | ||
[build] llvm <target1> | ||
[build] rustc 0 <host> -> rustc 1 <host> | ||
[build] rustc 0 <host> -> WasmComponentLd 1 <host> | ||
[build] rustc 1 <host> -> std 1 <target1> | ||
[build] rustc 1 <host> -> std 1 <host> | ||
[build] rustc 1 <host> -> rustc 2 <target1> | ||
[build] rustc 1 <host> -> WasmComponentLd 2 <target1> | ||
[build] rustdoc 2 <target1> | ||
[build] rustc 1 <host> -> rust-analyzer-proc-macro-srv 2 <target1> | ||
[build] rustc 0 <host> -> GenerateCopyright 1 <host> | ||
[build] rustc 0 <host> -> RustInstaller 1 <host> | ||
[dist] rustc <target1> | ||
[dist] rustc 1 <host> -> std 1 <target1> | ||
[dist] rustc 1 <host> -> rustc-dev 2 <target1> | ||
[dist] rustc 1 <host> -> analysis 2 <target1> | ||
[dist] src <> | ||
[build] rustc 1 <host> -> cargo 2 <target1> | ||
[dist] rustc 1 <host> -> cargo 2 <target1> | ||
[build] rustc 1 <host> -> rust-analyzer 2 <target1> | ||
[dist] rustc 1 <host> -> rust-analyzer 2 <target1> | ||
[build] rustc 1 <host> -> rustfmt 2 <target1> | ||
[build] rustc 1 <host> -> cargo-fmt 2 <target1> | ||
[dist] rustc 1 <host> -> rustfmt 2 <target1> | ||
[build] rustc 1 <host> -> clippy-driver 2 <target1> | ||
[build] rustc 1 <host> -> cargo-clippy 2 <target1> | ||
[dist] rustc 1 <host> -> clippy 2 <target1> | ||
[build] rustc 1 <host> -> miri 2 <target1> | ||
[build] rustc 1 <host> -> cargo-miri 2 <target1> | ||
[dist] rustc 1 <host> -> miri 2 <target1> | ||
[build] rustc 1 <host> -> LlvmBitcodeLinker 2 <target1> | ||
[dist] rustc 1 <host> -> extended 2 <target1> | ||
[dist] reproducible-artifacts <target1> | ||
"); | ||
} | ||
|
||
/// Enable dist cranelift tarball by default with `x dist` if cranelift is enabled in | ||
/// `rust.codegen-backends`. | ||
#[test] | ||
fn dist_cranelift_by_default() { | ||
let ctx = TestCtx::new(); | ||
|
@@ -1619,8 +1676,7 @@ mod snapshot { | |
[build] rustc 0 <host> -> GenerateCopyright 1 <host> | ||
[dist] rustc <host> | ||
[dist] rustc 1 <host> -> rustc_codegen_cranelift 2 <host> | ||
[build] rustc 2 <host> -> std 2 <host> | ||
[dist] rustc 2 <host> -> std 2 <host> | ||
[dist] rustc 1 <host> -> std 1 <host> | ||
[dist] rustc 1 <host> -> rustc-dev 2 <host> | ||
[dist] src <> | ||
[dist] reproducible-artifacts <host> | ||
|
@@ -2351,8 +2407,7 @@ mod snapshot { | |
[doc] rustc 1 <host> -> releases 2 <host> | ||
[build] rustc 0 <host> -> RustInstaller 1 <host> | ||
[dist] docs <host> | ||
[build] rustc 2 <host> -> std 2 <host> | ||
[dist] rustc 2 <host> -> std 2 <host> | ||
[dist] rustc 1 <host> -> std 1 <host> | ||
[build] rustc 1 <host> -> rust-analyzer-proc-macro-srv 2 <host> | ||
[build] rustc 0 <host> -> GenerateCopyright 1 <host> | ||
[dist] rustc <host> | ||
|
@@ -2426,6 +2481,21 @@ impl ExecutedSteps { | |
} | ||
} | ||
|
||
/// Make sure that no metadata matches the given `func`. | ||
#[track_caller] | ||
fn assert_no_match<F>(&self, func: F) | ||
where | ||
F: Fn(StepMetadata) -> bool, | ||
{ | ||
for metadata in self.steps.iter().filter_map(|s| s.metadata.clone()) { | ||
if func(metadata.clone()) { | ||
panic!( | ||
"Metadata {metadata:?} was found, even though it should have not been present" | ||
); | ||
} | ||
} | ||
} | ||
|
||
fn contains(&self, metadata: &StepMetadata) -> bool { | ||
self.steps | ||
.iter() | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does 'T' stand for target? I suggest spelling it out whatever it is. Alternatives: machine, arch(itecture)