Skip to content

bootstrap: honor suite skips for coverage modes#159079

Closed
kn1g78 wants to merge 1 commit into
rust-lang:mainfrom
kn1g78:fix-bootstrap-coverage-skip
Closed

bootstrap: honor suite skips for coverage modes#159079
kn1g78 wants to merge 1 commit into
rust-lang:mainfrom
kn1g78:fix-bootstrap-coverage-skip

Conversation

@kn1g78

@kn1g78 kn1g78 commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

The Coverage step registers both the tests/coverage suite path and the
coverage-map / coverage-run mode aliases.

During default test selection, central skip handling removes the suite path,
but leaves the mode aliases selected. As a result, these commands can still run
coverage tests:

  • ./x test --skip=tests
  • ./x test --skip=tests/coverage
  • ./x test --skip=coverage

This change checks whether the coverage suite itself was skipped before
processing the selected coverage modes. Mode-specific skips such as
--skip=coverage-map and --skip=coverage-run retain their existing behavior.

Regression tests cover both suite-level and mode-specific skip paths.

Tested with:

python x.py test bootstrap --set build.submodules=false \
--test-args core::build_steps::test::tests::coverage_skip

@rustbot rustbot added A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels Jul 10, 2026
@kn1g78
kn1g78 marked this pull request as ready for review July 10, 2026 14:59
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 10, 2026
@rustbot rustbot removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Jul 10, 2026
@rustbot

rustbot commented Jul 10, 2026

Copy link
Copy Markdown
Collaborator

r? @jieyouxu

rustbot has assigned @jieyouxu.
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

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: bootstrap
  • bootstrap expanded to 6 candidates
  • Random selection from Mark-Simulacrum, clubby789, jieyouxu

@jieyouxu

Copy link
Copy Markdown
Member

cc @Zalathar in case you want to double-check the intended skipping behavior

@Zalathar

Copy link
Copy Markdown
Member

I’m somewhat nervous about trying to fix this in an ad-hoc way, as bootstrap’s path handling is already pretty tricky to reason about.

From glancing at the diff, it’s hard for me to tell whether this approach is an acceptable compromise or a step in the wrong direction. I’ll try to have a closer look at what’s going on.

@Zalathar

Copy link
Copy Markdown
Member

@kn1g78 Apologies for usurping your PR.

After investigating why path-based skipping currently doesn't work for coverage tests, I found that the underlying details were subtle enough that a different fix was needed, which I have filed as #159131.

@kn1g78

kn1g78 commented Jul 11, 2026

Copy link
Copy Markdown
Contributor Author

@kn1g78 Apologies for usurping your PR.

After investigating why path-based skipping currently doesn't work for coverage tests, I found that the underlying details were subtle enough that a different fix was needed, which I have filed as #159131.

No worries! Thanks for taking the time to investigate the root cause.
I'll take a look at #159131 as well. Thanks for improving this.
By the way, should I close my PR, or would you prefer to keep it open for now?

@jieyouxu

Copy link
Copy Markdown
Member

Thanks for the PR. I think we'll go with #159131 next doors because the changes here feel too "late", in that the changes here kinda "no-op" out when the coverage test steps are already reached, whereas the changes next doors touch up the resolution to stop us reaching the coverage steps in the first place.

@jieyouxu jieyouxu closed this Jul 12, 2026
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 12, 2026
jhpratt added a commit to jhpratt/rust that referenced this pull request Jul 12, 2026
bootstrap: Allow path-based skipping of the coverage test suite

- Alternative to rust-lang#159079
---

When bootstrap runs a step by default, without explicit paths, it will normally act as though the user had explicitly requested all of the paths and aliases that the step registered through `ShouldRun`.

For the coverage test suite, that gives the wrong outcome. Running a command like `./x test --skip=tests` or `./x test --skip=coverage` should skip the coverage tests, but instead the coverage tests would run anyway, due to the `coverage-map` and `coverage-run` aliases being treated as implied command-line arguments.

This PR fixes that problem by adding a special flag to `ShouldRun`. When creating pathsets for a step that is being run by default, if the step has set the `default_to_suites_only` flag, all non-suite pathsets are discarded. That gives the desired behaviour for skipping coverage tests, without affecting other steps, since other steps don't set the flag.

The end result is that `./x test --skip=tests` should now skip the coverage tests, as intended. This lets us remove some `--skip` arguments from CI scripts, which were only required by the previous incorrect behaviour.

