about summary refs log tree commit diff
path: root/src/tools
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2020-08-31 20:03:33 +0000
committerbors <bors@rust-lang.org>2020-08-31 20:03:33 +0000
commit45f638bd8620592b7c50e9b483c2aa8ef9715f5d (patch)
tree60f744fe3d9f7d92ab0c9e3e78c388d0a4df824a /src/tools
parent1d22f75c9f75cad2e408a145861904898ac982dd (diff)
parenta4e926daeeaedc9178846711daf1f4cb6ce505fb (diff)
Auto merge of #75979 - lzutao:seprate-tests, r=Mark-Simulacrum
Move `#[cfg(test)]` modules into separate files to save recompiling the `std` crate

Implements an accepted proposal: https://github.com/rust-lang/compiler-team/issues/344

Some notes for reviewers:
* `mod tests` nested in `mod foo` in `mod bar`, I move `foo` to a new file, `tests` is a new file in foo: For example library/std/src/sys/sgx/abi/tls.rs
* `mod test` (not `mod tests`) also is moved.
* `mod benches` are moved.
* `mod tests` is placed before any `use` statements: The topic is discussed in https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/Code.20Style.20process
* Some files in cloudabi was changed too. But I notice copyright banners in those files, should we ping cloudabi people?
* I formatted files after moving tests around. I think that may make it easier to review :p .
* Some files don't need `ignore-tidy-filelength` anymore.
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/tidy/src/pal.rs5
-rw-r--r--src/tools/tidy/src/unit_tests.rs14
2 files changed, 14 insertions, 5 deletions
diff --git a/src/tools/tidy/src/pal.rs b/src/tools/tidy/src/pal.rs
index 8f9d6915790..1dba6b73b93 100644
--- a/src/tools/tidy/src/pal.rs
+++ b/src/tools/tidy/src/pal.rs
@@ -56,9 +56,14 @@ const EXCEPTION_PATHS: &[&str] = &[
     // Integration test for platform-specific run-time feature detection:
     "library/std/tests/run-time-detect.rs",
     "library/std/src/net/test.rs",
+    "library/std/src/net/addr",
+    "library/std/src/net/udp",
     "library/std/src/sys_common/mod.rs",
     "library/std/src/sys_common/net.rs",
     "library/std/src/sys_common/backtrace.rs",
+    "library/std/src/sys_common/remutex.rs",
+    "library/std/src/sync/mutex.rs",
+    "library/std/src/sync/rwlock.rs",
     // panic_unwind shims
     "library/std/src/panicking.rs",
     "library/term", // Not sure how to make this crate portable, but test crate needs it.
diff --git a/src/tools/tidy/src/unit_tests.rs b/src/tools/tidy/src/unit_tests.rs
index c6d67844a2b..04f2bbaa0d9 100644
--- a/src/tools/tidy/src/unit_tests.rs
+++ b/src/tools/tidy/src/unit_tests.rs
@@ -20,15 +20,19 @@ pub fn check(root_path: &Path, bad: &mut bool) {
     let mut skip = |path: &Path| {
         let file_name = path.file_name().unwrap_or_default();
         if path.is_dir() {
-            super::filter_dirs(path) ||
-            path.ends_with("src/test") ||
-            path.ends_with("src/doc") ||
-            path.ends_with("library/std") || // FIXME?
-            (file_name == "tests" || file_name == "benches") && !is_core(path)
+            super::filter_dirs(path)
+                || path.ends_with("src/test")
+                || path.ends_with("src/doc")
+                || (file_name == "tests" || file_name == "benches") && !is_core(path)
         } else {
             let extension = path.extension().unwrap_or_default();
             extension != "rs"
                 || (file_name == "tests.rs" || file_name == "benches.rs") && !is_core(path)
+                // UI tests with different names
+                || path.ends_with("src/thread/local/dynamic_tests.rs")
+                || path.ends_with("src/sync/mpsc/sync_tests.rs")
+                // Has copyright banner
+                || path.ends_with("src/sys/cloudabi/abi/cloudabi.rs")
         }
     };