Skip to content
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

XML reporter leaves empty file if the process is killed by a signal #663

Closed
horenmar opened this issue May 21, 2016 · 4 comments
Closed

Comments

@horenmar
Copy link
Member

According to the reporter documentation the xml reporter is streaming and thus I would expect at least partial output if the process is killed a by SIGINT. This is true if I run the binary as ./a.out -r xml, but if I run the binary as ./a.out -r xml -o outfile, I end up with an empty file.

In contrast, if I use the default or compact reporter, the output on stdout and in the outfile will be the same, which is a partial output until the signal was encountered.


Using JUnit reporter seems to trigger an assertion:

a.out: ./catch.hpp:8734: virtual void Catch::CumulativeReporterBase::testCaseEnded(const Catch::TestCaseStats &): Assertion `m_sectionStack.size() == 0' failed.
@horenmar
Copy link
Member Author

horenmar commented Jan 6, 2017

Strictly speaking this can be worked-around by redirecting std-out, but it should be investigated anyway.

@philsquared
Copy link
Collaborator

This is potentially fixed by 84af6bc - but needs testing

@philsquared philsquared added the Resolved - pending review Issue waiting for feedback from the original author label Feb 6, 2017
@horenmar
Copy link
Member Author

horenmar commented Feb 6, 2017

This seems to be fixed, just throwing in std::endls is a bit of hack solution, so I am gonna tag this with revisit.

@horenmar horenmar closed this as completed Feb 6, 2017
@horenmar horenmar added Revisit and removed Resolved - pending review Issue waiting for feedback from the original author labels Feb 6, 2017
@Leandros
Copy link

Leandros commented Mar 5, 2018

Occasionally, I get the same assert triggered on my CI builds:

Assertion failed: m_sectionStack.size() == 0 (../extern/lib/catch2/single_include/catch.hpp: testCaseEnded: 3808)

couldn't reproduce it outside, yet, and rerunning the build usually fixes it.
I'm invoking my test executable with the following arguments:

/path/to/teamcity/_out/tests/a -r junit -s -o /path/to/teamcity/_out/tests/a.junit

timblechmann added a commit to timblechmann/Catch2 that referenced this issue Sep 10, 2022
when a test executable is killed by a signal (e.g. when executed by
ctest with timeout), the reporter files are not flushed. this can lead
to incomplete (or empty) report files.
to avoid this we enable automatic flushing via `std::unitbuf`

compare catchorg#663
horenmar pushed a commit that referenced this issue Sep 11, 2022
when a test executable is killed by a signal (e.g. when executed by
ctest with timeout), the reporter files are not flushed. this can lead
to incomplete (or empty) report files.
to avoid this we enable automatic flushing via `std::unitbuf`

compare #663
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants