diff options
| author | Matt Rasa | 2026-07-31 09:37:21 -0400 |
|---|---|---|
| committer | Martin Hořeňovský | 2026-08-11 00:08:23 +0200 |
| commit | 0aeb818520028ca05cc2539ed242402ef7a7ae41 (patch) | |
| tree | 90a9179143b09ae2c41b1ec62bb110f756aa09ad /src/catch2/catch_session.cpp | |
| parent | 97ec4e8e2e4a86719701746d1cb2426f16292ff8 (diff) | |
| download | catch3-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.cpp | 13 |
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() ); |