Skip to content

Conversation

fmeum
Copy link
Collaborator

@fmeum fmeum commented Jul 31, 2025

The existing --experimental_cancel_concurrent_tests flag can be used to let Bazel cancel concurrent runs of the same test as soon as one run passes with --runs_per_test_detects_flakes. This change turns the boolean-valued into an enum-valued flag that also accepts the value on_failed to instead cancel on the first failed run. This can be used to avoid reruns of flaky tests when the intention is to only detect flakes, not their probability of being flaky.

Also fix the quirk that --experimental_cancel_concurrent_tests has no effect with default Bazel settings since the exclusive test strategy is registered last and thus always wins. Perhaps surprisingly, this is the only effect of that incorrect registration order - all other exclusive logic is explicitly gated behind the value of --test_strategy.

RELNOTES[NEW]: The --experimental_cancel_concurrent_tests option now accepts the values on_passed, on_failed and never and cancels concurrent test runs on the first matching result. If enabled, it's now effective by default and no longer requires --test_strategy=standalone to be passed explicitly.

Closes #26630.

PiperOrigin-RevId: 789203343
Change-Id: I5e7838fa3562a1137987efbf2235d22b122e3e51
(cherry picked from commit 205255c)

Closes #26638

The existing `--experimental_cancel_concurrent_tests` flag can be used to let Bazel cancel concurrent runs of the same test as soon as one run passes with `--runs_per_test_detects_flakes`. This change turns the boolean-valued into an enum-valued flag that also accepts the value `on_failed` to instead cancel on the first failed run. This can be used to avoid reruns of flaky tests when the intention is to only detect flakes, not their probability of being flaky.

Also fix the quirk that `--experimental_cancel_concurrent_tests` has no effect with default Bazel settings since the `exclusive` test strategy is registered last and thus always wins. Perhaps surprisingly, this is the only effect of that incorrect registration order - all other `exclusive` logic is explicitly gated behind the value of `--test_strategy`.

RELNOTES[NEW]: The `--experimental_cancel_concurrent_tests` option now accepts the values `on_passed`, `on_failed` and `never` and cancels concurrent test runs on the first matching result. If enabled, it's now effective by default and no longer requires `--test_strategy=standalone` to be passed explicitly.

Closes bazelbuild#26630.

PiperOrigin-RevId: 789203343
Change-Id: I5e7838fa3562a1137987efbf2235d22b122e3e51
(cherry picked from commit 205255c)
@fmeum fmeum requested a review from a team as a code owner July 31, 2025 06:58
@github-actions github-actions bot added team-Configurability platforms, toolchains, cquery, select(), config transitions awaiting-review PR is awaiting review from an assigned reviewer labels Jul 31, 2025
@fmeum fmeum requested a review from meisterT July 31, 2025 07:08
@iancha1992 iancha1992 added this pull request to the merge queue Jul 31, 2025
Merged via the queue into bazelbuild:release-8.4.0 with commit 9cae118 Jul 31, 2025
46 checks passed
@github-actions github-actions bot removed the awaiting-review PR is awaiting review from an assigned reviewer label Jul 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
team-Configurability platforms, toolchains, cquery, select(), config transitions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants