bootstrap: download-rustc support for ferrocene s3 bucket and coverage#2048
bootstrap: download-rustc support for ferrocene s3 bucket and coverage#2048bors-ferrocene[bot] merged 7 commits intomainfrom
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
| if let Some(config_path) = &self.config { | ||
| // Ferrocene addition: our CI builders don't currently upload builder-config. | ||
| // For now, just assume it matches the local settings. | ||
| if false && let Some(config_path) = &self.config { |
There was a problem hiding this comment.
maybe left-over from testing
| if false && let Some(config_path) = &self.config { | |
| if let Some(config_path) = &self.config { |
There was a problem hiding this comment.
no, that is intentional. see the comment above.
There was a problem hiding this comment.
I didn't remove the code altogether because I don't want to cause merge conflicts with upstream.
oh, i got very close, but it didn't work because of the caching issue in https://github.com/ferrocene/ferrocene/blob/main/src/bootstrap/src/ferrocene/code_coverage.rs#L32-L47 (the one with an open ticket) |
09515fc to
3f016db
Compare
Hoverbear
left a comment
There was a problem hiding this comment.
I believe you're adding some safeguards to stage related flags. Let's do that. :)
Going to hold this until backports are cozy for 1.92, just in case.
yup, and i'm also going to delete |
|
bors try |
2048: bootstrap: download-rustc support for ferrocene s3 bucket and coverage r=Hoverbear a=jyn514 For details about the changes, see the individual commit messages. For more background on download-rustc and why it's useful, see https://rustc-dev-guide.rust-lang.org/building/suggested.html?highlight=download-rustc#faster-builds-with-ci-rustc. To test this, set `rust.download-rustc = true` and `rust.debug-assertions = false` in config.toml, then run `x t --coverage=library library/core library/alloc --no-doc`. Co-authored-by: Jynn Nelson <[email protected]>
|
bors cancel |
|
Canceled. |
tryBuild failed: |
|
bors try |
tryBuild succeeded: |
3f016db to
e5c29c9
Compare
|
i think this might be using the wrong core when i run coverage tests ... |
e5c29c9 to
bc47be4
Compare
|
I think this is a strict improvement over the current situation, even though it's not really usable for coverage yet. I think I'd like to merge it as-is, maybe with a note in bootstrap.example.toml and in the docs that it's experimental and may break. |
|
This makes three changes: 1. Pass `config` into `download_file` more consistently. Unlike upstream, we need a config in order to download artifacts. 2. Adjust to our incompatible dist artifact URL format. This is not great; ideally we would just use the same naming scheme as upstream. But that requires coordinated changes across CI, bootstrap, and criticalup. For now, just use our new names. 3. Don't try to compare the builder's config settings to the local config. Our artifacts don't currently package their settings, so this always fails. This should be fairly simple to fix, but I don't think it's necessary to block on.
There were three main issues here. 1. The pre-existing caching issue, where profiler_builtins was passed multiple times to `x test --coverage` consistently happened *every* time when download-rustc was enabled (it was loaded once from ci-rustc and once from stage1-std). 2. When std is downloaded from CI, the staging gets *very* complicated. In particular, `x test --stage 2 core` will build the *sysroot* with stage 1 but the *tests* with stage 2. The logic for this lives only in `compile::Std`, and the various other parts of the codebase that were looking at the stage didn't account for it. 3. When instrumenting core, `force_rebuild` needs to always be set or bootstrap will make incorrect caching decisions. Fix 1. by building `profiler_builtins` explicitly, separate from the rest of the standard library, and passing it explicitly to rustc with `--extern profiler_builtins=...`. I did this with a new `ProfilerBuiltins` step. Fix 2. by moving all relevant logic to `instrument_coverage` and out of `std_cargo`. Fix 3. by enabling `force_rebuild` whenever `should_instrument_coverage` is set. I removed the `ferrocene_inject_profiler_builtins` feature; it's not necessary now that we pass it explicitly, and it will break the build if cargo tries to rebuild it with a different metadata hash or in a different stage. Finally, I removed the `-L` flag that was originally causing all the caching trouble. To test this PR, you can set `rust.download-rustc = true`, `rust.debug-assertions = false`, and then run `x test --coverage=library library/core library/alloc --no-doc` like normal.
|
Added some short docs and warnings. I haven't switched this on by default for the library profile, partly because upstream looks unlikely to and I want to match them, and partly because this is still experimental. |
abd53bf to
5b6ebc7
Compare
This comment was marked as resolved.
This comment was marked as resolved.
Only stage 2 is currently supported.
|
Hmmm following the recommended test procedure from the PR description (with |
|
@Hoverbear you can't just remove --tests altogether, you need to replace it with |
|
That works better, is this the expected result? |
|
yeah that looks broken in the way I expect, it's getting the spans for the standard library wrong. this isn't currently usable for coverage but it should be useful for most other things. |
|
Excellent, yes, it was notably faster. |
| use crate::{BootstrapCommand, Compiler, Mode}; | ||
|
|
||
| pub(crate) fn instrument_coverage(builder: &Builder<'_>, cargo: &mut Cargo, compiler: Compiler) { | ||
| pub(crate) fn instrument_coverage( |
There was a problem hiding this comment.
Do you think we could make the --coverage=library arg explicitly crash with download-rustc, since it's known bad? I'd like to avoid a situation where we get confused and chase a wild goose around.
There was a problem hiding this comment.
I feel like Nami would love chasing a goose actually.
seems like a good idea, done.
There was a problem hiding this comment.
(It doesn't crash but it does disable download-rustc, which means you'll get the right results. You the user can choose to kill the build if you don't want to spend that much time.)
Hoverbear
left a comment
There was a problem hiding this comment.
Looks overall good, mildly concerned we might not realize we have this set when measuring coverage though. Recommend a guard rail, so holding merge until you decide if you agree.
Example output:
```
$ x b compiler
Building bootstrap
Finished `dev` profile [unoptimized] target(s) in 0.02s
NOTE: detected 3 modifications that could affect a build of rustc
- src/bootstrap/src/core/config/config.rs
- src/bootstrap/src/core/download.rs
- src/build_helper/src/git.rs
skipping rustc download due to `download-rustc = 'if-unchanged'`
Building stage1 compiler artifacts (stage0 -> stage1, aarch64-apple-darwin)
Finished `release` profile [optimized] target(s) in 0.72s
Creating a sysroot for stage1 compiler (use `rustup toolchain link 'name' build/host/stage1`)
Build completed successfully in 0:00:05
```
For details about the changes, see the individual commit messages.
For more background on download-rustc and why it's useful, see https://rustc-dev-guide.rust-lang.org/building/suggested.html?highlight=download-rustc#faster-builds-with-ci-rustc.
To test this, set
rust.download-rustc = trueandrust.debug-assertions = falsein config.toml, then runx t --coverage=library library/core library/alloc --tests.This doesn't report the same coverage outcomes as
download-rustc = falsecurrently, there's some bug in how spans are reported. I think this is a strict improvement over the current situation, even though it's not really usable for coverage yet. I'd like to merge it as-is. There's a note in bootstrap.example.toml and in the docs that it's experimental and may break.