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

Fix rustdoc --test-builder argument parsing #80924

Merged
merged 3 commits into from
Jan 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions src/librustdoc/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -412,11 +412,7 @@ fn opts() -> Vec<RustcOptGroup> {
)
}),
unstable("test-builder", |o| {
o.optflag(
"",
"test-builder",
"specified the rustc-like binary to use as the test builder",
)
o.optopt("", "test-builder", "The rustc-like binary to use as the test builder", "PATH")
}),
unstable("check", |o| o.optflag("", "check", "Run rustdoc checks")),
]
Expand Down
6 changes: 6 additions & 0 deletions src/test/rustdoc/issue-80893.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// compile-flags: --test -Z unstable-options --test-builder true
Copy link
Contributor

Choose a reason for hiding this comment

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

rustdoc passes the source code the the builder through stdin. If true happens to terminate before that, the rustdoc will be terminated by SIGPIPE. This makes the test quite flaky, e.g., #79705 (comment)

Copy link
Contributor

Choose a reason for hiding this comment

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

Could we use cat instead ?

Copy link
Contributor

Choose a reason for hiding this comment

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

Or maybe wc if the output would end up in the test log.

Copy link
Contributor

Choose a reason for hiding this comment

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

cat: unrecognized option '--crate-type'

Copy link
Member

Choose a reason for hiding this comment

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

Hmm, in shell : will work, but I think this goes through process::Command.

Copy link
Member

Choose a reason for hiding this comment

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

You can always just use --test-builder rustc.

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, in shell : will work, but I think this goes through process::Command.

No, :, if it works, is just an alias for true. It would have the same problem. We need something that will actually read the input.

You can always just use --test-builder rustc.

Haha lol, why didn't I think of that. Of course that wouldn't test that the argument actually has any effect but the current test doesn't check that anyway. So +1.

Copy link
Member

Choose a reason for hiding this comment

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

I opened #81197 fixing this.


/// ```no_run
/// This tests that `--test-builder` is accepted as a flag by rustdoc.
/// ```
pub struct Foo;