Skip to content

Tracking issue for libtest JSON output #49359

@Gilnaa

Description

@Gilnaa

Added in #46450
Available in nightly behind a -Z flag.

Activity

added
B-unstableBlocker: Implemented in the nightly compiler and unstable.
T-dev-toolsRelevant to the dev-tools subteam, which will review and decide on the PR/issue.
on Mar 25, 2018
added
A-testsuiteArea: The testsuite used to check the correctness of rustc
C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFC
on Jun 29, 2018
johnterickson

johnterickson commented on Feb 21, 2019

@johnterickson
Contributor

@nrc You mentioned "The long-term solution is going to be deeply intertwined with pluggable test runners" in #46450. Does that mean that JSON won't be stabilized until there are pluggable test runners?

I'm trying to figure out if it makes sense for me to continue looking at #51924 right now, or if I should hold off for the time being. For example, I'm looking at adding test durations to the JSON (master...johnterickson:testjson) and converting the output to JUnit (https://github.com/johnterickson/cargo2junit/).

djrenren

djrenren commented on Feb 26, 2019

@djrenren
Contributor

Yeah I think we should stabilize something like this independently of custom test frameworks. It makes sense that the included test framework would have a programmatically readable output. Libtest's conceptual model is pretty simple and most likely won't undergo any drastic changes so I'm all for stabilizing something. I'd prefer to have a JSON Schema that describes the structure before stabilization. We'd also need to audit to ensure it's resilient to any minor changes or additions over time.

@alexcrichton thoughts?

alexcrichton

alexcrichton commented on Feb 26, 2019

@alexcrichton
Member

Seems like a plausible addition to me! So long as it's designed careful I think it'd be good to go

epage

epage commented on Feb 27, 2019

@epage
Contributor

From the experience of creating naiive serde structs / enums for libtest's output, here are my thoughts from translating it exactly how it is written in libtest (rather than inventing my own schema that happens to be compatible):

  • For suites / tests, the data is two enums nested. For some cases, this might work well, for others, it is unnecessary nesting to deal with.
  • Probably the most annoying aspect is that the type field conflates suite/test being finished and why it finished. This is annoying for if you want to get information regardless of the completion status/.
  • No bench start even is sent
  • My gut is telling me that the bench event is too narrowly focused on the output of the current implementation and not on what might be wanted

My PR where you can see the data structure's I created: https://github.com/crate-ci/escargot/pull/24/files

Ideas to consider

  • Combine event and type fields. Unsure of the value of this
  • Split type field into type and status and define more fields as being available for all types. For example, it could be useful to programmatically report stdout for a successful test and leave it to the rendering engine to decide whether to ignore it or not. This doesn't mean all test implementations need to report all of the fields, but define it as possible.
  • Get someone from other bench implementations, like criterion, to review the bench schema.
andoriyu

andoriyu commented on Mar 3, 2019

@andoriyu
Contributor

I think it's worth adding things like package and type of test. Type of test: unit test, doc test, integration test.

The package is something like: module for unit test, resource path for doc test (crate::foo::Bar), and filename for integration test.

epage

epage commented on Mar 4, 2019

@epage
Contributor

Since libtest tracks test times (at minimum, reporting if its taking too long), it would be nice if that got included in the programmatic output so we can report it to the user, e.g. in JUnit. Alternatively, we'd have to timestamp the events as we read them.

johnterickson

johnterickson commented on Mar 6, 2019

@johnterickson
Contributor

@epage / @andoriyu Are one of you planning on proposing a better schema? I like what you're proposing.

rbtcollins

rbtcollins commented on Apr 24, 2019

@rbtcollins
Contributor

If I may add a semi-random thing; https://github.com/testing-cabal/subunit is a testing protocol thats been around for a while (one of a number) - the V2 even model is very similar in nature to your proposed JSON output schema. There is a rust implementation of the binary serialisation https://github.com/mtreinish/subunit-rust and I'm interested / planning on doing a JSON variant of V2 at some point for use with web stacks.

All of which to say two things I guess - consider thinking about chunking stdout/err, allowing additional streams, tags, and possibly, if its interesting, consider adopting the same model - I think it would be a super set of libtests current needs.

Of course, doing a new schema and having folk write adapters is complete fine too; I just saw this ticket and thought I'd offer this kibbitz :)

109 remaining items

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-libtestArea: `#[test]` / the `test` libraryB-unstableBlocker: Implemented in the nightly compiler and unstable.C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.T-testing-devexRelevant to the testing devex team (testing DX), which will review and decide on the PR/issue.

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @ehuss@epage@alexcrichton@Alxandr@andoriyu

        Issue actions

          Tracking issue for libtest JSON output · Issue #49359 · rust-lang/rust