Skip to content

Explore adding a reproducibility test to rust test infrastructure. #139793

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

biabbas
Copy link
Contributor

@biabbas biabbas commented Apr 14, 2025

Fixes #75362
Trying to add a reproducibility check on rust infrastructure itself to detect reproducibility issues.
These were the issues encountered till now:

  1. On ci only nightly build is supported because of an issue here: https://github.com/rust-lang/rust/blob/master/src/build_helper/src/git.rs#L143
  2. Because this is a nightly build, llvm is built from sources. So space was an issue. This was resolved by deleting the copy of source and all build contents except for stage1 artifacts.

Questions:

  1. The check takes about 5hours to complete for now. Is this sustainable for each pr?
  2. Can we add this as a post merge workflow?
    This is also related to issue: Rust reproducibility issue - Finding the proper fix #134589

@rustbot
Copy link
Collaborator

rustbot commented Apr 14, 2025

r? @marcoieni

rustbot has assigned @marcoieni.
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 the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 14, 2025
@biabbas biabbas force-pushed the reproducible branch 8 times, most recently from 238555f to 916f799 Compare April 16, 2025 04:04
@biabbas biabbas force-pushed the reproducible branch 5 times, most recently from cfc6ce8 to 46485be Compare April 17, 2025 12:24
@rustbot rustbot added the T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) label Apr 18, 2025
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@biabbas
Copy link
Contributor Author

biabbas commented Apr 22, 2025

@rustbot label -T-bootstrap

@rustbot rustbot removed the T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) label Apr 22, 2025
@biabbas
Copy link
Contributor Author

biabbas commented Apr 22, 2025

@rustbot label +T-infra

@rustbot rustbot added the T-infra Relevant to the infrastructure team, which will review and decide on the PR/issue. label Apr 22, 2025
@biabbas biabbas marked this pull request as ready for review April 22, 2025 03:08
@biabbas biabbas marked this pull request as draft April 22, 2025 03:09
@biabbas biabbas marked this pull request as ready for review April 22, 2025 03:09
@marcoieni
Copy link
Member

2. space was an issue. This was resolved by deleting the copy of source and all build contents except for stage1 artifacts.

please write this as a comment in the code 👍

@biabbas biabbas force-pushed the reproducible branch 6 times, most recently from 4babe2f to 4f8cb89 Compare April 23, 2025 06:11
Copy link
Member

@marcoieni marcoieni left a comment

Choose a reason for hiding this comment

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

The PR looks good overall, the comments are great, thanks!
I left a few more minor comments.

I want to involve @Kobzol to ask him if he agrees with the overall strategy here. I.e.:

  • do we want to add this workflow?
  • does it solve the problem in the right way?

push:
branches:
- master
- reproducible
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
- reproducible

this is a leftover from the test, right?

@Kobzol
Copy link
Contributor

Kobzol commented Apr 23, 2025

While it would be great to have some reproducibility checks on CI, I don't think that the current approach used by this PR is the right one, for a few reasons.

  • If we do any tests post-merge, it will be quite difficult to act upon them. We should IMO either do this on a best-effort basis out-of-tree (or only in PR CI), or make it actually blocking for merging PRs and run it on auto builds.
  • When a reproducibility test fails, it can be quite difficult to understand what went wrong. We should first invest in at least some basic tooling that will display some useful form of a diff between the binary artifacts so that we can actually figure out what went wrong.
  • A related aspect to that is reproducibility of the test itself. If the test will be implemented in a separate CI workflow, it will be impossible to run it locally. It would be great to have the option to run the test locally, likely either as a bootstrap test or a run-make test. Both would require some code changes and test infra improvements to make this possible, probably.
  • I don't think that (re)building the compiler twice from scratch, even including (sccached) LLVM builds has to take 5 hours. Building the stage 2 compiler on x86_64-gnu, which runs on the free 4-core runner, take ~2000s, so doing that twice should take at most 1.5 hours, if we have proper caching configured. This is also why I'd like to do this in our normal CI workflow, not in a separate workflow that doesn't have any of our supporting infrastructure. I think that we can also start with something simpler, as was proposed in CI for deterministic / reproducible builds #75362, e.g. do the test only for stdlib as a start. Or, as an alternative, maybe we could do a stage 2 build, then move the sources to a different location, do a stage3 build, and just compare stage 2 and stage 3? There are likely several approaches that we can try.

I think that this is something that we should ideally discuss with t-infra first to gather consensus and come up with some plan, before starting with the implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CI for deterministic / reproducible builds
5 participants