Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

./x.py test doesn't respect --json-output for rustc error messages #133855

Closed
bjorn3 opened this issue Dec 4, 2024 · 4 comments · Fixed by #133875
Closed

./x.py test doesn't respect --json-output for rustc error messages #133855

bjorn3 opened this issue Dec 4, 2024 · 4 comments · Fixed by #133875
Labels
A-test-infra Area: test infrastructure (may span bootstrap/compiletest/more) T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

Comments

@bjorn3
Copy link
Member

bjorn3 commented Dec 4, 2024

./x.py check doesn't check tests for the standard library, so I have to use ./x.py test instead when editing tests. Because --json-output is not respected for ./x.py test by bootstrap, I can't get inline error messages in my ide.

@bjorn3 bjorn3 added the T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) label Dec 4, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Dec 4, 2024
@jieyouxu jieyouxu added C-bug Category: This is a bug. and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Dec 4, 2024
@onur-ozkan onur-ozkan removed the C-bug Category: This is a bug. label Dec 4, 2024
@onur-ozkan
Copy link
Member

When you run x test, bootstrap runs formatting with rustfmt which doesn't support JSON outputs. As a workaround, you can run x test on a specific path to skip formatting so you can use the --json-output flag.

@bjorn3
Copy link
Member Author

bjorn3 commented Dec 4, 2024

I was already doing ./x.py test library/alloc, but it still didn't show errors as json messages. AFAICT the issue is that bootstrap doesn't pass --message-format json for cargo test invocations.

@onur-ozkan
Copy link
Member

That's another problem then, will check that tomorrow.

@jieyouxu jieyouxu added the A-test-infra Area: test infrastructure (may span bootstrap/compiletest/more) label Dec 5, 2024
@onur-ozkan
Copy link
Member

Should be fixed with 10f1238.

@bors bors closed this as completed in 8c78d7a Dec 7, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Dec 7, 2024
Rollup merge of rust-lang#133875 - onur-ozkan:early-return-rustfmt, r=jieyouxu

handle `--json-output` properly

Because `rustfmt` doesn't support JSON output, `x test --json-output` doesn't respect the `--json-output` flag during formatting step. This change makes that `x test` skips the formatting step if `--json-output` is specified. In addition, resolves rust-lang#133855 with the 2nd commit.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-test-infra Area: test infrastructure (may span bootstrap/compiletest/more) T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants