-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Add debugging utils and comments to Fuchsia scripts #126105
Conversation
rustbot has assigned @Mark-Simulacrum. Use |
@bors try |
@bors try- |
Add debugging utils and comments to Fuchsia scripts This should help when debugging a failure in the Fuchsia build in CI. I plan to follow up with a PR to the testing section of the dev guide with more details, along with more improvements happening in the Fuchsia repo itself. try-job: x86_64-gnu-integration
welp.. maybe this will replace the current job.. @bors try |
Add debugging utils and comments to Fuchsia scripts This should help when debugging a failure in the Fuchsia build in CI. I plan to follow up with a PR to the testing section of the dev guide with more details, along with more improvements happening in the Fuchsia repo itself. try-job: x86_64-gnu-integration
r? @lqd |
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.
couple random questions
|
||
set -euf -o pipefail | ||
|
||
INTEGRATION_SHA=1011e3298775ee7cdf6f6dc73e808d6a86e33bd6 | ||
# Set this variable to disable updating the Fuchsia checkout. This is useful for |
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.
Set it to what? Can I just put 1
there or what?
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.
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.
But mostly, should keeping the checkout be the default? In a CI context, it shouldn't matter, right? (I've described in another comment a case where removing local changes by default caused me an issue, but that happened a couple times)
It could actually be interesting to have some passthrough from the initial shell.
I don't think that the dockerfile is setup for this but e.g. KEEP_CHECKOUT=1 src/ci/docker/run.sh x86_64-gnu-integration --dev
could be one of the best ways to get a workable shell (after the initial integration.git checkout, which this very command wouldn't do the first time it's run, IIRC).
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.
Any nonempty string will work, but adding 1 in the comment so it's less confusing.
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.
In a CI context you want to force the checkout to a known state before building. If you think it would be nicer, I could make this script accept a --keep-checkout
flag to use inside the dev shell (or invert it and have the docker script pass an --overwrite
flag or something). But with that you'd have to be careful not to run the full thing with run.sh or it will overwrite your local checkout, which is why I think it might be nicer to use the workflow of modifying this script directly.
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.
I mostly meant that in our CI context the builder should be starting from scratch without an existing checkout to keep IIUC.
It could be an interesting change in the future, but as long as we document this, as you've done in the script and in the docs PR, then it should likely be fine for now.
src/ci/docker/host-x86_64/x86_64-gnu-integration/build-fuchsia.sh
Outdated
Show resolved
Hide resolved
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.
Cool, thanks for this!
I don't know how much back-and-forth you want to do on this PR, vs iterative improvements on our CI scripts and documentations, and fuchsia's "build from rust CI" setup, but apart from the comments I left here, and what you've added in rust-lang/rustc-dev-guide#1989, here's a list I remember having issues with:
As non-fuchsia engineers, we'll unfortunately need some hand-holding with the build system. We don't know what we can do with fx
, if we're to use it or not, how common cargo use-cases translate, etc. Nor do we know the actual fuchsia components to build, or how to discover them, when an issue appears in one of them. Some description about all this would be nice. Otherwise, we're kind of randomly mixing paths and names found in some "build.gn" files, fx expectedly not finding the component, but also not saying which components Levenshtein-match what was requested.
The first thing you need to do when debugging an issue in the builder is to remove --quiet
from https://fuchsia.googlesource.com/fuchsia/+/refs/heads/releases/canary/scripts/rust/build_fuchsia_from_rust_ci.sh#118. It's understandable that we don't want to show huge logs for CI (though maybe it's not that costly I don't know, and am not on t-infra), but it would be helpful for people debugging issues to have some output locally. What could work is that only our CI workflows add the --quiet
, so that local use-cases with src/ci/docker/run.sh x86_64-gnu-integration
would not themselves hide fuchsia's logs.
(Actually, maybe the first thing is to setup one's local rustc checkout to even run the CI docker scripts in general, where IIUC the most common initial hurdle is that some submodules need to be initialized and checked out. CI does this automatically but it's usually not the case for developers).
I also needed a way to change rustc's arguments when building a crate -- otherwise I had to introduce an error in fuchsia code, to extract the command-line used and change it, and stop using the build system afterwards. I don't know if it's possible to with fx
(e.g. if I can use RUSTFLAGS
, or if there is some equivalent to the cargo check + cargo rustc
combination to only override a leaf crate's arguments. I expect this to be very common in practice, and any way to make this easy will be helpful. Maybe some documentation on how to do this today would also be enough, for example.
This is more a QOL thing, but I noticed a few things being built which were surprising, but surely useful for you. In any case, maybe it'd make builds slightly faster to not have:
- 3 targets (x64, fuchsia, wasm, -- w/ fuchsia being the default for the build when maybe the most useful one locally is the host target, so that artifacts can be used from outside the docker container),
- or the cranelift backend being built (I'm almost positive I saw some cg_clif build logs even though only cg_llvm seems to be setup),
- and checking which stage is built and used. Here I expect also some of suboptimal bootstrap + tools stage versioning mismatch to come into play. To overapproximate the situation, and I don't know that it really applies I'd need to check, here's an example: if you build "stage 2 rustdoc", it will build the stage 2 compiler + std, but actually link with stage 1. Fuchsia is using clippy, and maybe it works similarly. If that's the case, then avoiding building an unused stage 2 would be nice. Though avoiding the need to build clippy in the first place could also be good for people working on the compiler I guess, e.g. if locally we could choose to use an fx equivalent of cargo check instead of fx clippy.
(sorry for the long brain dump)
src/ci/docker/host-x86_64/x86_64-gnu-integration/build-fuchsia.sh
Outdated
Show resolved
Hide resolved
|
||
set -euf -o pipefail | ||
|
||
INTEGRATION_SHA=1011e3298775ee7cdf6f6dc73e808d6a86e33bd6 | ||
# Set this variable to disable updating the Fuchsia checkout. This is useful for |
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.
But mostly, should keeping the checkout be the default? In a CI context, it shouldn't matter, right? (I've described in another comment a case where removing local changes by default caused me an issue, but that happened a couple times)
It could actually be interesting to have some passthrough from the initial shell.
I don't think that the dockerfile is setup for this but e.g. KEEP_CHECKOUT=1 src/ci/docker/run.sh x86_64-gnu-integration --dev
could be one of the best ways to get a workable shell (after the initial integration.git checkout, which this very command wouldn't do the first time it's run, IIRC).
src/ci/docker/host-x86_64/x86_64-gnu-integration/build-fuchsia.sh
Outdated
Show resolved
Hide resolved
246c9bf
to
8bf49ed
Compare
This should help when debugging a failure in the Fuchsia build in CI.
This feedback is really helpful, thanks @lqd. I'm incorporating your feedback into this PR and the docs I'm writing in rust-lang/rustc-dev-guide#1989 as much as I can, and also writing down some future improvements we can make in our bug tracker.
I think I'll just remove this flag from the upstream build script. |
Great, thank you. This looks good to me. @bors r+ |
Rollup of 6 pull requests Successful merges: - rust-lang#125951 (Stabilize `error_in_core`) - rust-lang#125998 (std::unix::fs::get_mode implementation for illumos/solaris.) - rust-lang#126057 (Make html rendered by rustdoc allow searching non-English identifier / alias) - rust-lang#126065 (mark binding undetermined if target name exist and not obtained) - rust-lang#126105 (Add debugging utils and comments to Fuchsia scripts) - rust-lang#126138 (Fix typo in docs for std::pin) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#126105 - tmandry:fuchsia-scripts, r=lqd Add debugging utils and comments to Fuchsia scripts This should help when debugging a failure in the Fuchsia build in CI. I plan to follow up with a PR to the testing section of the dev guide with more details, along with more improvements happening in the Fuchsia repo itself. try-job: x86_64-gnu-integration
This should help when debugging a failure in the Fuchsia build in CI.
I plan to follow up with a PR to the testing section of the dev guide with more details, along with more improvements happening in the Fuchsia repo itself.
try-job: x86_64-gnu-integration