Add stream flushes after reporters print out the test run metadata.

This ensures that the test run metadata are printed even if the
process dies right after.

Closes #2964
This commit is contained in:
Martin Hořeňovský 2025-07-10 23:40:16 +02:00
parent 3839e27f05
commit b62413aee3
No known key found for this signature in database
GPG Key ID: DE48307B8B0D381A
3 changed files with 6 additions and 3 deletions

View File

@ -215,7 +215,8 @@ private:
<< m_config->testSpec()
<< '\n';
}
m_stream << "RNG seed: " << getSeed() << '\n';
m_stream << "RNG seed: " << getSeed() << '\n'
<< std::flush;
}
void CompactReporter::assertionEnded( AssertionStats const& _assertionStats ) {

View File

@ -529,7 +529,8 @@ void ConsoleReporter::testRunStarting(TestRunInfo const& _testRunInfo) {
m_stream << m_colour->guardColour( Colour::BrightYellow ) << "Filters: "
<< m_config->testSpec() << '\n';
}
m_stream << "Randomness seeded to: " << getSeed() << '\n';
m_stream << "Randomness seeded to: " << getSeed() << '\n'
<< std::flush;
}
void ConsoleReporter::lazyPrint() {

View File

@ -196,7 +196,8 @@ namespace Catch {
if ( m_config->testSpec().hasFilters() ) {
m_stream << "# filters: " << m_config->testSpec() << '\n';
}
m_stream << "# rng-seed: " << m_config->rngSeed() << '\n';
m_stream << "# rng-seed: " << m_config->rngSeed() << '\n'
<< std::flush;
}
void TAPReporter::noMatchingTestCases( StringRef unmatchedSpec ) {