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

On tests that specify --color=always emit SVG file with stderr output #121877

Merged
merged 1 commit into from Mar 3, 2024

Conversation

estebank
Copy link
Contributor

@estebank estebank commented Mar 1, 2024

Leverage anstyle-svg, as cargo does now, to emit .svg files instead of .stderr files for tests that explicitly enable color output. This will make reviewing changes to the graphical output of tests much more human friendly.

@rustbot
Copy link
Collaborator

rustbot commented Mar 1, 2024

r? @Nadrieril

rustbot has assigned @Nadrieril.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added 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) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Mar 1, 2024
@estebank
Copy link
Contributor Author

estebank commented Mar 1, 2024

All credit to @epage for the library as well as @Muscraft for showing me rust-lang/cargo#13461.

@rust-log-analyzer

This comment has been minimized.

@rustbot
Copy link
Collaborator

rustbot commented Mar 1, 2024

These commits modify the Cargo.lock file. Unintentional changes to Cargo.lock can be introduced when switching branches and rebasing PRs.

If this was unintentional then you should revert the changes before this PR is merged.
Otherwise, you can ignore this comment.

@@ -4014,9 +4014,17 @@ impl<'test> TestCx<'test> {
explicit_format: bool,
) -> usize {
let stderr_bits = format!("{}bit.stderr", self.config.get_pointer_width());
let force_color_svg = self.props.compile_flags.iter().any(|s| s.contains("--color"))
&& !self.config.target.contains("windows");
Copy link
Member

Choose a reason for hiding this comment

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

Why is this !windows necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's not absolutely necessary, but I don't have access to a windows box to ensure this test ran and the colors for the ANSI escapes is subtly different between windows and non-windows. Can change that and do a full build on CI to get the windows svg file if we want to land it with it.

Copy link
Contributor

Choose a reason for hiding this comment

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

For annotate-snippets, @Muscraft recently added a testing-colors feature flag to force the colors the same across all platforms so we don't have to deal with platform-specific colors (except for the places we need to to verify they are platform-specific)

Copy link
Member

Choose a reason for hiding this comment

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

I'm just worried that when ui testing on windows platforms, this will cause test failures since compiletest expects stdout files but there are svg files here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I believe that the filter I included was for explicit windows platform request from the test file. I will remove the platform check.

@epage is testing-colors included in 0.1.3?

Copy link
Contributor

Choose a reason for hiding this comment

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

testing-colors is a annotate-snippets feature. Not really relevant until rustc is converted over but just giving an idea of strategies.

Copy link
Member

Choose a reason for hiding this comment

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

I believe that the filter I included was for explicit windows platform request from the test file. I will remove the platform check.

For the record, the variable self.config.target is set for all UI tests, so I believe this will produce observable behavioral differences in compiletest, and not just for tests tagged // only-windows/// ignore-windows.

I will remove the platform check.

Cool, that sounds like the easiest solution.

Copy link
Contributor

Choose a reason for hiding this comment

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

Another solution to this might be to pull the colors out into a separate crate and share them between rustc and annotate-snippets. I have thought about doing this before, but have never talked with enough people to see if it was a good idea. It would make it easier to share the colors during the transition period and allow other crates to match colors in the long run.

@compiler-errors compiler-errors self-assigned this Mar 2, 2024
@compiler-errors
Copy link
Member

@rustbot author

should be good to go after fixing and blessing the window test, but i'd like to take a look at the final results

@rustbot rustbot 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 Mar 2, 2024
@estebank
Copy link
Contributor Author

estebank commented Mar 2, 2024

@bors try

@bors
Copy link
Contributor

bors commented Mar 2, 2024

⌛ Trying commit d8961f0 with merge 63ee2ef...

bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 2, 2024
On tests that specify `--color=always` emit SVG file with stderr output

Leverage `anstyle-svg`, as `cargo` does now, to emit `.svg` files instead of `.stderr` files for tests that explicitly enable color output. This will make reviewing changes to the graphical output of tests much more human friendly.
@compiler-errors
Copy link
Member

compiler-errors commented Mar 2, 2024

For the record, I think bors try just builds artifacts for x86_64-unknown-linux-gnu. I think you need to copy the windows tests into the ci jobs in some actions toml file.

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

@compiler-errors compiler-errors left a comment

Choose a reason for hiding this comment

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

r=me when ci is green

@compiler-errors compiler-errors 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 Mar 2, 2024
@rust-log-analyzer

This comment has been minimized.

Leverage `anstyle-svg`, as `cargo` does now, to emit `.svg` files
instead of `.stderr` files for tests that explicitly enable color
output. This will make reviewing changes to the graphical output of
tests much more human friendly.
@estebank
Copy link
Contributor Author

estebank commented Mar 2, 2024

@bors r=compiler-errors

@bors
Copy link
Contributor

bors commented Mar 2, 2024

📌 Commit b4bdb56 has been approved by compiler-errors

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 Mar 2, 2024
@bors
Copy link
Contributor

bors commented Mar 3, 2024

⌛ Testing commit b4bdb56 with merge a09d91b...

@bors
Copy link
Contributor

bors commented Mar 3, 2024

☀️ Test successful - checks-actions
Approved by: compiler-errors
Pushing a09d91b to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Mar 3, 2024
@bors bors merged commit a09d91b into rust-lang:master Mar 3, 2024
12 checks passed
@rustbot rustbot added this to the 1.78.0 milestone Mar 3, 2024
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (a09d91b): comparison URL.

Overall result: ✅ improvements - no action needed

@rustbot label: -perf-regression

Instruction count

This is a highly reliable metric that was used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.3% [-0.3%, -0.3%] 1
All ❌✅ (primary) - - 0

Max RSS (memory usage)

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
2.7% [2.2%, 3.2%] 2
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-4.5% [-4.9%, -4.0%] 2
All ❌✅ (primary) - - 0

Cycles

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-1.1% [-1.1%, -1.1%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -1.1% [-1.1%, -1.1%] 1

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 650.632s -> 650.052s (-0.09%)
Artifact size: 175.02 MiB -> 175.05 MiB (0.02%)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-testsuite Area: The testsuite used to check the correctness of rustc merged-by-bors This PR was explicitly merged by bors. 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) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

9 participants