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

Stabilize json output #42

Open
epage opened this issue Jun 2, 2023 · 10 comments
Open

Stabilize json output #42

epage opened this issue Jun 2, 2023 · 10 comments
Labels
A-libtest2 Area: libtest implemented on top of the new harness C-enhancement Category: Raise on the bar on expectations
Milestone

Comments

@epage
Copy link
Contributor

epage commented Jun 2, 2023

This is to track our effort for stabilizing our json putput

Open questions

  • Currently, success is "status": null, should it be "status": "success"?
  • Benchmarking support
  • Whether json output should be included rendered output, see Stabilize json output #42 (comment)
@epage epage added A-libtest2 Area: libtest implemented on top of the new harness C-enhancement Category: Raise on the bar on expectations labels Jun 2, 2023
@epage
Copy link
Contributor Author

epage commented Jun 2, 2023

@pietroalbini privately raised a concern that rendered output should be included for pretty / terse. This is to make it easier when callers need to capture json messages while still rendering output, which they did for bootstrap

On the flip side

  • I'm trying to shift knowledge of pretty/terse to cargo and change their meaning
  • To reuse the rendered output is messy as it gets into whether its multi-threaded or not, whether multiple items are supposed to be printed per-line, the as-you-go details vs failure report, etc. This feels like a stabilization nightmare to get these scenarios to work out
  • We are trying to open the door more for custom test harnesses. Do we put the complexity on the author of harnesses or on the test reporters?

@pietroalbini
Copy link
Member

I'm trying to shift knowledge of pretty/terse to cargo and change their meaning

Would this mean there'd be no renderer in libtest anymore? That'd force anyone not using cargo to reimplement it for themselves. In addition to other build systems, compiletest uses libtest directly without cargo.

To reuse the rendered output is messy as it gets into whether its multi-threaded or not, whether multiple items are supposed to be printed per-line, the as-you-go details vs failure report, etc. This feels like a stabilization nightmare to get these scenarios to work out

A possible solution would be to have a new output event, that is emitted separately from the "normal" JSON events every time a write is called by the pretty/terse renderer.

We are trying to open the door more for custom test harnesses. Do we put the complexity on the author of harnesses or on the test reporters?

I imagine we'll eventually standardize to a small-ish number of test harnesses, while I can easily see lots of project hacking together scripts using the JSON events in CI.

@epage
Copy link
Contributor Author

epage commented Jun 2, 2023

Would this mean there'd be no renderer in libtest anymore? That'd force anyone not using cargo to reimplement it for themselves. In addition to other build systems, compiletest uses libtest directly without cargo.

Most likely, the renderer would be frozen as-is and custom test harnesses could choose to render as they wish for default and --quiet

A possible solution would be to have a new output event, that is emitted separately from the "normal" JSON events every time a write is called by the pretty/terse renderer.

Which renderer? Both at once? If not, how does the user select?

And is this "output" supposed to literally be the equivalent of all of the write calls? Thats the only way I can see that working. We'd then likely also need to include an Event for flushing.

@epage
Copy link
Contributor Author

epage commented Jun 7, 2023

On the upstream issue, I saw https://github.com/testing-cabal/subunit / https://github.com/mtreinish/subunit-rust mentioned and will need to take a look, either for inspiration or if we can use it outright.

@epage
Copy link
Contributor Author

epage commented Jun 7, 2023

pytest's test / testsuite property might be reasonable to support. I've already been thinking of the issue between benchmark metrics and general test metrics. The general test metrics could just be properties.

@epage
Copy link
Contributor Author

epage commented Jun 7, 2023

And someone created a json format for pytest: https://github.com/numirias/pytest-json-report

An ndjson one which has the potential to be merged is https://github.com/pytest-dev/pytest-reportlog

@epage
Copy link
Contributor Author

epage commented Jun 9, 2023

@pietroalbini
Copy link
Member

pietroalbini commented Jun 10, 2023

Which renderer? Both at once? If not, how does the user select?

I would include only one renderer at the time (to avoid hardcoding "terse" vs "verbose" in the output), not sure how to encode that. Maybe json+terse, json+verbose as the format name?

And is this "output" supposed to literally be the equivalent of all of the write calls? Thats the only way I can see that working. We'd then likely also need to include an Event for flushing.

Yeah, I'd also include an event for flushing. That way third party runners shouldn't have many problems supporting this.

@epage
Copy link
Contributor Author

epage commented Oct 6, 2023

We should probably dig into these ideas for exploring the ability to support these in the future if we need it

@epage
Copy link
Contributor Author

epage commented Oct 6, 2023

Similarly, we should look to TAP for ideas.

@epage epage added this to the json output milestone Feb 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-libtest2 Area: libtest implemented on top of the new harness C-enhancement Category: Raise on the bar on expectations
Projects
None yet
Development

No branches or pull requests

2 participants