Skip to content

Conversation

@epage
Copy link
Contributor

@epage epage commented Oct 15, 2025

This is to prepare for adding styling to help and maybe changing the existing styling (#266). Maybe this will help with #4415 as well.

The layout I went with is:

  • tests/suite/cli-ui/rustup-init/*.toml -> tests/suite/cli_rustup_init_ui.rs + tests/suite/cli_rustup_init_ui/*.term.svg
  • tests/suite/cli-ui/rustup/*.toml -> tests/suite/cli_rustup_ui.rs + tests/suite/cli_rustup_ui/*.term.svg

@epage epage force-pushed the trycmd branch 2 times, most recently from 99e1f74 to d47278e Compare October 15, 2025 21:30
@rami3l rami3l self-assigned this Oct 16, 2025
Copy link
Member

@rami3l rami3l left a comment

Choose a reason for hiding this comment

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

This looks fine to me; however we have to recognize the platform differences as well... Do you happen to have a way to overcome the regarding the failed snapshots on Windows? (Some commands are expected to have different output on Windows than on Unix.)

@rami3l rami3l removed their assignment Oct 16, 2025
@epage
Copy link
Contributor Author

epage commented Oct 16, 2025

Sorry, had missed that there were failures. Hopefully fixed now.

@djc
Copy link
Contributor

djc commented Oct 16, 2025

How do you look at the SVG files locally? What does a test failure look like in a terminal?

@rami3l
Copy link
Member

rami3l commented Oct 16, 2025

How do you look at the SVG files locally? What does a test failure look like in a terminal?

@djc SVGs are just plain text files so you'll be seeing text file diffs. It's not as good as before in terminals but most of the times we are updating the snapshots anyway. I know from @weihanglo that this has been used in cargo for a while and when the styling is more complex this approach will bring more value.

@epage
Copy link
Contributor Author

epage commented Oct 16, 2025

How do you look at the SVG files locally?

I use open on Linux which uses the default viewer for the file type. A browser should also work.

What does a test failure look like in a terminal?

A diff of XML. If this is limited in its use, then its not bad. We've not had a problem with it in Cargo. Unsure how they are handling it with Rustc.

@weihanglo
Copy link
Member

FWIW: rust-lang/cargo#13461 (comment)

One pretty minor concern is that GitHub Mobile renders SVG as text. (Who else review PRs on mobile? 🤷🏾‍♂️)

@djc
Copy link
Contributor

djc commented Oct 16, 2025

I definitely review on mobile sometimes. But, let's try it.

@rami3l
Copy link
Member

rami3l commented Oct 16, 2025

FWIW: rust-lang/cargo#13461 (comment)

One pretty minor concern is that GitHub Mobile renders SVG as text. (Who else review PRs on mobile? 🤷🏾‍♂️)

@weihanglo Nice remark. Hmmm can we somehow contact the client support for this?

@epage epage force-pushed the trycmd branch 4 times, most recently from 25cd2d5 to 22d5be9 Compare October 16, 2025 14:36
Comment on lines +51 to +67
#[test]
#[cfg(not(windows))] // On windows, we don't have the `man` command
fn rustup_help_cmd() {
test_help("rustup_help_cmd", &["help"]);
}

#[test]
#[cfg(not(windows))] // On windows, we don't have the `man` command
fn rustup_help_flag() {
test_help("rustup_help_flag", &["--help"]);
}

#[test]
#[cfg(not(windows))] // On windows, we don't have the `man` command
fn rustup_only_options() {
test_error("rustup_only_options", &["-q"]);
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This looks fine to me; however we have to recognize the platform differences as well... Do you happen to have a way to overcome the regarding the failed snapshots on Windows? (Some commands are expected to have different output on Windows than on Unix.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So using ... doesn't work with SVG files because it throws off the y variable.

For now, I'm just excluding those tests from Windows.

Alternatives

  • We keep only these tests as txt instead of svg

Copy link
Contributor

Choose a reason for hiding this comment

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

Seems fine to me.

Copy link
Member

@rami3l rami3l Oct 17, 2025

Choose a reason for hiding this comment

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

@epage I'm okay with that given that it seems like the best we could do for now.

OTOH what would the recommended approach be if I am using Windows and just want to draft a PR to make the tests pass?

Is there any prior art in that regard? Otherwise I'm thinking about something like uploading the updated snapshots to the CI results for the developer to download...

I can address that in a separate PR, of course.

Copy link
Contributor

@djc djc Oct 17, 2025

Choose a reason for hiding this comment

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

For that scenario, keeping theese as text instead of SVG would be an improvement. On the other hand, it doesn't feel like we get a lot of external contributors that use Windows, so maybe this is rare enough that it's fine? For those cases, it should also be easy enough for non-Windows team members to contribute an updated SVG.

Copy link
Member

Choose a reason for hiding this comment

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

Okay, let's merge it first and see how it goes :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For Windows developers, you can grab the diff from CI. We have to do this in Cargo for platform-specific tests already.

@epage
Copy link
Contributor Author

epage commented Oct 16, 2025

CI is now passing though unsure how people feel about the approach I took in #4536 (comment)

Comment on lines +51 to +67
#[test]
#[cfg(not(windows))] // On windows, we don't have the `man` command
fn rustup_help_cmd() {
test_help("rustup_help_cmd", &["help"]);
}

#[test]
#[cfg(not(windows))] // On windows, we don't have the `man` command
fn rustup_help_flag() {
test_help("rustup_help_flag", &["--help"]);
}

#[test]
#[cfg(not(windows))] // On windows, we don't have the `man` command
fn rustup_only_options() {
test_error("rustup_only_options", &["-q"]);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Seems fine to me.

@djc
Copy link
Contributor

djc commented Oct 16, 2025

Also, it looks like this solves #4415 so that's pretty nice.

@rami3l rami3l added this pull request to the merge queue Oct 17, 2025
Merged via the queue into rust-lang:main with commit 552e50b Oct 17, 2025
29 checks passed
@djc djc mentioned this pull request Oct 17, 2025
@epage epage deleted the trycmd branch October 20, 2025 14:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants