-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Rewrite the no-input-file.stderr
test in Rust and support diff
#124257
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @jieyouxu (or someone else) some time within the next two weeks. Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (
|
@@ -0,0 +1,38 @@ | |||
#[cfg(test)] | |||
mod tests { |
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.
I think the tests here will not be executed in CI for now (I don't know how to configure it).
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.
I think that is fine for now, but if you want to add support for running the unit tests in run-make-support
, you'll need to do something like CompiletestTest
:
impl Step for CompiletestTest { |
Modulo the unstable test feature part because run-make-support
is stable-only and does not use any unstable (cargo or rustc) features.
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.
I filed issue #124267 to track this.
These commits modify the If this was unintentional then you should revert the changes before this PR is merged. The run-make-support library was changed cc @jieyouxu Some changes occurred in run-make tests. cc @jieyouxu |
|
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 for the PR!
If we have dissimilar
in tree already, we should use dissimilar
as suggested to avoid introducing another similar (heh) dependency.
@@ -0,0 +1,38 @@ | |||
#[cfg(test)] | |||
mod tests { |
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.
I think that is fine for now, but if you want to add support for running the unit tests in run-make-support
, you'll need to do something like CompiletestTest
:
impl Step for CompiletestTest { |
Modulo the unstable test feature part because run-make-support
is stable-only and does not use any unstable (cargo or rustc) features.
@@ -0,0 +1,38 @@ | |||
#[cfg(test)] | |||
mod tests { |
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.
I filed issue #124267 to track this.
@klensy @jieyouxu Thank you for your suggestion. I value your advice and took the time to explore how to use For example, when we use
But what we expect is:
I also thought about encoding all If you have any better suggestions, please let me know at your earliest convenience. |
If that's the case, then I think using |
Well, i guess |
This comment was marked as resolved.
This comment was marked as resolved.
@@ -3343,6 +3343,7 @@ version = "0.0.0" | |||
dependencies = [ | |||
"object 0.34.0", | |||
"regex", | |||
"similar", |
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.
Could you check if you can just use the diff
from the environment? As in, I think we already assume diff
exists:
Lines 21 to 22 in 7bb4f08
# diff with common flags for multi-platform diffs against text output | |
DIFF := diff -u --strip-trailing-cr |
If that's not available, then I'm open to adding similar
.
EDIT: Now that I think about it, the easier to run the test the better. For example, I think grep
isn't by default available on Windows? Would be nice to not have to rely on those external dependencies if possible/reasonable especially if they can have platform-specific differences and what not.
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.
Would be nice to not have to rely on those external dependencies if possible/reasonable especially if they can have platform-specific differences and what not.
I think so too.
use run_make_support::{diff, rustc}; | ||
|
||
fn main() { | ||
let output = rustc().arg("--print").arg("crate-name").run_fail_assert_exit_code(1); |
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.
One last nit: can you add a print
helper method to Rustc
? So the callsite becomes something like
rustc().print("crate-name")
This PR looks good to me otherwise.
Thanks for the PR! @bors r+ rollup |
Rewrite the `no-input-file.stderr` test in Rust and support diff Rewrite the `no-input-file.stderr` test from rust-lang#121876. Use the `similar` lib to replace the `diff` command.
…iaskrgr Rollup of 4 pull requests Successful merges: - rust-lang#124257 (Rewrite the `no-input-file.stderr` test in Rust and support diff) - rust-lang#124324 (Minor AST cleanups) - rust-lang#124327 (CI: implement job skipping in Python matrix calculation) - rust-lang#124345 (Enable `--check-cfg` by default in UI tests) r? `@ghost` `@rustbot` modify labels: rollup
…iaskrgr Rollup of 3 pull requests Successful merges: - rust-lang#124257 (Rewrite the `no-input-file.stderr` test in Rust and support diff) - rust-lang#124324 (Minor AST cleanups) - rust-lang#124327 (CI: implement job skipping in Python matrix calculation) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#124257 - JoverZhang:rmake-diff, r=jieyouxu Rewrite the `no-input-file.stderr` test in Rust and support diff Rewrite the `no-input-file.stderr` test from rust-lang#121876. Use the `similar` lib to replace the `diff` command.
Rewrite the
no-input-file.stderr
test from #121876.Use the
similar
lib to replace thediff
command.