rust-lang / rust-lang/rust

`x test` should support --show-output

Open
#134,210 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-test-infra C-enhancement E-hard T-bootstrap
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

we should teach bootstrap to respect --show-output, which in normal libtest prints the output at the end:

; c t --lib -- --show-output
warning: `[project]` is deprecated in favor of `[package]`
    Finished `test` profile [unoptimized + debuginfo] target(s) in 0.01s
     Running unittests src/lib.rs (/home/jyn/.local/lib/cargo/target/debug/deps/example-d78220620848f9e6)

running 2 tests
test bar ... ok
test foo ... ok

successes:

---- bar stdout ----
jieyouxu

---- foo stdout ----
hi


successes:
    bar
    foo

test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

right now compiletest only supports --nocapture, which doesn't buffer output at all and as a result ends up interleaved with libtest's own progress reporting.

note this is non-trivial because bootstrap reimplements its own formatter for the json output: https://github.com/rust-lang/rust/blob/2a71007bce27ddbf8d9883c99060548ac0d66a0e/src/bootstrap/src/utils/render_tests.rs#L214

Originally posted by @jyn514 in https://github.com/rust-lang/rust/pull/134111#discussion_r1881984253

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with bootstrap's compiletest handling of --nocapture and the formatter in src/bootstrap/src/utils/render_tests.rs, then compare it with the normal libtest --show-output behavior shown in the issue. Done means x test --show-output buffers test output and presents it at the end without interleaving it with progress reporting, including when JSON output is formatted.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
testing-qa, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.