rust-lang / rust-lang/cargo

--message-format= should also imply a corresponding flag to test harnesses

Open
#8,903 2 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-json-output C-feature-request Command-test S-needs-design
Dominant language
Rust
Stars
15.5k
Forks
3k
Avg merge
23h 30m
Merged PRs (30d)
51

Description

Describe the problem you are trying to solve

I currently invoke cargo with --message-format=json in order to parse its output and present it to development/review tooling as in-line messages. Cargo currently does not support presenting the test output in a different way. In order to obtain machine-readable output from tests, I need to build the tests with --no-run, collect the test artifacts, and run them manually, while passing --format=json to the harnesses and parse that output, instead.

Describe the solution you'd like

Running with --message-format= should output test progress, status and similar information as the requested message format.
Notes

This would also enable some progress towards #5609. See also https://github.com/rust-lang/cargo/issues/5609#issuecomment-734396116

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 by tracing how cargo test handles --message-format and invokes test harnesses, then read the discussion linked from #5609. The change is complete when test progress and status use the requested message format without requiring --no-run or manual harness execution, with coverage for the supported formats.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.