-
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
Move unit tests into separate files unconfigured during normal build #61097
Comments
I'd like to work on this. |
Test modules beside
|
You could do |
@hellow554 Thank you |
@petrochenkov Hi. I have a question:) I found
into that file(src/test/codegen/tests.rs)? |
@chansuke |
@petrochenkov Thanks. |
It'd be great to add a tidy lint against |
Just noticed that we'll probably want to update tidy's pal lint to whatever name we standardize to: rust/src/tools/tidy/src/pal.rs Line 164 in 61d286e
|
@chansuke |
@petrochenkov Hey, sorry for the late reply. I've finished like half of the modules and still working on this issue. Yes, I will send [WIP] PR. |
Separate unit tests I'm working on #61097. About half of the modules are done but dozens of modules are still remaining. I will rebase and squash the commits later.
The tidy check is implemented in #62996. |
tidy: Add a check for inline unit tests As described in rust-lang#61097. There's a large whitelist right now, because in many crates the tests are not outlined yet. ~This PR only outlines tests in one crate (`rustc_lexer`) as an example.~ r? @Mark-Simulacrum
tidy: Add a check for inline unit tests As described in rust-lang#61097. There's a large whitelist right now, because in many crates the tests are not outlined yet. ~This PR only outlines tests in one crate (`rustc_lexer`) as an example.~ r? @Mark-Simulacrum
tidy: Add a check for inline unit tests As described in rust-lang#61097. There's a large whitelist right now, because in many crates the tests are not outlined yet. ~This PR only outlines tests in one crate (`rustc_lexer`) as an example.~ r? @Mark-Simulacrum
The rest of the work is done in #63207. |
Unconfigure compiler unit test files during normal build I haven't touched libstd though, it had a lot of tests and I'm not sure the people maintaining it want this. Closes #61097 r? @Mark-Simulacrum
One of the most annoying parts of compiler refactorings is suddenly discovering that after a refactoring change some code in unit tests stops building.
Compiler unit tests are mostly old, many of them are not really "unit" and need to be migrated to regular ui testing or removed, but that's not the point of this issue.
The point of this issue is that after changing such test you have to restart the bootstrapping process from the crate that unit test belongs to (e.g. touched
libsyntax
-> rebuild everything).How to fight this problem?
Exclude unit tests from the normal build!
Files included from under
cfg(FALSE)
are not considered crate dependencies from build system point of view (not included into dep files).So, unit test modules included in the next way
won't cause rebuilds after changing code in them, they will be rebuilt only as a part of unit test run (so they won't participate in bootstrap).
Steps:
mod test
- 31 instances,mod tests
- 183 instances, excludingsrc/tools
andsrc/test
subdirectories).mod tests { ... }
->#[cfg(test)] mod tests;
.my_crate
:./x.py test --stage 0 src/my_crate
.The text was updated successfully, but these errors were encountered: