-
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
Introduce 'run-pass' header to 'ui' tests in compiletest. Fix issue #36516. #41968
Introduce 'run-pass' header to 'ui' tests in compiletest. Fix issue #36516. #41968
Conversation
(rust_highfive has picked a reviewer for you, use r? to override) |
BTW, I have a branch in progress unifying I always wondered why (I'm not touching specialized tests like |
04728f8
to
f8b85c8
Compare
Yeah, it seems to me like UI checking is "good" but also probably adds a small overhead to each test, which may not be a good idea -- our cycle times are already long. |
src/tools/compiletest/src/runtest.rs
Outdated
self.check_expected_errors(expected_errors, &proc_res); | ||
} | ||
assert!(expected_errors.is_empty(), | ||
"run-pass tests with expected warnings should be moved to ui-run/"); |
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 don't think this should be removed after this is merged. People in the future may still add run-pass tests, and if we want the separation, then we should enforce 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.
@Mark-Simulacrum Well this check does add a tiny overhead to the test 😄 (running load_errors
will scan the whole file again for //~
).
(This can be moved to tidy
but it will spend the same amount of Travis time)
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.
Presumably we already load the errors for the test somewhere else, since we need them -- could we assert at that location?
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.
@Mark-Simulacrum The test runner loads the header information (// ignore-stage0
stuff) twice (EarlyProps and TestProps), but both do not look for the //~
errors. Or did I misunderstand what you mean?
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 thought that we probably loaded //~
errors at some point to verify that they're correct; and we could then assert there if the test has none.
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.
@Mark-Simulacrum The //~
are loaded in errors::load_errors
, and checked against the output in check_expected_errors
. So they were verified at this line exactly.
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.
Oh, yeah, I see what you mean. So I guess this is a little extra work, but hopefully not much. I think I'm more or less fine with removing it then.
cc @cengizio -- who was also looking into this general area :) |
I like the idea of unifying run-pass, run-fail, and compile-fail into one category. I would prefer to be able to group tests by what they are testing, basically, not whether they are expected to generate a compilation error or not. |
@nikomatsakis to clarify, just for tagging purposes, is this waiting on a decision to happen elsewhere? |
Hello, I'm (slowly) adding inline ERROR assertions to ui tests. Not sure if this intersects with it. |
@cengizio there should be no conflict with the scope of this PR itself, which just affects the original run-pass tests to get rid of the JSON output. The rest of the discussion (unifying test folders) seems to be the same direction as what outlined in the internals thread, I hope the actual unification, when a plan is decided, will be done in a different PR a later :). |
ping @nikomatsakis for an answer to @alexcrichton's question :) |
It's not really clear. I started this internals thread and, as of yet, there's not been any opposition. We normally land changes to the test infrastructure kind of willy-nilly without a lot of fuss, but merging compile-fail and ui (which is part of what I would like to do) feels like a fairly fundamental change that I would like @rust-lang/compiler and others to know about and be on board with. That said, this particular PR does something much more modest -- it adds |
Now, that said, I think I'd prefer not to have a new direction ( (I think I would also like to support a "reference file" showing the output onto stdout/stderr, which might be good for Finally, I think I agree that we should scan for |
Sounds good to me |
f8b85c8
to
fa62a0c
Compare
@nikomatsakis Changed to use |
I'd really like to avoid this for practical reasons. |
I don't understand. It sounds to me like you are arguing in favor of a |
Oh, I see, you're saying you'd prefer to have them separated into their own directory? If so, I disagree. The problem is that I don't like having the tests that target a common area of the code strewn about in various directories; I'd like to see them all in one place, grouped by what they test, not by their "mode". (i.e., I would like all borrowck tests together). What about if we compromised, by adding a flag to compile test to let it configure which "modes" it will execute? My personal preference would be to have tags in tests, so that we can have e.g. a "smoketest" tag, and then be able to say "run just the smoketests". This may include some run-pass tests but also some compile-pass and compile-fail tests. Things like |
Yes, it's not necessary for "fast" and "slow" tests to be in different directories literally, the important thing is ability to run the "fast" group only somehow, maybe through compiletest flags and annotations in test files. |
Test failed due to comments like these...
Update: Added 15edf4f to require directives to be the first complete word of the line. |
6f4068d
to
15edf4f
Compare
Great! I agree that this is a useful thing. What do you think of the "tags" idea as a way of specifying what "sets" we want to run? I feel though that this should be a distinct PR. Maybe we should open an issue to write up a "spec"? I imagine this:
and adding a flag like This flag also needs to work from |
I'm inclined to r+ this specific PR, then, and try to address @petrochenkov's concern in a follow-up via some kind of tags scheme. Everybody OK with that? |
OK |
462fe26
to
92d1f4f
Compare
Sigh. This seems like it would be a good use-case for either having multiple references, or adding the ability to add "wildcards" into the reference output. I'd hoped to avoid the latter so that references can still be updated automatically though. I guess configuring the test for specific platforms suffices though -- at worst, if we really wanted to test multiple platforms, we could have two copies of the test. |
@bors r+ |
📌 Commit 92d1f4f has been approved by |
⌛ Testing commit 92d1f4f with merge 65251ec... |
💔 Test failed - status-travis |
looks like emscripten is also 32-bit. |
92d1f4f
to
e703fa7
Compare
@nikomatsakis Ignored emscripten as well in 2f68cfd (HEAD = e703fa7). |
Looks like a UI test needs updating.
|
…ust-lang#36516. The 'run-pass' header cause a 'ui' test to execute the result. It is used to test the lint output, at the same time ensure those lints won't cause the source code to become compile-fail. 12 run-pass/run-pass-fulldeps tests gained the header and are moved to ui/ui-fulldeps. After this move, no run-pass/run-pass-fulldeps tests should rely on the compiler's JSON message. This allows us to stop passing `--error-format json` in run-pass tests, thus fixing rust-lang#36516.
…ent. Refactored some related code to take advantage of this change.
e703fa7
to
3e6c83d
Compare
@Mark-Simulacrum Thanks. Gah. Fixed in 3e6c83d. |
@bors r=nikomatsakis |
📌 Commit 3e6c83d has been approved by |
… r=nikomatsakis Introduce 'run-pass' header to 'ui' tests in compiletest. Fix issue #36516. <del>`ui-run` test is a combination of `ui` test and `run-pass` test. It is used to test lint output.</del> Added support of `// run-pass` header to `ui` tests. The compiler message of each test must match the corresponding `*.stderr` file like the traditional `ui` tests. Additionally, the compiled output must be executed successfully like the `run-pass` test. 12 `run-pass`/`run-pass-fulldeps` tests are moved to `ui`/`ui-fulldeps` plus the headers. After this move, no `run-pass`/`run-pass-fulldeps` tests should rely on the compiler's JSON message. This allows us to stop passing `--error-format json` in run-pass tests, thus fixing #36516.
☀️ Test successful - status-appveyor, status-travis |
… r=nikomatsakis compilertest (UI test): Support custom normalization. Closes #42434. Adds this header for UI tests: ```rust // normalize-stderr-32bit: "fn() (32 bits)" -> "fn() ($PTR bits)" ``` It will normalize the `stderr` output on 32-bit platforms, by replacing all instances of `fn() (32 bits)` by `fn() ($PTR bits)`. Extends the UI tests in #42304 and #41968 to 32-bit targets. r? @nikomatsakis
… r=nikomatsakis compilertest (UI test): Support custom normalization. Closes #42434. Adds this header for UI tests: ```rust // normalize-stderr-32bit: "fn() (32 bits)" -> "fn() ($PTR bits)" ``` It will normalize the `stderr` output on 32-bit platforms, by replacing all instances of `fn() (32 bits)` by `fn() ($PTR bits)`. Extends the UI tests in #42304 and #41968 to 32-bit targets. r? @nikomatsakis
There is a FIXME related to this issue, |
ui-run
test is a combination ofui
test andrun-pass
test. It is used to test lint output.Added support of
// run-pass
header toui
tests.The compiler message of each test must match the corresponding
*.stderr
file like the traditionalui
tests. Additionally, the compiled output must be executed successfully like therun-pass
test.12
run-pass
/run-pass-fulldeps
tests are moved toui
/ui-fulldeps
plus the headers. After this move, norun-pass
/run-pass-fulldeps
tests should rely on the compiler's JSON message. This allows us to stop passing--error-format json
in run-pass tests, thus fixing #36516.