-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Add support for multiple reporters #2183
Conversation
Approval tests added, but ATM failing because of the unhandled mixed stdout capturing strategies. |
Ad stdout capturing: Suppose we have this code: TEST_CASE("foo") {
CHECK(1 == 1);
std::cout << "Hello\n";
CHECK(2 == 2);
std::cout << "World\n";
} and run it as Which brings me to another thing - if the non-capturing reporter output is directed to a file ( Although it likely will be confusing to users. OTOH having prints intermixed with assertions is bad form anyway. Proposal: If both capturing and non-capturing reporters are used at the same time, the output is captured and re-printed to stdout/stderr at the end of the testcase. More generally, let us define that the relative ordering of print messages w.r.t. the reporter output is unspecified. Single-reporter cases are not affected, so this doesn't break compatibility. |
There is actually multiple things that will need to be handled for multiple reporters in a smarter manner, e.g. what if one of the reporters wants to be informed of all assertion successes, while others do not. |
That one was easy (or I got it wrong). But there's a catch: AFAICS, the fact if |
One more generic concern: How long are the approval tests now? For me, they are already the longest individual CTest test. This adds a lot more of them. |
Idea for temporarily workaround for the console colour issue: Colour support is already kinda broken and only works by accident (and sometimes stops working). There is no sane way to support multiple reporters with Windows colours. Thus, let's disable all colours if there are multiple reporters specified, at least temporarily. Later on the colours can be properly reworked. |
00d022a
to
3173df8
Compare
3173df8
to
b1fcb70
Compare
e2f5a80
to
b981b9e
Compare
Codecov Report
@@ Coverage Diff @@
## devel #2183 +/- ##
==========================================
+ Coverage 90.98% 91.13% +0.15%
==========================================
Files 152 152
Lines 7252 7316 +64
==========================================
+ Hits 6598 6667 +69
+ Misses 654 649 -5 |
dceb260
to
4362c0f
Compare
6c2464e
to
741914b
Compare
This requires a bunch of different changes across the reporter subsystem. * We need to handle multiple reporters and their differing preferences in `ListeningReporter`, e.g. what to do when we mix reporters that capture and don't capture stdout. * We need to change how the reporter is given output and how we parse reporter's output destination from CLI. * Approval tests need to handle multireporter option
* Call order of listeners/reporters in multireporter * Adding listeners/reporters properly updates reporter preferences
This should provide the same overall stdout/err, but the new output should feel "faster" for test cases that are entered and exited multiple times (e.g. due to generators).
741914b
to
b5547f2
Compare
Description
This MR adds support for multiple reporters. CLI syntax:
-r xml:output.xml -r console
. The-o
option is still available and determines the default output file, which is used by listeners and reporters without their own output file specified. Only one reporter may use the default output.TODO
--use-colour
per reporter.:
as option delimiter (-r console:out.txt:colour=1
) is problematic because of Windows absolute paths (pathologic example:-r console:c:\colour=1
).clang-format
.GitHub Issues
Addresses #1712