-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Added ability to crosscompile doctests #6892
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @ehuss (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
Thanks for the PR, but shouldn't the rustdoc PR also have support for passing arguments to the runtool? |
Yes it does already, rustdoc can take a --runtool argument which it will use for running tests. It is in the other PR. For example |
Er sorry my point is that there's a comment here that says |
How? Compiletest runtool support just doesn't allow passing arguments with spaces in them, I guess that could also be done here for consistency? But I don't think compiletest should really be setting any precedents for a public API. |
I have fixed some tests that were causing the checks to fail. At this point I am waiting on advisement for the runtool argument passing. |
@Goirad I'm not sure there's much advice to give? The arguments specified need to be handled and passed to rustdoc, but they currently aren't. There's not really a preference of how to handle them, but they need to be handled. |
@alexcrichton I suppose the question is how to pass arguments with spaces? |
I don't really understand the question in the sense that there's not any code to talk about to see where a bug might be or comment on that. If arguments are passed as process arguments it doesn't matter, it's only if one end does string parsing or something like that. |
The main question is how to get consistent behavior across all tools?
How is |
I don't really know nor do I have a preference. I don't personally have time to help design this feature, but I can provide review feedback that this isn't handled and needs to be handled. |
@ehuss As per Alex's suggestion, Cargo now passes arguments too, and the companion PR has been updated so that rustdoc accepts and uses them |
I have modified the companion PR for rustdoc to feature-gate ignore-foo attributes in doctests. |
I think it's fine to skip feature gates here since we'll just inherit the feature gates enabled in rustdoc. |
@alexcrichton can you elaborate? I'm not sure how that would work. In your proposal, would |
One option would be to just opt in to unstable arguments as well as per-target-ignores when a runtool is found. Although that leads to the situation where to be able to opt in to per-target ignores you need to have a runtool defined for the current target. |
Actually thinking about this it's already stable behavior today that we're not running doctests on cross-compiled scenarios with a runner configured. That can't regress in Cargo (and would if this patch lands as-is) so it probably means that we'll need a feature gate of some form in Cargo to enable this behavior. |
This seems reasonable enough to me, and it's just blocked on the rustc PR landing. Before landing this can you open a tracking issue in this repository explaining the feature, what's unstable, etc? |
@alexcrichton Yes of course, tracking issue here. |
☔ The latest upstream changes (presumably #7137) made this pull request unmergeable. Please resolve the merge conflicts. |
@alexcrichton I've added tests for both of the new features introduced in rustdoc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Could a test be added which exercises the runner
functionality as well?
Could the tests also be updated to assert the right flags (like |
240cf7f
to
f6ef349
Compare
@alexcrichton Tests have been updated |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this also update the list of unstable features at src/doc/src/reference/unstable.md
?
☔ The latest upstream changes (presumably #7311) made this pull request unmergeable. Please resolve the merge conflicts. |
f6ef349
to
26d3e7e
Compare
d54bdd6
to
8731579
Compare
8731579
to
a2209fc
Compare
@alexcrichton I have removed all OS restrictions from the tests |
@bors: r+ awesome, thanks! |
📌 Commit a2209fc has been approved by |
Added ability to crosscompile doctests This commit adds the ability to cross-compile and run doctests. Like before cargo checks if target == host, the difference is that if there is a runtool defined in config.toml, it passes the information forward to rustdoc so that it can run the doctests with that tool. If no tool is defined and the target != host, cargo instead displays a message that doctests will not be compiled because of the missing runtool. See [here](rust-lang/rust#60387) for the companion PR in the rust project that modifies rustdoc to accept the relevant options as well as allow ignoring doctests on a per target level. Partially resolves [#6460](#6460) See [here](#7040) for the tracking issue.
☀️ Test successful - checks-azure |
This commit adds the ability to cross-compile and run doctests.
Like before cargo checks if target == host, the difference is that if there is a runtool defined in config.toml, it passes the information forward to rustdoc so that it can run the doctests with that tool. If no tool is defined and the target != host, cargo instead displays a message that doctests will not be compiled because of the missing runtool.
See here for the companion PR in the rust project that modifies rustdoc to accept the relevant options as well as allow ignoring doctests on a per target level.
Partially resolves #6460
See here for the tracking issue.