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

-Z help and/or the z-help.stdout test is fragile #109391

Closed
pnkfelix opened this issue Mar 20, 2023 · 3 comments · Fixed by #109810
Closed

-Z help and/or the z-help.stdout test is fragile #109391

pnkfelix opened this issue Mar 20, 2023 · 3 comments · Fixed by #109810
Assignees
Labels
A-testsuite Area: The testsuite used to check the correctness of rustc E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-help-wanted Call for participation: Help is requested to fix this issue. requires-nightly This issue requires a nightly compiler in some way.

Comments

@pnkfelix
Copy link
Member

The -Z help output is interacting in some way with tests/rustdoc-ui/z-help.stdout such that the whole thing is fragile.

I am consistently seeing problems where, when I rebase my PR that adds a couple -Z flags, a large portion of the output diverges (in terms of actual vs expected), but its not on the whole file, its only on the file starting from the entries that follow, e.g.

    -Z                       instrument-xray=val -- insert function instrument code for XRay-based tracing (default: no)
         Optional extra settings:
         `=always`
         `=never`
         `=ignore-loops`
         `=instruction-threshold=N`
         `=skip-entry`
         `=skip-exit`
         Multiple options can be combined with commas.
    -Z                       keep-hygiene-data=val -- keep hygiene data after analysis (default: no)

I would like for us to either figure out a way to make the -Z help output itself more stable over time (e.g. by putting limits on the lengths of the names, or not being so clever with the formatting as to force the columns to all be aligned for 100% of the entires), or I would like the z-help.stdout output to be normalized so that it doesn't have to be updated in response to whitespace changes in the output.

@pnkfelix pnkfelix added requires-nightly This issue requires a nightly compiler in some way. A-testsuite Area: The testsuite used to check the correctness of rustc labels Mar 20, 2023
@jyn514
Copy link
Member

jyn514 commented Mar 20, 2023

I think it should be possible to normalize these lines so they only show -Z instrument-xray=val - I don't think there's a lot of value in testing the exact output of the descriptions.

https://rustc-dev-guide.rust-lang.org/tests/ui.html#normalization

@jyn514 jyn514 added E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-help-wanted Call for participation: Help is requested to fix this issue. labels Mar 20, 2023
@pnkfelix
Copy link
Member Author

@jyn514 do you think we should implement this via normalization rules embedded in the test files, e.g.

// normalize-stdout-test: " +" -> " "

(or whatever encoding one needs to get one-or-more spaces to normalize to a single space)

Or do you think we should implement this in compiletest itself via some means?

My current inclination is to try to encode it into the test file itself.

@jyn514
Copy link
Member

jyn514 commented Mar 20, 2023

Yes, I'd prefer the test file itself. I don't think this needs special support from the test infra.

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 E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-help-wanted Call for participation: Help is requested to fix this issue. requires-nightly This issue requires a nightly compiler in some way.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants