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

compiletest: show the difference between the normalized output and the actual output for lines which didn't match #133733

Merged
merged 1 commit into from
Dec 9, 2024

Conversation

jyn514
Copy link
Member

@jyn514 jyn514 commented Dec 2, 2024

example output:

failures:

---- [ui] tests/ui/layout/enum.rs stdout ----
diff of stderr:

-	error: align: AbiAndPrefAlign { abi: Align(2 bytes), pref: $PREF_ALIGN }
+	error: align: AbiAndPrefAlign { abi: Align(2 bytes), pref: $PREF_ALIN }
2	  --> $DIR/enum.rs:9:1
3	   |
4	LL | enum UninhabitedVariantAlign {

Note: some mismatched output was normalized before being compared
-	error: align: AbiAndPrefAlign { abi: Align(2 bytes), pref: Align(8 bytes) }
-	  --> /home/jyn/src/rust2/tests/ui/layout/enum.rs:9:1
+	error: align: AbiAndPrefAlign { abi: Align(2 bytes), pref: $PREF_ALIN }

@rustbot rustbot added A-compiletest Area: The compiletest test runner A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels Dec 2, 2024
@rustbot
Copy link
Collaborator

rustbot commented Dec 2, 2024

Some changes occurred in src/tools/compiletest

cc @jieyouxu

@jyn514
Copy link
Member Author

jyn514 commented Dec 2, 2024

let's just r? jieyouxu since you have context from discord already

@rustbot rustbot assigned jieyouxu and unassigned onur-ozkan Dec 2, 2024
@jyn514
Copy link
Member Author

jyn514 commented Dec 2, 2024

  • it takes up less than a tenth of the total stderr output

i am a little unsure about this heuristic, i worry that people will still want to see some of the diff to get an idea of what the errors are?

@jyn514
Copy link
Member Author

jyn514 commented Dec 2, 2024

oh, also i am going to change this to unconditionally print the full stdout if you pass --verbose

Copy link
Member

@jieyouxu jieyouxu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR. Some general feedback:

  1. We shouldn't hide the rustc command by default because very often contributors will need to look at the command to determine the exact invocation used which can also be used to repro outside of the test framework. I asked about this previously over at https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/Vibe.20check.20on.20suppressing.20failed.20test.20command.20invocation, see PR compiletest failing tests aren't that noisy by default #131182 and summary. Maybe a config toggle (extra work impl wise). Note that --verbose will also dump a bunch of other things IIRC.
  2. I'm not sure if we want to show only one of the diffs, otherwise a contributor will have to rerun this multiple times instead of getting the full list. EDIT: probably misinterpreted
  3. I think hiding the full stderr is okay outside of CI, but I'll make a poll about this in compiler zulip channel. https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/Vibe.20check.20on.20hiding.20full.20test.20stderr.20outside.20of.20CI

@jyn514
Copy link
Member Author

jyn514 commented Dec 3, 2024

I'm not sure if we want to show only one of the diffs, otherwise a contributor will have to rerun this multiple times instead of getting the full list.

i don't understand what you mean by this. what are the other diffs you think are being hidden?

@jyn514 jyn514 force-pushed the compiletest-diffs branch from 50fd83c to fa85f12 Compare December 3, 2024 02:24
@jyn514
Copy link
Member Author

jyn514 commented Dec 3, 2024

i have changed this to do nothing except show the diff between the actual stderr and the normalized output.

@jyn514 jyn514 changed the title Make compiletest diffs more useful compiletest: show the difference between the normalized output and th… Dec 3, 2024
@jyn514 jyn514 changed the title compiletest: show the difference between the normalized output and th… compiletest: show the difference between the normalized output and the actual output for lines which didn't match Dec 3, 2024
@rust-log-analyzer

This comment has been minimized.

@jieyouxu
Copy link
Member

jieyouxu commented Dec 3, 2024

i don't understand what you mean by this. what are the other diffs you think are being hidden?

I think I misinterpreted when you said

Outside of CI, only show one of the diff and the full stderr

Copy link
Member

@jieyouxu jieyouxu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, you can r=me after PR CI is green.

@jieyouxu
Copy link
Member

jieyouxu commented Dec 3, 2024

@bors delegate+

@bors
Copy link
Contributor

bors commented Dec 3, 2024

✌️ @jyn514, you can now approve this pull request!

If @jieyouxu told you to "r=me" after making some further change, please make that change, then do @bors r=@jieyouxu

@jieyouxu jieyouxu added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Dec 4, 2024
@bors
Copy link
Contributor

bors commented Dec 4, 2024

☔ The latest upstream changes (presumably #133841) made this pull request unmergeable. Please resolve the merge conflicts.

@jyn514 jyn514 force-pushed the compiletest-diffs branch from fa85f12 to 4ba7019 Compare December 5, 2024 01:11
@jyn514
Copy link
Member Author

jyn514 commented Dec 5, 2024

@bors r=jieyouxu

@jieyouxu
Copy link
Member

jieyouxu commented Dec 7, 2024

@bors r- (needs a rebase)

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Dec 7, 2024
…e actual output for lines which didn't match

example output:
```
failures:

---- [ui] tests/ui/layout/enum.rs stdout ----
diff of stderr:

-	error: align: AbiAndPrefAlign { abi: Align(2 bytes), pref: $PREF_ALIGN }
+	error: align: AbiAndPrefAlign { abi: Align(2 bytes), pref: $PREF_ALIN }
2	  --> $DIR/enum.rs:9:1
3	   |
4	LL | enum UninhabitedVariantAlign {

Note: some mismatched output was normalized before being compared
-	error: align: AbiAndPrefAlign { abi: Align(2 bytes), pref: Align(8 bytes) }
-	  --> /home/jyn/src/rust2/tests/ui/layout/enum.rs:9:1
+	error: align: AbiAndPrefAlign { abi: Align(2 bytes), pref: $PREF_ALIN }
```
@jieyouxu
Copy link
Member

jieyouxu commented Dec 7, 2024

Rebased due to one single eprintln vs println difference, no functional changes. Retested locally e.g.

Note: some mismatched output was normalized before being compared
-       error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
-         --> /home/joe/repos/rust/tests/ui/alias-uninit-value.rs:8:12
+       error[E0277]: the meow values of type `[u8]` cannot be known at compilation time
+          = help: unsized fn params are gated as an unstable feature

@jieyouxu
Copy link
Member

jieyouxu commented Dec 7, 2024

@bors r+ rollup (trivial rebase, no functional changes)

@bors
Copy link
Contributor

bors commented Dec 7, 2024

📌 Commit 8aacd1c has been approved by jieyouxu

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Dec 7, 2024
workingjubilee added a commit to workingjubilee/rustc that referenced this pull request Dec 7, 2024
 compiletest: show the difference between the normalized output and the actual output for lines which didn't match

example output:
```
failures:

---- [ui] tests/ui/layout/enum.rs stdout ----
diff of stderr:

-	error: align: AbiAndPrefAlign { abi: Align(2 bytes), pref: $PREF_ALIGN }
+	error: align: AbiAndPrefAlign { abi: Align(2 bytes), pref: $PREF_ALIN }
2	  --> $DIR/enum.rs:9:1
3	   |
4	LL | enum UninhabitedVariantAlign {

Note: some mismatched output was normalized before being compared
-	error: align: AbiAndPrefAlign { abi: Align(2 bytes), pref: Align(8 bytes) }
-	  --> /home/jyn/src/rust2/tests/ui/layout/enum.rs:9:1
+	error: align: AbiAndPrefAlign { abi: Align(2 bytes), pref: $PREF_ALIN }
```
bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 7, 2024
…kingjubilee

Rollup of 11 pull requests

Successful merges:

 - rust-lang#131669 (lint: change help for pointers to dyn types in FFI)
 - rust-lang#133265 (Add a range argument to vec.extract_if)
 - rust-lang#133733 ( compiletest: show the difference between the normalized output and the actual output for lines which didn't match)
 - rust-lang#133955 (Pass the arch rather than full target name to windows_registry::find_tool)
 - rust-lang#133967 ([AIX] Pass -bnoipath when adding rust upstream dynamic crates)
 - rust-lang#133976 (Removed Unnecessary Spaces From RELEASES.md)
 - rust-lang#133980 ([AIX] Remove option "-n" from AIX "ln" command)
 - rust-lang#133987 (Define acronym for thread local storage)
 - rust-lang#133992 (Actually walk into lifetimes and attrs in `EarlyContextAndPass`)
 - rust-lang#133993 (Fix: typo in E0751 error explanation)
 - rust-lang#133996 (Move most tests for `-l` and `#[link(..)]` into `tests/ui/link-native-libs`)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 7, 2024
…kingjubilee

Rollup of 11 pull requests

Successful merges:

 - rust-lang#131669 (lint: change help for pointers to dyn types in FFI)
 - rust-lang#133265 (Add a range argument to vec.extract_if)
 - rust-lang#133733 ( compiletest: show the difference between the normalized output and the actual output for lines which didn't match)
 - rust-lang#133955 (Pass the arch rather than full target name to windows_registry::find_tool)
 - rust-lang#133967 ([AIX] Pass -bnoipath when adding rust upstream dynamic crates)
 - rust-lang#133976 (Removed Unnecessary Spaces From RELEASES.md)
 - rust-lang#133980 ([AIX] Remove option "-n" from AIX "ln" command)
 - rust-lang#133987 (Define acronym for thread local storage)
 - rust-lang#133992 (Actually walk into lifetimes and attrs in `EarlyContextAndPass`)
 - rust-lang#133993 (Fix: typo in E0751 error explanation)
 - rust-lang#133996 (Move most tests for `-l` and `#[link(..)]` into `tests/ui/link-native-libs`)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 7, 2024
…kingjubilee

Rollup of 11 pull requests

Successful merges:

 - rust-lang#131669 (lint: change help for pointers to dyn types in FFI)
 - rust-lang#133265 (Add a range argument to vec.extract_if)
 - rust-lang#133733 ( compiletest: show the difference between the normalized output and the actual output for lines which didn't match)
 - rust-lang#133955 (Pass the arch rather than full target name to windows_registry::find_tool)
 - rust-lang#133967 ([AIX] Pass -bnoipath when adding rust upstream dynamic crates)
 - rust-lang#133976 (Removed Unnecessary Spaces From RELEASES.md)
 - rust-lang#133980 ([AIX] Remove option "-n" from AIX "ln" command)
 - rust-lang#133987 (Define acronym for thread local storage)
 - rust-lang#133992 (Actually walk into lifetimes and attrs in `EarlyContextAndPass`)
 - rust-lang#133993 (Fix: typo in E0751 error explanation)
 - rust-lang#133996 (Move most tests for `-l` and `#[link(..)]` into `tests/ui/link-native-libs`)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 7, 2024
…kingjubilee

Rollup of 11 pull requests

Successful merges:

 - rust-lang#131669 (lint: change help for pointers to dyn types in FFI)
 - rust-lang#133265 (Add a range argument to vec.extract_if)
 - rust-lang#133733 ( compiletest: show the difference between the normalized output and the actual output for lines which didn't match)
 - rust-lang#133955 (Pass the arch rather than full target name to windows_registry::find_tool)
 - rust-lang#133967 ([AIX] Pass -bnoipath when adding rust upstream dynamic crates)
 - rust-lang#133976 (Removed Unnecessary Spaces From RELEASES.md)
 - rust-lang#133980 ([AIX] Remove option "-n" from AIX "ln" command)
 - rust-lang#133987 (Define acronym for thread local storage)
 - rust-lang#133992 (Actually walk into lifetimes and attrs in `EarlyContextAndPass`)
 - rust-lang#133993 (Fix: typo in E0751 error explanation)
 - rust-lang#133996 (Move most tests for `-l` and `#[link(..)]` into `tests/ui/link-native-libs`)

r? `@ghost`
`@rustbot` modify labels: rollup
workingjubilee added a commit to workingjubilee/rustc that referenced this pull request Dec 8, 2024
 compiletest: show the difference between the normalized output and the actual output for lines which didn't match

example output:
```
failures:

---- [ui] tests/ui/layout/enum.rs stdout ----
diff of stderr:

-	error: align: AbiAndPrefAlign { abi: Align(2 bytes), pref: $PREF_ALIGN }
+	error: align: AbiAndPrefAlign { abi: Align(2 bytes), pref: $PREF_ALIN }
2	  --> $DIR/enum.rs:9:1
3	   |
4	LL | enum UninhabitedVariantAlign {

Note: some mismatched output was normalized before being compared
-	error: align: AbiAndPrefAlign { abi: Align(2 bytes), pref: Align(8 bytes) }
-	  --> /home/jyn/src/rust2/tests/ui/layout/enum.rs:9:1
+	error: align: AbiAndPrefAlign { abi: Align(2 bytes), pref: $PREF_ALIN }
```
bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 8, 2024
…kingjubilee

Rollup of 10 pull requests

Successful merges:

 - rust-lang#133522 (Don't suggest restricting bound with unstable traits on stable and mention it's unstable on nightly)
 - rust-lang#133733 ( compiletest: show the difference between the normalized output and the actual output for lines which didn't match)
 - rust-lang#133861 (Add allocate_bytes and refactor allocate_str in InterpCx for raw byte…)
 - rust-lang#133967 ([AIX] Pass -bnoipath when adding rust upstream dynamic crates)
 - rust-lang#133976 (Removed Unnecessary Spaces From RELEASES.md)
 - rust-lang#133980 ([AIX] Remove option "-n" from AIX "ln" command)
 - rust-lang#133987 (Define acronym for thread local storage)
 - rust-lang#133992 (Actually walk into lifetimes and attrs in `EarlyContextAndPass`)
 - rust-lang#133993 (Fix: typo in E0751 error explanation)
 - rust-lang#133996 (Move most tests for `-l` and `#[link(..)]` into `tests/ui/link-native-libs`)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 8, 2024
…kingjubilee

Rollup of 10 pull requests

Successful merges:

 - rust-lang#133522 (Don't suggest restricting bound with unstable traits on stable and mention it's unstable on nightly)
 - rust-lang#133733 ( compiletest: show the difference between the normalized output and the actual output for lines which didn't match)
 - rust-lang#133861 (Add allocate_bytes and refactor allocate_str in InterpCx for raw byte…)
 - rust-lang#133967 ([AIX] Pass -bnoipath when adding rust upstream dynamic crates)
 - rust-lang#133976 (Removed Unnecessary Spaces From RELEASES.md)
 - rust-lang#133980 ([AIX] Remove option "-n" from AIX "ln" command)
 - rust-lang#133987 (Define acronym for thread local storage)
 - rust-lang#133992 (Actually walk into lifetimes and attrs in `EarlyContextAndPass`)
 - rust-lang#133993 (Fix: typo in E0751 error explanation)
 - rust-lang#133996 (Move most tests for `-l` and `#[link(..)]` into `tests/ui/link-native-libs`)

r? `@ghost`
`@rustbot` modify labels: rollup
workingjubilee added a commit to workingjubilee/rustc that referenced this pull request Dec 8, 2024
 compiletest: show the difference between the normalized output and the actual output for lines which didn't match

example output:
```
failures:

---- [ui] tests/ui/layout/enum.rs stdout ----
diff of stderr:

-	error: align: AbiAndPrefAlign { abi: Align(2 bytes), pref: $PREF_ALIGN }
+	error: align: AbiAndPrefAlign { abi: Align(2 bytes), pref: $PREF_ALIN }
2	  --> $DIR/enum.rs:9:1
3	   |
4	LL | enum UninhabitedVariantAlign {

Note: some mismatched output was normalized before being compared
-	error: align: AbiAndPrefAlign { abi: Align(2 bytes), pref: Align(8 bytes) }
-	  --> /home/jyn/src/rust2/tests/ui/layout/enum.rs:9:1
+	error: align: AbiAndPrefAlign { abi: Align(2 bytes), pref: $PREF_ALIN }
```
bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 8, 2024
[TEST] Rollup of 5 pull requests

Successful merges:

 - rust-lang#133733 ( compiletest: show the difference between the normalized output and the actual output for lines which didn't match)
 - rust-lang#133861 (Add allocate_bytes and refactor allocate_str in InterpCx for raw byte…)
 - rust-lang#133967 ([AIX] Pass -bnoipath when adding rust upstream dynamic crates)
 - rust-lang#133976 (Removed Unnecessary Spaces From RELEASES.md)
 - rust-lang#133980 ([AIX] Remove option "-n" from AIX "ln" command)

r? `@ghost`
`@rustbot` modify labels: rollup

try-job: i686-mingw
bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 8, 2024
…iaskrgr

Rollup of 7 pull requests

Successful merges:

 - rust-lang#133424 (Parse guard patterns)
 - rust-lang#133733 ( compiletest: show the difference between the normalized output and the actual output for lines which didn't match)
 - rust-lang#133993 (Fix: typo in E0751 error explanation)
 - rust-lang#134013 (Adds new intrinsic declaration)
 - rust-lang#134020 (Remove unnecessary `int_type_width_signed` function)
 - rust-lang#134024 (Advent of `tests/ui` (misc cleanups and improvements) [2/N])
 - rust-lang#134038 (deps: Update psm)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 8, 2024
…iaskrgr

Rollup of 7 pull requests

Successful merges:

 - rust-lang#133424 (Parse guard patterns)
 - rust-lang#133733 ( compiletest: show the difference between the normalized output and the actual output for lines which didn't match)
 - rust-lang#133993 (Fix: typo in E0751 error explanation)
 - rust-lang#134013 (Adds new intrinsic declaration)
 - rust-lang#134020 (Remove unnecessary `int_type_width_signed` function)
 - rust-lang#134024 (Advent of `tests/ui` (misc cleanups and improvements) [2/N])
 - rust-lang#134038 (deps: Update psm)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit c05e7bd into rust-lang:master Dec 9, 2024
6 checks passed
@rustbot rustbot added this to the 1.85.0 milestone Dec 9, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Dec 9, 2024
Rollup merge of rust-lang#133733 - jyn514:compiletest-diffs, r=jieyouxu

 compiletest: show the difference between the normalized output and the actual output for lines which didn't match

example output:
```
failures:

---- [ui] tests/ui/layout/enum.rs stdout ----
diff of stderr:

-	error: align: AbiAndPrefAlign { abi: Align(2 bytes), pref: $PREF_ALIGN }
+	error: align: AbiAndPrefAlign { abi: Align(2 bytes), pref: $PREF_ALIN }
2	  --> $DIR/enum.rs:9:1
3	   |
4	LL | enum UninhabitedVariantAlign {

Note: some mismatched output was normalized before being compared
-	error: align: AbiAndPrefAlign { abi: Align(2 bytes), pref: Align(8 bytes) }
-	  --> /home/jyn/src/rust2/tests/ui/layout/enum.rs:9:1
+	error: align: AbiAndPrefAlign { abi: Align(2 bytes), pref: $PREF_ALIN }
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-compiletest Area: The compiletest test runner A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants