Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upLibtest json output #45923
Conversation
added some commits
Nov 8, 2017
Gilnaa
force-pushed the
Gilnaa:libtest_json_output
branch
from
5943a63
to
336d255
Nov 11, 2017
shepmaster
added
the
T-libs
label
Nov 11, 2017
This comment has been minimized.
This comment has been minimized.
|
Auto-assigning to... r? @Kimundi |
rust-highfive
assigned
Kimundi
Nov 11, 2017
shepmaster
added
the
S-waiting-on-review
label
Nov 11, 2017
This comment has been minimized.
This comment has been minimized.
|
Related issues are |
This comment has been minimized.
This comment has been minimized.
|
Your JSON example output confuses me. Wasn't there discussion of outputting every event as a JSON document? This was also discussed in rust-lang/rfcs#1284. |
This comment has been minimized.
This comment has been minimized.
|
Yeah, I might have misunderstood that one.
Edit: What you linked is a bit in conflict with @matklad request to have separate "events" for tests' start/finish. Otherwise, if the old RFC is acceptable, I'll close this PR and fix my code to match it. |
This comment has been minimized.
This comment has been minimized.
|
So that when an event happens (e.g., a test fails), it can be written
immediately. This way, it's easy to write a tool that displays the progress
interactively and without waiting for the whole test suite to finish.
Gilad Naaman <notifications@github.com> schrieb am Sa. 11. Nov. 2017 um
13:32:
… Yeah, I might have misunderstood that one.
Why would you want each of them to be separate document?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#45923 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AABOXzru6Fo4jM19Db73IKClcy4dJtkTks5s1ZPZgaJpZM4QaL-C>
.
|
This comment has been minimized.
This comment has been minimized.
|
So then I have a few questions:
|
This comment has been minimized.
This comment has been minimized.
|
I have no authority to give any advice on how to do this, I'm just someone from the dev tools team who likes tools that offer machine readable output :)
I just wanted to point out that there's been discussion around this topic. The RFC was closed as the author wanted to rewrite it IIUC. As such, it was never accepted by the Rust team in charge.
Is there a good streaming JSON parser for Rust? I don't think serde_json supports this.
Instead of {
"events": [
{ "test": "t2", "event": "started" },
{ "test": "t2", "event": "failed" },
{ "test": "t1", "event": "started" },
{ "test": "t1", "event": "failed" }
],
"summary": { }
}you'd output something like { "type": "test", "event": "start", "name": "foo::t2" }
{ "type": "test", "event": "start", "name": "bar::t1" }
{ "type": "test", "event": "fail", "name": "foo::t2" }
{ "type": "test", "event": "success", "name": "bar:t1" }
{ "type": "final", "summary": { } }
Same as right now? Does it need to change in any way? When a test is started, you emit an event, when the test finishes (it thread ends) you emit another event depending on the result of the thread (panic/no panic basically). If you really wanted, you could capture stdout/stderr and emit it (line or timeout based) as events in-between, but I haven't really thought about this. |
This comment has been minimized.
This comment has been minimized.
|
I see. I'll contact the other maintainer to make sure I'm not ruining his work somehow. Thanks As for streaming parsers, I hacked one using serde https://github.com/Gilnaa/rusty3bar/blob/master/src/infinite_array.rs |
Gilnaa
closed this
Nov 11, 2017
This comment has been minimized.
This comment has been minimized.
denniscollective
commented
Nov 11, 2017
|
I'm excited to see work happening in this direction, I would love to have more easily machine readable test output. |
Gilnaa commentedNov 10, 2017
•
edited
Added an option to output the tests' summary in Json.
The exact format can use a good bikesheding.
A new "--format" flag is added, with the following options:
-q-qis now an alias to--format=terse, but any--format=overrides-qDiscussed a bit here: https://internals.rust-lang.org/t/alternate-libtest-output-format/6121/12
The actual code generating JSON is a bit messy. I thought about using serde, but I think it's simple enough, and as @matklad said, events should be outputted as they are ready.
Example:
Turns into