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

summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMartin Hořeňovský2025-07-10 23:40:16 +0200
committerMartin Hořeňovský2025-07-10 23:51:31 +0200
commitb62413aee344b346d120ccdc676fedf4bd6233b3 (patch)
tree194bca489bf0987d687562d9aa9923d0e9e3b967
parent3839e27f056cd975e5be2faa9adb5a8cf1f5dcf4 (diff)
downloadcatch3-b62413aee344b346d120ccdc676fedf4bd6233b3.tar.gz
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
-rw-r--r--src/catch2/reporters/catch_reporter_compact.cpp3
-rw-r--r--src/catch2/reporters/catch_reporter_console.cpp3
-rw-r--r--src/catch2/reporters/catch_reporter_tap.cpp3
3 files changed, 6 insertions, 3 deletions
diff --git a/src/catch2/reporters/catch_reporter_compact.cpp b/src/catch2/reporters/catch_reporter_compact.cpp
index 0f855944..6d2c8655 100644
--- a/src/catch2/reporters/catch_reporter_compact.cpp
+++ b/src/catch2/reporters/catch_reporter_compact.cpp
@@ -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 ) {
diff --git a/src/catch2/reporters/catch_reporter_console.cpp b/src/catch2/reporters/catch_reporter_console.cpp
index 9529f39a..518e57f8 100644
--- a/src/catch2/reporters/catch_reporter_console.cpp
+++ b/src/catch2/reporters/catch_reporter_console.cpp
@@ -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() {
diff --git a/src/catch2/reporters/catch_reporter_tap.cpp b/src/catch2/reporters/catch_reporter_tap.cpp
index 67d406fb..d7e68bfd 100644
--- a/src/catch2/reporters/catch_reporter_tap.cpp
+++ b/src/catch2/reporters/catch_reporter_tap.cpp
@@ -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 ) {