Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/src/catch2/catch_session.cpp
diff options
context:
space:
mode:
authorMatt Rasa2026-07-31 09:37:21 -0400
committerMartin Hořeňovský2026-08-11 00:08:23 +0200
commit0aeb818520028ca05cc2539ed242402ef7a7ae41 (patch)
tree90a9179143b09ae2c41b1ec62bb110f756aa09ad /src/catch2/catch_session.cpp
parent97ec4e8e2e4a86719701746d1cb2426f16292ff8 (diff)
downloadcatch3-0aeb818520028ca05cc2539ed242402ef7a7ae41.tar.gz
Emit warning when using --shard-count (> 1) with --order rand
Diffstat (limited to 'src/catch2/catch_session.cpp')
-rw-r--r--src/catch2/catch_session.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/catch2/catch_session.cpp b/src/catch2/catch_session.cpp
index 97def8dc..5e9c5c19 100644
--- a/src/catch2/catch_session.cpp
+++ b/src/catch2/catch_session.cpp
@@ -348,6 +348,19 @@ namespace Catch {
CATCH_TRY {
config(); // Force config to be constructed
+ if ( m_config->shardCount() > 1 &&
+ m_config->runOrder() == TestRunOrder::Randomized &&
+ !m_config->rngSeedWasFixed() ) {
+ Catch::cerr()
+ << "Warning: using sharding (--shard-count) with random "
+ "order (--order rand, the default) and without a fixed "
+ "numeric --rng-seed does not guarantee disjoint coverage "
+ "between shard invocations. Pass the same numeric "
+ "--rng-seed to every shard, or use --order decl or "
+ "--order lex instead.\n"
+ << std::flush;
+ }
+
// We need to retrieve potential Bazel config with the full Config
// constructor, so we have to create the guard file after it is created.
setUpGuardFile( m_config->getExitGuardFilePath() );