---

The `default_to_suites_only` flag is a bit of a hack, but to me it seems like the cleanest way to resolve this problem without having to completely overhaul how CLI paths work, which is a much bigger task. And I think being able to remove the weird extra `--skip` arguments from CI scripts makes this a net positive.

r? jieyouxu
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Jul 12, 2026
bootstrap: Allow path-based skipping of the coverage test suite

- Alternative to rust-lang#159079
---

When bootstrap runs a step by default, without explicit paths, it will normally act as though the user had explicitly requested all of the paths and aliases that the step registered through `ShouldRun`.

For the coverage test suite, that gives the wrong outcome. Running a command like `./x test --skip=tests` or `./x test --skip=coverage` should skip the coverage tests, but instead the coverage tests would run anyway, due to the `coverage-map` and `coverage-run` aliases being treated as implied command-line arguments.

This PR fixes that problem by adding a special flag to `ShouldRun`. When creating pathsets for a step that is being run by default, if the step has set the `default_to_suites_only` flag, all non-suite pathsets are discarded. That gives the desired behaviour for skipping coverage tests, without affecting other steps, since other steps don't set the flag.

The end result is that `./x test --skip=tests` should now skip the coverage tests, as intended. This lets us remove some `--skip` arguments from CI scripts, which were only required by the previous incorrect behaviour.

---

The `default_to_suites_only` flag is a bit of a hack, but to me it seems like the cleanest way to resolve this problem without having to completely overhaul how CLI paths work, which is a much bigger task. And I think being able to remove the weird extra `--skip` arguments from CI scripts makes this a net positive.

r? jieyouxu
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Jul 12, 2026
bootstrap: Allow path-based skipping of the coverage test suite

- Alternative to rust-lang#159079
---

When bootstrap runs a step by default, without explicit paths, it will normally act as though the user had explicitly requested all of the paths and aliases that the step registered through `ShouldRun`.

For the coverage test suite, that gives the wrong outcome. Running a command like `./x test --skip=tests` or `./x test --skip=coverage` should skip the coverage tests, but instead the coverage tests would run anyway, due to the `coverage-map` and `coverage-run` aliases being treated as implied command-line arguments.

This PR fixes that problem by adding a special flag to `ShouldRun`. When creating pathsets for a step that is being run by default, if the step has set the `default_to_suites_only` flag, all non-suite pathsets are discarded. That gives the desired behaviour for skipping coverage tests, without affecting other steps, since other steps don't set the flag.

The end result is that `./x test --skip=tests` should now skip the coverage tests, as intended. This lets us remove some `--skip` arguments from CI scripts, which were only required by the previous incorrect behaviour.

---

The `default_to_suites_only` flag is a bit of a hack, but to me it seems like the cleanest way to resolve this problem without having to completely overhaul how CLI paths work, which is a much bigger task. And I think being able to remove the weird extra `--skip` arguments from CI scripts makes this a net positive.

r? jieyouxu
rust-timer added a commit that referenced this pull request Jul 13, 2026
Rollup merge of #159131 - Zalathar:skip-coverage, r=jieyouxu

bootstrap: Allow path-based skipping of the coverage test suite

- Alternative to #159079
---

When bootstrap runs a step by default, without explicit paths, it will normally act as though the user had explicitly requested all of the paths and aliases that the step registered through `ShouldRun`.

For the coverage test suite, that gives the wrong outcome. Running a command like `./x test --skip=tests` or `./x test --skip=coverage` should skip the coverage tests, but instead the coverage tests would run anyway, due to the `coverage-map` and `coverage-run` aliases being treated as implied command-line arguments.

This PR fixes that problem by adding a special flag to `ShouldRun`. When creating pathsets for a step that is being run by default, if the step has set the `default_to_suites_only` flag, all non-suite pathsets are discarded. That gives the desired behaviour for skipping coverage tests, without affecting other steps, since other steps don't set the flag.

The end result is that `./x test --skip=tests` should now skip the coverage tests, as intended. This lets us remove some `--skip` arguments from CI scripts, which were only required by the previous incorrect behaviour.

---

The `default_to_suites_only` flag is a bit of a hack, but to me it seems like the cleanest way to resolve this problem without having to completely overhaul how CLI paths work, which is a much bigger task. And I think being able to remove the weird extra `--skip` arguments from CI scripts makes this a net positive.

r? jieyouxu
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 T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants