Skip to content
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

Merged
merged 1 commit into from
Jun 8, 2024

Conversation

tmandry
Copy link
Member

@tmandry tmandry commented Jun 6, 2024

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

@rustbot
Copy link
Collaborator

rustbot commented Jun 6, 2024

r? @Mark-Simulacrum

rustbot has assigned @Mark-Simulacrum.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-infra Relevant to the infrastructure team, which will review and decide on the PR/issue. labels Jun 6, 2024
@tmandry tmandry force-pushed the fuchsia-scripts branch from 1f0963e to d3bdc64 Compare June 6, 2024 22:02
@tmandry
Copy link
Member Author

tmandry commented Jun 6, 2024

@bors try

@tmandry
Copy link
Member Author

tmandry commented Jun 6, 2024

@bors try-

bors added a commit to rust-lang-ci/rust that referenced this pull request Jun 6, 2024
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
@bors
Copy link
Contributor

bors commented Jun 6, 2024

⌛ Trying commit d3bdc64 with merge 76d6219...

@tmandry tmandry force-pushed the fuchsia-scripts branch from d3bdc64 to 168d23d Compare June 6, 2024 22:12
@tmandry
Copy link
Member Author

tmandry commented Jun 6, 2024

welp.. maybe this will replace the current job..

@bors try

@bors
Copy link
Contributor

bors commented Jun 6, 2024

⌛ Trying commit 168d23d with merge 09ce085...

bors added a commit to rust-lang-ci/rust that referenced this pull request Jun 6, 2024
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
@tmandry tmandry force-pushed the fuchsia-scripts branch from 00a73c5 to a28ff5b Compare June 7, 2024 01:18
@tmandry
Copy link
Member Author

tmandry commented Jun 7, 2024

r? @lqd

Copy link
Member

@compiler-errors compiler-errors left a 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
Copy link
Member

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?

Copy link
Member

@lqd lqd Jun 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

@lqd lqd Jun 7, 2024

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).

Copy link
Member Author

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.

Copy link
Member Author

@tmandry tmandry Jun 7, 2024

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.

Copy link
Member

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.

Copy link
Member

@lqd lqd left a 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)


set -euf -o pipefail

INTEGRATION_SHA=1011e3298775ee7cdf6f6dc73e808d6a86e33bd6
# Set this variable to disable updating the Fuchsia checkout. This is useful for
Copy link
Member

@lqd lqd Jun 7, 2024

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).

@tmandry tmandry force-pushed the fuchsia-scripts branch 3 times, most recently from 246c9bf to 8bf49ed Compare June 7, 2024 18:37
This should help when debugging a failure in the Fuchsia build in CI.
@tmandry tmandry force-pushed the fuchsia-scripts branch from 8bf49ed to 63ba3f3 Compare June 7, 2024 19:47
@tmandry
Copy link
Member Author

tmandry commented Jun 7, 2024

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.

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.

I think I'll just remove this flag from the upstream build script.

@lqd
Copy link
Member

lqd commented Jun 7, 2024

Great, thank you.

This looks good to me. @bors r+

@bors
Copy link
Contributor

bors commented Jun 7, 2024

📌 Commit 63ba3f3 has been approved by lqd

It is now in the queue for this repository.

@bors bors removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jun 7, 2024
@bors bors added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Jun 7, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Jun 8, 2024
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
@bors bors merged commit 8e225fb into rust-lang:master Jun 8, 2024
6 checks passed
@rustbot rustbot added this to the 1.80.0 milestone Jun 8, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Jun 8, 2024
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
@cuviper cuviper modified the milestones: 1.80.0, 1.81.0 Jun 13, 2024
@tmandry tmandry deleted the fuchsia-scripts branch June 17, 2024 16:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-infra Relevant to the infrastructure team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants