-
Notifications
You must be signed in to change notification settings - Fork 13k
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 revision support for UI tests. #49812
Conversation
I tried to make the code a little more explicit and cleaner to avoid confusion, though I'm not sure I succeeded. :) Everything should work the same as before, except UI tests can now output In order to generate the output for a test with multiple revisions, you have to run compiletest separately for each revision because it stops immediately when a revision fails. There doesn't seem to be the equivalent of |
Hmm, one idea would be to fix #47604 -- @spastorino got most of the way there in #48023, but got entangled in some of the mess that you're sorting out in this PR. A side-effect of this change would be that each revision is its own test, so they would all run independently of a failure. |
src/tools/tidy/src/ui_tests.rs
Outdated
if !file_path.with_file_name(testname) | ||
.with_extension("rs") | ||
.exists() { | ||
println!("Stray file with UI testing output: {:?}", file_path); |
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.
cc @pnkfelix
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.
Grabbing everything up to first dot to derive the source file name sounds like a reasonable start to me.
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.
On second read, I'm perhaps confused.
src/tools/compiletest/src/runtest.rs
Outdated
.with_extension(&self.config.stage_id) | ||
} | ||
|
||
fn output_base_name_stage(&self) -> PathBuf { |
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.
Maybe a comment?
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 believe this returns foo/bar.stage1
, right?
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.
Stage also includes the platform triple (like foo/bar.stage1-x86_64-apple-darwin
). That is...a little confusing. :)
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.
ok -- in any case I'd like to see a comment =)
src/tools/compiletest/src/runtest.rs
Outdated
@@ -2864,7 +2879,9 @@ impl<'test> TestCx<'test> { | |||
} | |||
} | |||
|
|||
let output_file = self.output_base_name().with_extension(kind); | |||
let output_file = self.output_base_name() |
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.
Why do we not want the stage here?
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.
Good question. What are the arguments in favor of including the stage? Is it to guard against using the wrong cached results if you run x.py test --stage 1
and x.py test --stage 2
separately?
One issue is that update-references.sh
won't know which stage to use. We could add that as another argument, and print the correct stage in the usage instructions.
Some of the other tests that don't include the stage may need to be updated as well. I was reluctant to do so because I don't fully understand the need and consequences.
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.
What are the arguments in favor of including the stage?
The way I always imagined it, we use the stage/target data to effectively "isolate" stage1 and stage2 tests from one another completely. To be honest, I think we should be using separate directories altogether (i.e, src/test/stage1
). I'm not sure why we don't, I think for no particularly good reason.
But you're right that I don't know what can go wrong in particular.
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 issue is that update-references.sh won't know which stage to use. We could add that as another argument, and print the correct stage in the usage instructions.
Seems fair. We can leave as is for now.
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.
If we moved to ./x.py bless
, then you could do ./x.py bless --stage 1
and so forth to specify the test suite that you ran. (Maybe it should be ./x.py test --bless
? Anyway.)
☔ The latest upstream changes (presumably #49861) made this pull request unmergeable. Please resolve the merge conflicts. |
@nikomatsakis I just wanted to confirm, what you'd like me to do in regards to the new NLL compare-mode changes. For this PR, I at least need to redo the tidy checks (cc @pnkfelix). Long term do you want the output files to be AFAIK, compiletest currently doesn't handle generating output files with the $mode part (and update-references doesn't handle it either). I'm guessing updates to support that should be in another PR? |
@ehuss that does need to be decided =) I think though it might be most practical if compare-mode=nll used an nll revision if available but otherwise used a kind of "default" revision. |
That is to say, I feel like 'compare-mode' might perhaps be better considered a kind of "automatic revision" that applies to every test which does not already have one. (And -- indeed -- perhaps revisions also want the same "failover" behavior for their stderr files? I guess that's the question.) |
5cda53e
to
55ccdf4
Compare
☔ The latest upstream changes (presumably #49900) made this pull request unmergeable. Please resolve the merge conflicts. |
5b1f55d
to
bc56181
Compare
I think this is now working well with the latest NLL updates. With a sample test from compile-fail, it was able to successfully create |
☔ The latest upstream changes (presumably #50119) made this pull request unmergeable. Please resolve the merge conflicts. |
bc56181
to
c3af118
Compare
@ehuss can you say a bit more? What was the test you tried? I don't quite understand what "everything seems happy" means. =) |
I believe the new behavior is as follows:
In other words, revisions and compare modes are orthogonal? This seems ok so long as the flags that |
@bors r+ |
📌 Commit c3af118 has been approved by |
I tried copying over some tests from
And verified that the |
…akis Fix revision support for UI tests. Fixes rust-lang#48878
Rollup of 11 pull requests Successful merges: - #49461 (std: Child::kill() returns error if process has already exited) - #49727 (Add Cell::update) - #49812 (Fix revision support for UI tests.) - #49829 (Add doc links to `std::os` extension traits) - #49906 (Stabilize `std::hint::unreachable_unchecked`.) - #49970 (Deprecate Read::chars and char::decode_utf8) - #49985 (don't see issue #0) - #50118 (fix search bar bug) - #50139 (encourage descriptive issue titles) - #50174 (Use FxHashMap in syntax_pos::symbol::Interner::intern.) - #50185 (core: Fix overflow in `int::mod_euc` when `self < 0 && rhs == MIN`) Failed merges:
Fixes #48878