Skip to content

ConsoleReporter's stream is not flushed before test execution #2964

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
jtunhag opened this issue Mar 17, 2025 · 0 comments
Open

ConsoleReporter's stream is not flushed before test execution #2964

jtunhag opened this issue Mar 17, 2025 · 0 comments

Comments

@jtunhag
Copy link

jtunhag commented Mar 17, 2025

Describe the bug
Observed problem:
The time between the "Filters: " printout and the "Randomness seeded to: " printout for ConsoleReporter is long. The "Randomness seeded to: " is printed with the actual test output. When one of our test runs timed out, the random seed wasn't even printed at all.

Cause:
This seems to be because m_stream isn't flushed at the end of ConsoleReporter::testRunStarting(). I can not reproduce the issue when running the catch2 executable directly, but it happens when executing through our task runner Invoke, which essentially wraps the catch2 executable in a context.run() statement.

So yeah, it can be debated where the issue really lies, but I'm not sure Invoke or similar tools can do much to know when to output intermediate stream contents. Catch2 definitely knows when to output it's own metadata before any user code/test case is executed.

Expected behavior
The filters, the random seed (and any other needed metadata about the test known beforehand) should be printed before the test is started, for reproducibility.

Reproduction steps
I'm not sure ATM how to provide a small, contained example with Invoke wrapping the executable to reproduce this, but will try to assemble something...

Platform information:

  • OS: Ubuntu 22.04.5 LTS
  • Compiler+version: Ubuntu clang version 14.0.0-1ubuntu1.1
  • Catch version: v3.5.0
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

No branches or pull requests

1 participant