I proposed to T-testing-devex that our first order of business should be to stabilize --format json
.
Think of this as a Pre-eRFC. Unsure what route the more official proposal will take for being approved.
What I'm looking for is input on what we should consider when vetting the format to see if it'll be sufficient. See the list below that I've collected so far.
Rust 1.70 fixed libtest so that --format json
required being used with a nightly which highlighted how important it is to people.
--format json
could also help us improve cargo test
, including
- Wanting to run test binaries in parallel, like
cargo nextest
- Lack of summary across all binaries
- Noisy test output (see also #5089)
- Confusing command-line interactions (see also #8903, #10392)
- Poor messaging when a filter doesn't match
- Smarter test execution order (see also #8685, #10673)
- JUnit output is incorrect when running multiple test binaries
- Lack of failure when test binaries exit unexpectedly
Most of that involves shifting responsibilities from the test harness to the test runner which has the side effects of:
- Allowing more powerful experiments with custom test runners (e.g.
cargo nextest
) as they'll have more information to operate on - Lowering the barrier for custom test harnesses (like
libtest-mimic
) as UI responsibilities are shifted to the test runner (cargo test
)
Proposed Plan
While having a plan for evolution takes some burden off of the format, we should still do some due diligence in ensuring the format works well for our intended uses.
My rough idea for a plan is
- Create an experimental test harness that uses a
serde
structure for passing information from its core to different--format
modes, emulating whatlibtest
andcargo
s relationship will be like on a smaller scale for faster iteration - Transition libtest to this proposed interface
- Add experimental support for cargo to interact with test binaries through json
- Create a stabilization report for json for T-libs-api and a cargo RFC for custom test harnesses to opt into this new protocol
Potential considerations when running the experiment to vet the format:
- Plan for future evolution
- Ability to implement different format modes on top
- Both test running and
--list
mode
- Both test running and
- Ability to run test harnesses in parallel
- Tests with multiple failures
- Bench support
- Static and dynamic parameterized tests / test fixtures
- Static and dynamic test skipping
- Test markers
- doctests
- Test location (for IDEs)
- Collect metrics related to tests
- Elapsed time
- Temp dir sizes
- RNG seed
Warning: This doesn't mean they'll all be supported in the initial stabilization just that we feel confident the format will support them)
If you are interested in helping this stabilize the json output, contributing to the experimental harness (when we get there) will be a good area for first-time contributors to the Rust project as most of the code will be new, small, and with no stability / correctness pressure of an existing user base.
Misc
Comments made on libtests format
- Format is complex (see also 1)
- Benches need love
- Type field is overloaded
- Suite/child relationship is missing
- Suite lacks a name
- Format is underspecified
Lacks ignored reason(resolved?)- Lack of
rendered
field
Existing formats
See also