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

Avoid trusting bootstrap for git-hash availability for the version-verbose-commit-hash test #137039

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

jieyouxu
Copy link
Member

Caution

Blocked on:

  1. ci.py rewrite: Rewrite the ci.py script in Rust #136864
  2. Rebasing then setting COMPILETEST_HAS_GIT_HASH=1 when under CI conditions.

Summary

  • Instead of trusting git hash availability reported by bootstrap, we need to bypass bootstrap and directly work with CI to determine whether git hash should be available and run the tests/run-make/version-verbose-commit-hash test.
  • This is to catch regressions like Recent pre-nightly builds have "commit-hash: unknown" in their version info #132845 where the regression slip through because bootstrap's git-hash logic was broken, where bootstrap reported git-hash was available but actually produced {rustc,rustdoc} that had omitted git hash info.

Testing

Manually tested locally:

  • COMPILETEST_HAS_GIT_HASH=1 ./x test tests/run-make/version-verbose-commit-hash with compiler profile + rust.channel defaulted to dev causes test to fail because no git hash info.
  • COMPILETEST_HAS_GIT_HASH=1 ./x test tests/run-make/version-verbose-commit-hash with compiler profile + rust.channel=nightly passes test.

Review advice

  • Should double-check if COMPILETEST_HAS_GIT_HASH=1 is correctly set in CI.
  • Please do let me know if there's a better scheme to handle this.

Fixes #132875.

Previously, `tests/run-make/version-verbose-commit-hash` relied upon
information from *bootstrap* to determine if git-hash was available.
However, this is flawed: if bootstrap's git-hash logic fails, the test
that tries to check that the rustc is built with git-hash information
may never run, because it's gated via `//@ needs-git-hash` that trusts
bootstrap's information!

Instead, we have to bypass bootstrap and communicate between CI jobs and
the run-make test directly.
- No longer gate by `//@ needs-git-hash`. Instead, check for
  `COMPILETEST_HAS_GIT_HASH=1` env var being set.
- Document the env var and reason for bypassing bootstrap.
@rustbot
Copy link
Collaborator

rustbot commented Feb 14, 2025

r? @onur-ozkan

rustbot has assigned @onur-ozkan.
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-compiletest Area: The compiletest test runner A-run-make Area: port run-make Makefiles to rmake.rs A-rustc-dev-guide Area: rustc-dev-guide 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-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Feb 14, 2025
@jieyouxu
Copy link
Member Author

@rustbot blocked (#136864)

@rustbot rustbot added S-blocked Status: Blocked on something else such as an RFC or other implementation work. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-compiletest Area: The compiletest test runner A-run-make Area: port run-make Makefiles to rmake.rs A-rustc-dev-guide Area: rustc-dev-guide A-testsuite Area: The testsuite used to check the correctness of rustc S-blocked Status: Blocked on something else such as an RFC or other implementation work. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The run-make/version-verbose-commit-hash test doesn't reliably detect when the commit hash is missing
3 participants