Skip to content

Stabilize randomized Bazel shards - #3224

Open
mattyclarkson wants to merge 1 commit into
catchorg:develfrom
mattyclarkson:bazel-stable-shards
Open

mattyclarkson wants to merge 1 commit into
catchorg:develfrom
mattyclarkson:bazel-stable-shards

Conversation

@mattyclarkson

Copy link
Copy Markdown

Description

Catch2 defaults to randomized test order, but Bazel does not set TEST_RANDOM_SEED for ordinary sharding. Independent shard processes can therefore select overlapping cases and omit others.

When Bazel enables multiple shards, use declaration order only if the requested order is randomized. Preserve --order=decl and --order=lex, which already have stable membership, and leave non-sharded runs unchanged. Explicitly seeded random order is also replaced by this fallback.

GitHub Issues

None.

@codecov

codecov Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 91.16%. Comparing base (0809213) to head (5f768cf).

Additional details and impacted files
@@            Coverage Diff             @@
##            devel    #3224      +/-   ##
==========================================
- Coverage   91.18%   91.16%   -0.02%     
==========================================
  Files         205      205              
  Lines        9101     9103       +2     
==========================================
  Hits         8298     8298              
- Misses        803      805       +2     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@horenmar horenmar left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

No. Move the check downwards and account for cases where the RNG seed is properly set.

Catch2 defaults to randomized test order, but Bazel does not set TEST_RANDOM_SEED for ordinary sharding. Independent shard processes can therefore select overlapping cases and omit others.

When Bazel enables multiple shards, use declaration order only if the requested order is randomized. Preserve --order=decl and --order=lex, which already have stable membership, and leave non-sharded runs unchanged. Explicitly seeded random order is also replaced by this fallback.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants