|
| 1 | +# Finish the libtest json output experiment |
| 2 | + |
| 3 | +> **Instructions:** Copy this template to a fresh file with a name based on your plan. |
| 4 | +> Give it a title that describes what you plan to get done in the next 6 months |
| 5 | +> (e.g., "stabilize X" or "nightly support for X" or "gather data about X"). |
| 6 | +> Feel free to replace any text with anything, but there are placeholders |
| 7 | +> designed to help you get started. |
| 8 | +
|
| 9 | +| Metadata | | |
| 10 | +| -------- | ------------------------------------------------------------ | |
| 11 | +| Owner(s) | @epage | |
| 12 | +| Teams | [testing-devex], [libs-api] | |
| 13 | +| Status | Proposed | |
| 14 | + |
| 15 | +## Summary |
| 16 | + |
| 17 | +Finish the [libtest json experiment](https://rust-lang.github.io/rfcs/3558-libtest-json.html). |
| 18 | + |
| 19 | +## Motivation |
| 20 | + |
| 21 | +[libtest](https://github.com/rust-lang/rust/tree/master/library/test) |
| 22 | +is the test harness used by default for tests in cargo projects. |
| 23 | +It provides the CLI that cargo calls into and enumerates and runs the tests discovered in that binary. |
| 24 | +It ships with rustup and has the same compatibility guarantees as the standard library. |
| 25 | + |
| 26 | +Before 1.70, anyone could pass `--format json` despite it being unstable. |
| 27 | +When this was fixed to require nightly, |
| 28 | +this helped show [how much people have come to rely on programmatic output](https://www.reddit.com/r/rust/comments/13xqhbm/announcing_rust_1700/jmji422/). |
| 29 | + |
| 30 | +Cargo could also benefit from programmatic test output to improve user interactions, including |
| 31 | +- [Wanting to run test binaries in parallel](https://github.com/rust-lang/cargo/issues/5609), like `cargo nextest` |
| 32 | +- [Lack of summary across all binaries](https://github.com/rust-lang/cargo/issues/4324) |
| 33 | +- [Noisy test output](https://github.com/rust-lang/cargo/issues/2832) (see also [#5089](https://github.com/rust-lang/cargo/issues/5089)) |
| 34 | +- [Confusing command-line interactions](https://github.com/rust-lang/cargo/issues/1983) (see also [#8903](https://github.com/rust-lang/cargo/issues/8903), [#10392](https://github.com/rust-lang/cargo/issues/10392)) |
| 35 | +- [Poor messaging when a filter doesn't match](https://github.com/rust-lang/cargo/issues/6151) |
| 36 | +- [Smarter test execution order](https://github.com/rust-lang/cargo/issues/6266) (see also [#8685](https://github.com/rust-lang/cargo/issues/8685), [#10673](https://github.com/rust-lang/cargo/issues/10673)) |
| 37 | +- [JUnit output is incorrect when running multiple test binaries](https://github.com/rust-lang/rust/issues/85563) |
| 38 | +- [Lack of failure when test binaries exit unexpectedly](https://github.com/rust-lang/rust/issues/87323) |
| 39 | + |
| 40 | +Most of that involves shifting responsibilities from the test harness to the test runner which has the side effects of: |
| 41 | +- Allowing more powerful experiments with custom test runners (e.g. [`cargo nextest`](https://crates.io/crates/cargo-nextest)) as they'll have more information to operate on |
| 42 | +- Lowering the barrier for custom test harnesses (like [`libtest-mimic`](https://crates.io/crates/libtest-mimic)) as UI responsibilities are shifted to the test runner (`cargo test`) |
| 43 | + |
| 44 | +### The status quo |
| 45 | + |
| 46 | +### The next 6 months |
| 47 | + |
| 48 | +1. Experiment with potential test harness features |
| 49 | +2. Experiment with test reporting moving to Cargo |
| 50 | +3. Putting forward a proposal for approval |
| 51 | + |
| 52 | +### The "shiny future" we are working towards |
| 53 | + |
| 54 | +- Reporting shifts from test harnesses to Cargo |
| 55 | +- We run test harnesses in parallel |
| 56 | + |
| 57 | +## Design axioms |
| 58 | + |
| 59 | +- Low complexity for third-party test harnesses so its feasible to implement them |
| 60 | +- Low compile-time overhead for third-party test harnesses so users are willing to take the compile-time hit to use them |
| 61 | +- Format can meet expected future needs |
| 62 | + - Expected is determined by looking at what other test harnesses can do (e.g. fixture, paramertized tests) |
| 63 | +- Format can evolve with unexpected needs |
| 64 | +- Cargo perform all reporting for tests and benches |
| 65 | + |
| 66 | +## Ownership and team asks |
| 67 | + |
| 68 | +*This section defines the specific work items that are planned and who is expected to do them. It should also include what will be needed from Rust teams. The table below shows some common sets of asks and work, but feel free to adjust it as needed. Every row in the table should either correspond to something done by a contributor or something asked of a team. For items done by a contributor, list the contributor, or ![Heap wanted][] if you don't yet know who will do it. For things asked of teams, list ![Team][] and the name of the team. The things typically asked of teams are defined in the [Definitions](#definitions) section below.* |
| 69 | + |
| 70 | +| Subgoal | Owner(s) or team(s) | Notes | |
| 71 | +| ---------------------------------------------- | ----------------------- | ----- | |
| 72 | +| Discussion and moral support | ![Team][] [testing-devex] | | |
| 73 | +| Prototype harness | @epage | | |
| 74 | +| Prototype Cargo reporting support | @epage | | |
| 75 | +| Write stabilization report | @epage | | |
| 76 | + |
| 77 | +### Definitions |
| 78 | + |
| 79 | +Definitions for terms used above: |
| 80 | + |
| 81 | +* *Discussion and moral support* is the lowest level offering, basically committing the team to nothing but good vibes and general support for this endeavor. |
| 82 | +* *Author RFC* and *Implementation* means actually writing the code, document, whatever. |
| 83 | +* *Design meeting* means holding a synchronous meeting to review a proposal and provide feedback (no decision expected). |
| 84 | +* *RFC decisions* means reviewing an RFC and deciding whether to accept. |
| 85 | +* *Org decisions* means reaching a decision on an organizational or policy matter. |
| 86 | +* *Secondary review* of an RFC means that the team is "tangentially" involved in the RFC and should be expected to briefly review. |
| 87 | +* *Stabilizations* means reviewing a stabilization and report and deciding whether to stabilize. |
| 88 | +* *Standard reviews* refers to reviews for PRs against the repository; these PRs are not expected to be unduly large or complicated. |
| 89 | +* *Prioritized nominations* refers to prioritized lang-team response to nominated issues, with the expectation that there will be *some* response from the next weekly triage meeting. |
| 90 | +* *Dedicated review* means identifying an individual (or group of individuals) who will review the changes, as they're expected to require significant context. |
| 91 | +* Other kinds of decisions: |
| 92 | + * [Lang team experiments](https://lang-team.rust-lang.org/how_to/experiment.html) are used to add nightly features that do not yet have an RFC. They are limited to trusted contributors and are used to resolve design details such that an RFC can be written. |
| 93 | + * Compiler [Major Change Proposal (MCP)](https://forge.rust-lang.org/compiler/mcp.html) is used to propose a 'larger than average' change and get feedback from the compiler team. |
| 94 | + * Library [API Change Proposal (ACP)](https://std-dev-guide.rust-lang.org/development/feature-lifecycle.html) describes a change to the standard library. |
| 95 | + |
| 96 | +## Frequently asked questions |
0 commit comments