about summary refs log tree commit diff
path: root/src/tools
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-01-11 11:17:22 +0000
committerbors <bors@rust-lang.org>2023-01-11 11:17:22 +0000
commitb22c152958eade17a71d899b29a2d39bcc77aa48 (patch)
treeec6da75dc598a0a4086c0cc032c86d7241be1bc1 /src/tools
parent8ecaad85f61375b18e1667b51a3ef350121d2ca0 (diff)
parent40ba0e84d53f605ccf01836e9c2d27892728ae81 (diff)
downloadrust-b22c152958eade17a71d899b29a2d39bcc77aa48.tar.gz
rust-b22c152958eade17a71d899b29a2d39bcc77aa48.zip
Auto merge of #106458 - albertlarsan68:move-tests, r=jyn514
Move src/test to the root

See MCP at rust-lang/compiler-team#573

There may be more changes needed.

The first commit is just the move of the files:
You can check that the first commit did not do anything else than renames by running
```
git diff --diff-filter=r -M100% <rust-lang remote>/master <first commit hash>
```
The output should be empty, because the filter excludes renames, and the match threshold for qualifying a rename is 100%.

The second one is mostly a "find and replace" of `src/test` to `tests` and whatever is needed to make CI pass.

What is left to do:
---

- [x] Move directory
- [ ] Change references to `src/test`
    - [x] Change references in-tree
    - [ ] Change references in submodules / out-of-tree docs
- [x] Make CI pass:
    - [x] Fix tidy
    - [x] Fix tests
    - [x] Bless tests if needed (shouldn't normally)
- [ ] Merge it !
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/clippy/tests/ui/crashes/ice-6254.rs2
-rw-r--r--src/tools/clippy/tests/ui/crashes/ice-6255.rs2
-rw-r--r--src/tools/clippy/tests/ui/crashes/ice-6256.rs2
-rw-r--r--src/tools/compiletest/src/common.rs2
-rw-r--r--src/tools/compiletest/src/main.rs2
-rw-r--r--src/tools/compiletest/src/runtest.rs10
-rw-r--r--src/tools/rust-analyzer/crates/hir-def/src/macro_expansion_tests/mbe/meta_syntax.rs2
-rw-r--r--src/tools/rust-analyzer/crates/ide-db/src/generated/lints.rs2
-rw-r--r--src/tools/rustdoc-gui/tester.js2
-rw-r--r--src/tools/rustfmt/tests/source/issue-2445.rs4
-rw-r--r--src/tools/rustfmt/tests/target/issue-2445.rs4
-rw-r--r--src/tools/tidy/src/debug_artifacts.rs8
-rw-r--r--src/tools/tidy/src/edition.rs5
-rw-r--r--src/tools/tidy/src/error_codes.rs8
-rw-r--r--src/tools/tidy/src/features.rs11
-rw-r--r--src/tools/tidy/src/main.rs22
-rw-r--r--src/tools/tidy/src/mir_opt_tests.rs4
-rw-r--r--src/tools/tidy/src/style.rs9
-rw-r--r--src/tools/tidy/src/target_specific_tests.rs3
-rw-r--r--src/tools/tidy/src/ui_tests.rs8
-rw-r--r--src/tools/tidy/src/unit_tests.rs2
21 files changed, 63 insertions, 51 deletions
diff --git a/src/tools/clippy/tests/ui/crashes/ice-6254.rs b/src/tools/clippy/tests/ui/crashes/ice-6254.rs
index a2a60a16915..8af60890390 100644
--- a/src/tools/clippy/tests/ui/crashes/ice-6254.rs
+++ b/src/tools/clippy/tests/ui/crashes/ice-6254.rs
@@ -1,4 +1,4 @@
-// originally from ./src/test/ui/pattern/usefulness/consts-opaque.rs
+// originally from ./tests/ui/pattern/usefulness/consts-opaque.rs
 // panicked at 'assertion failed: rows.iter().all(|r| r.len() == v.len())',
 // compiler/rustc_mir_build/src/thir/pattern/_match.rs:2030:5
 
diff --git a/src/tools/clippy/tests/ui/crashes/ice-6255.rs b/src/tools/clippy/tests/ui/crashes/ice-6255.rs
index bd4a81d98e2..ccde6aa2b0f 100644
--- a/src/tools/clippy/tests/ui/crashes/ice-6255.rs
+++ b/src/tools/clippy/tests/ui/crashes/ice-6255.rs
@@ -1,4 +1,4 @@
-// originally from rustc ./src/test/ui/macros/issue-78325-inconsistent-resolution.rs
+// originally from rustc ./tests/ui/macros/issue-78325-inconsistent-resolution.rs
 // inconsistent resolution for a macro
 
 macro_rules! define_other_core {
diff --git a/src/tools/clippy/tests/ui/crashes/ice-6256.rs b/src/tools/clippy/tests/ui/crashes/ice-6256.rs
index 67308263dad..f9ee3e058c1 100644
--- a/src/tools/clippy/tests/ui/crashes/ice-6256.rs
+++ b/src/tools/clippy/tests/ui/crashes/ice-6256.rs
@@ -1,4 +1,4 @@
-// originally from rustc ./src/test/ui/regions/issue-78262.rs
+// originally from rustc ./tests/ui/regions/issue-78262.rs
 // ICE: to get the signature of a closure, use substs.as_closure().sig() not fn_sig()
 #![allow(clippy::upper_case_acronyms)]
 
diff --git a/src/tools/compiletest/src/common.rs b/src/tools/compiletest/src/common.rs
index a4f1167bf9d..a5f5eb447da 100644
--- a/src/tools/compiletest/src/common.rs
+++ b/src/tools/compiletest/src/common.rs
@@ -240,7 +240,7 @@ pub struct Config {
     pub mode: Mode,
 
     /// The test suite (essentially which directory is running, but without the
-    /// directory prefix such as src/test)
+    /// directory prefix such as tests)
     pub suite: String,
 
     /// The debugger to use in debuginfo mode. Unset otherwise.
diff --git a/src/tools/compiletest/src/main.rs b/src/tools/compiletest/src/main.rs
index 91c701a5ddd..2aea30870ff 100644
--- a/src/tools/compiletest/src/main.rs
+++ b/src/tools/compiletest/src/main.rs
@@ -774,7 +774,7 @@ fn make_test_name(
     revision: Option<&String>,
 ) -> test::TestName {
     // Print the name of the file, relative to the repository root.
-    // `src_base` looks like `/path/to/rust/src/test/ui`
+    // `src_base` looks like `/path/to/rust/tests/ui`
     let root_directory = config.src_base.parent().unwrap().parent().unwrap().parent().unwrap();
     let path = testpaths.file.strip_prefix(root_directory).unwrap();
     let debugger = match config.debugger {
diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs
index 7e48dd20660..a16ab11e2f9 100644
--- a/src/tools/compiletest/src/runtest.rs
+++ b/src/tools/compiletest/src/runtest.rs
@@ -2102,9 +2102,7 @@ impl<'test> TestCx<'test> {
                 .parent()
                 .unwrap() // chop off `ui`
                 .parent()
-                .unwrap() // chop off `test`
-                .parent()
-                .unwrap(); // chop off `src`
+                .unwrap(); // chop off `tests`
             args.push(src.join("src/etc/wasm32-shim.js").display().to_string());
         }
 
@@ -2932,7 +2930,7 @@ impl<'test> TestCx<'test> {
 
     fn run_rmake_test(&self) {
         let cwd = env::current_dir().unwrap();
-        let src_root = self.config.src_base.parent().unwrap().parent().unwrap().parent().unwrap();
+        let src_root = self.config.src_base.parent().unwrap().parent().unwrap();
         let src_root = cwd.join(&src_root);
 
         let tmpdir = cwd.join(self.output_base_name());
@@ -3548,8 +3546,8 @@ impl<'test> TestCx<'test> {
         normalize_path(parent_dir, "$DIR");
 
         let source_bases = &[
-            // Source base on the current filesystem (calculated as parent of `src/test/$suite`):
-            Some(self.config.src_base.parent().unwrap().parent().unwrap().parent().unwrap().into()),
+            // Source base on the current filesystem (calculated as parent of `tests/$suite`):
+            Some(self.config.src_base.parent().unwrap().parent().unwrap().into()),
             // Source base on the sysroot (from the src components downloaded by `download-rustc`):
             Some(self.config.sysroot_base.join("lib").join("rustlib").join("src").join("rust")),
             // Virtual `/rustc/$sha` remapped paths (if `remap-debuginfo` is enabled):
diff --git a/src/tools/rust-analyzer/crates/hir-def/src/macro_expansion_tests/mbe/meta_syntax.rs b/src/tools/rust-analyzer/crates/hir-def/src/macro_expansion_tests/mbe/meta_syntax.rs
index 8aff784087c..7e7b4004421 100644
--- a/src/tools/rust-analyzer/crates/hir-def/src/macro_expansion_tests/mbe/meta_syntax.rs
+++ b/src/tools/rust-analyzer/crates/hir-def/src/macro_expansion_tests/mbe/meta_syntax.rs
@@ -94,7 +94,7 @@ macro_rules! m2 { () => ( ${invalid()} ) }
 
 #[test]
 fn test_rustc_issue_57597() {
-    // <https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-57597.rs>
+    // <https://github.com/rust-lang/rust/blob/master/tests/ui/issues/issue-57597.rs>
     check(
         r#"
 macro_rules! m0 { ($($($i:ident)?)+) => {}; }
diff --git a/src/tools/rust-analyzer/crates/ide-db/src/generated/lints.rs b/src/tools/rust-analyzer/crates/ide-db/src/generated/lints.rs
index 64dd2bb5f2d..f0c3690962a 100644
--- a/src/tools/rust-analyzer/crates/ide-db/src/generated/lints.rs
+++ b/src/tools/rust-analyzer/crates/ide-db/src/generated/lints.rs
@@ -3624,7 +3624,7 @@ of a library.
 Plugins can extend [Rust's lint
 infrastructure](../../reference/attributes/diagnostics.md#lint-check-attributes) with
 additional checks for code style, safety, etc. Now let's write a plugin
-[`lint-plugin-test.rs`](https://github.com/rust-lang/rust/blob/master/src/test/ui-fulldeps/auxiliary/lint-plugin-test.rs)
+[`lint-plugin-test.rs`](https://github.com/rust-lang/rust/blob/master/tests/ui-fulldeps/auxiliary/lint-plugin-test.rs)
 that warns about any item named `lintme`.
 
 ```rust,ignore (requires-stage-2)
diff --git a/src/tools/rustdoc-gui/tester.js b/src/tools/rustdoc-gui/tester.js
index 554b2f81fa3..2f0ca1ec3d0 100644
--- a/src/tools/rustdoc-gui/tester.js
+++ b/src/tools/rustdoc-gui/tester.js
@@ -262,7 +262,7 @@ async function main(argv) {
             console.log("");
             console.log(
                 "`browser-ui-test` crashed unexpectedly. Please try again with adding `--test-args \
---no-sandbox` at the end. For example: `x.py test src/test/rustdoc-gui --test-args --no-sandbox`");
+--no-sandbox` at the end. For example: `x.py test tests/rustdoc-gui --test-args --no-sandbox`");
             console.log("");
         }
     };
diff --git a/src/tools/rustfmt/tests/source/issue-2445.rs b/src/tools/rustfmt/tests/source/issue-2445.rs
index 84ce6e647b8..deef429dbee 100644
--- a/src/tools/rustfmt/tests/source/issue-2445.rs
+++ b/src/tools/rustfmt/tests/source/issue-2445.rs
@@ -1,6 +1,6 @@
 test!(RunPassPretty {
             // comment
-    path: "src/test/run-pass/pretty",
+    path: "tests/run-pass/pretty",
     mode: "pretty",
     suite: "run-pass",
     default: false,
@@ -9,7 +9,7 @@ test!(RunPassPretty {
 
 test!(RunPassPretty {
             // comment
-    path: "src/test/run-pass/pretty",
+    path: "tests/run-pass/pretty",
     mode: "pretty",
     suite: "run-pass",
     default: false,
diff --git a/src/tools/rustfmt/tests/target/issue-2445.rs b/src/tools/rustfmt/tests/target/issue-2445.rs
index 1bc7752fd16..463c5d49576 100644
--- a/src/tools/rustfmt/tests/target/issue-2445.rs
+++ b/src/tools/rustfmt/tests/target/issue-2445.rs
@@ -1,6 +1,6 @@
 test!(RunPassPretty {
     // comment
-    path: "src/test/run-pass/pretty",
+    path: "tests/run-pass/pretty",
     mode: "pretty",
     suite: "run-pass",
     default: false,
@@ -9,7 +9,7 @@ test!(RunPassPretty {
 
 test!(RunPassPretty {
     // comment
-    path: "src/test/run-pass/pretty",
+    path: "tests/run-pass/pretty",
     mode: "pretty",
     suite: "run-pass",
     default: false,
diff --git a/src/tools/tidy/src/debug_artifacts.rs b/src/tools/tidy/src/debug_artifacts.rs
index 9880a32ad0c..0dd9c1e160c 100644
--- a/src/tools/tidy/src/debug_artifacts.rs
+++ b/src/tools/tidy/src/debug_artifacts.rs
@@ -1,14 +1,12 @@
 //! Tidy check to prevent creation of unnecessary debug artifacts while running tests.
 
 use crate::walk::{filter_dirs, walk};
-use std::path::{Path, PathBuf};
+use std::path::Path;
 
 const GRAPHVIZ_POSTFLOW_MSG: &str = "`borrowck_graphviz_postflow` attribute in test";
 
-pub fn check(path: &Path, bad: &mut bool) {
-    let test_dir: PathBuf = path.join("test");
-
-    walk(&test_dir, &mut filter_dirs, &mut |entry, contents| {
+pub fn check(test_dir: &Path, bad: &mut bool) {
+    walk(test_dir, &mut filter_dirs, &mut |entry, contents| {
         let filename = entry.path();
         let is_rust = filename.extension().map_or(false, |ext| ext == "rs");
         if !is_rust {
diff --git a/src/tools/tidy/src/edition.rs b/src/tools/tidy/src/edition.rs
index 8a7c4460dc7..8172e3d292b 100644
--- a/src/tools/tidy/src/edition.rs
+++ b/src/tools/tidy/src/edition.rs
@@ -11,7 +11,10 @@ fn is_edition_2021(mut line: &str) -> bool {
 pub fn check(path: &Path, bad: &mut bool) {
     walk(
         path,
-        &mut |path| filter_dirs(path) || path.ends_with("src/test"),
+        &mut |path| {
+            filter_dirs(path)
+                || (path.ends_with("tests") && path.join("COMPILER_TESTS.md").exists())
+        },
         &mut |entry, contents| {
             let file = entry.path();
             let filename = file.file_name().unwrap();
diff --git a/src/tools/tidy/src/error_codes.rs b/src/tools/tidy/src/error_codes.rs
index 9aacc07e0ab..ac8b5f6834c 100644
--- a/src/tools/tidy/src/error_codes.rs
+++ b/src/tools/tidy/src/error_codes.rs
@@ -8,7 +8,7 @@
 //!   - The explanation is expected to contain a `doctest` that fails with the correct error code. (`EXEMPT_FROM_DOCTEST` *currently* bypasses this check)
 //!   - Note that other stylistic conventions for markdown files are checked in the `style.rs` tidy check.
 //!
-//! 3. We check that the error code has a UI test in `src/test/ui/error-codes/`.
+//! 3. We check that the error code has a UI test in `tests/ui/error-codes/`.
 //!   - We ensure that there is both a `Exxxx.rs` file and a corresponding `Exxxx.stderr` file.
 //!   - We also ensure that the error code is used in the tests.
 //!   - *Currently*, it is possible to opt-out of this check with the `EXEMPTED_FROM_TEST` constant.
@@ -24,7 +24,7 @@ use crate::walk::{filter_dirs, walk, walk_many};
 
 const ERROR_CODES_PATH: &str = "compiler/rustc_error_codes/src/error_codes.rs";
 const ERROR_DOCS_PATH: &str = "compiler/rustc_error_codes/src/error_codes/";
-const ERROR_TESTS_PATH: &str = "src/test/ui/error-codes/";
+const ERROR_TESTS_PATH: &str = "tests/ui/error-codes/";
 
 // Error codes that (for some reason) can't have a doctest in their explanation. Error codes are still expected to provide a code example, even if untested.
 const IGNORE_DOCTEST_CHECK: &[&str] =
@@ -270,14 +270,14 @@ fn check_error_codes_tests(
         if !test_path.exists() && !IGNORE_UI_TEST_CHECK.contains(&code.as_str()) {
             verbose_print!(
                 verbose,
-                "warning: Error code `{code}` needs to have at least one UI test in the `src/test/ui/error-codes/` directory`!"
+                "warning: Error code `{code}` needs to have at least one UI test in the `tests/error-codes/` directory`!"
             );
             continue;
         }
         if IGNORE_UI_TEST_CHECK.contains(&code.as_str()) {
             if test_path.exists() {
                 errors.push(format!(
-                    "Error code `{code}` has a UI test in `src/test/ui/error-codes/{code}.rs`, it shouldn't be listed in `EXEMPTED_FROM_TEST`!"
+                    "Error code `{code}` has a UI test in `tests/ui/error-codes/{code}.rs`, it shouldn't be listed in `EXEMPTED_FROM_TEST`!"
                 ));
             }
             continue;
diff --git a/src/tools/tidy/src/features.rs b/src/tools/tidy/src/features.rs
index f10ecf5f201..af92e6eb863 100644
--- a/src/tools/tidy/src/features.rs
+++ b/src/tools/tidy/src/features.rs
@@ -82,6 +82,7 @@ pub fn collect_lib_features(base_src_path: &Path) -> Features {
 
 pub fn check(
     src_path: &Path,
+    tests_path: &Path,
     compiler_path: &Path,
     lib_path: &Path,
     bad: &mut bool,
@@ -95,10 +96,10 @@ pub fn check(
 
     walk_many(
         &[
-            &src_path.join("test/ui"),
-            &src_path.join("test/ui-fulldeps"),
-            &src_path.join("test/rustdoc-ui"),
-            &src_path.join("test/rustdoc"),
+            &tests_path.join("ui"),
+            &tests_path.join("ui-fulldeps"),
+            &tests_path.join("rustdoc-ui"),
+            &tests_path.join("rustdoc"),
         ],
         &mut filter_dirs,
         &mut |entry, contents| {
@@ -480,7 +481,7 @@ fn map_lib_features(
 ) {
     walk(
         base_src_path,
-        &mut |path| filter_dirs(path) || path.ends_with("src/test"),
+        &mut |path| filter_dirs(path) || path.ends_with("tests"),
         &mut |entry, contents| {
             let file = entry.path();
             let filename = file.file_name().unwrap().to_string_lossy();
diff --git a/src/tools/tidy/src/main.rs b/src/tools/tidy/src/main.rs
index a5685ba7c94..2a4853b37be 100644
--- a/src/tools/tidy/src/main.rs
+++ b/src/tools/tidy/src/main.rs
@@ -25,6 +25,7 @@ fn main() {
             .expect("concurrency must be a number");
 
     let src_path = root_path.join("src");
+    let tests_path = root_path.join("tests");
     let library_path = root_path.join("library");
     let compiler_path = root_path.join("compiler");
     let librustdoc_path = src_path.join("librustdoc");
@@ -68,16 +69,16 @@ fn main() {
             }
         }
 
-        check!(target_specific_tests, &src_path);
+        check!(target_specific_tests, &tests_path);
 
         // Checks that are done on the cargo workspace.
         check!(deps, &root_path, &cargo);
         check!(extdeps, &root_path);
 
         // Checks over tests.
-        check!(debug_artifacts, &src_path);
-        check!(ui_tests, &src_path);
-        check!(mir_opt_tests, &src_path, bless);
+        check!(debug_artifacts, &tests_path);
+        check!(ui_tests, &tests_path);
+        check!(mir_opt_tests, &tests_path, bless);
 
         // Checks that only make sense for the compiler.
         check!(error_codes, &root_path, &[&compiler_path, &librustdoc_path], verbose);
@@ -88,6 +89,7 @@ fn main() {
 
         // Checks that need to be done for both the compiler and std libraries.
         check!(unit_tests, &src_path);
+        check!(unit_tests, &tests_path);
         check!(unit_tests, &compiler_path);
         check!(unit_tests, &library_path);
 
@@ -96,14 +98,17 @@ fn main() {
         }
 
         check!(style, &src_path);
+        check!(style, &tests_path);
         check!(style, &compiler_path);
         check!(style, &library_path);
 
         check!(edition, &src_path);
         check!(edition, &compiler_path);
         check!(edition, &library_path);
+        check!(edition, &tests_path);
 
         check!(alphabetical, &src_path);
+        check!(alphabetical, &tests_path);
         check!(alphabetical, &compiler_path);
         check!(alphabetical, &library_path);
 
@@ -113,7 +118,14 @@ fn main() {
             drain_handles(&mut handles);
 
             let mut flag = false;
-            let r = features::check(&src_path, &compiler_path, &library_path, &mut flag, verbose);
+            let r = features::check(
+                &src_path,
+                &tests_path,
+                &compiler_path,
+                &library_path,
+                &mut flag,
+                verbose,
+            );
             if flag {
                 bad.store(true, Ordering::Relaxed);
             }
diff --git a/src/tools/tidy/src/mir_opt_tests.rs b/src/tools/tidy/src/mir_opt_tests.rs
index 018573284ea..2a9dcac2e8d 100644
--- a/src/tools/tidy/src/mir_opt_tests.rs
+++ b/src/tools/tidy/src/mir_opt_tests.rs
@@ -6,7 +6,7 @@ use std::path::{Path, PathBuf};
 fn check_unused_files(path: &Path, bless: bool, bad: &mut bool) {
     let mut rs_files = Vec::<PathBuf>::new();
     let mut output_files = HashSet::<PathBuf>::new();
-    let files = walkdir::WalkDir::new(&path.join("test/mir-opt")).into_iter();
+    let files = walkdir::WalkDir::new(&path.join("mir-opt")).into_iter();
 
     for file in files.filter_map(Result::ok).filter(|e| e.file_type().is_file()) {
         let filepath = file.path();
@@ -41,7 +41,7 @@ fn check_unused_files(path: &Path, bless: bool, bad: &mut bool) {
 }
 
 fn check_dash_files(path: &Path, bless: bool, bad: &mut bool) {
-    for file in walkdir::WalkDir::new(&path.join("test/mir-opt"))
+    for file in walkdir::WalkDir::new(&path.join("mir-opt"))
         .into_iter()
         .filter_map(Result::ok)
         .filter(|e| e.file_type().is_file())
diff --git a/src/tools/tidy/src/style.rs b/src/tools/tidy/src/style.rs
index b293efdc585..5c4ba869364 100644
--- a/src/tools/tidy/src/style.rs
+++ b/src/tools/tidy/src/style.rs
@@ -246,7 +246,7 @@ pub fn check(path: &Path, bad: &mut bool) {
             // This list should ideally be sourced from rustfmt.toml but we don't want to add a toml
             // parser to tidy.
             !file.ancestors().any(|a| {
-                a.ends_with("src/test") ||
+                (a.ends_with("tests") && a.join("COMPILER_TESTS.md").exists()) ||
                     a.ends_with("src/doc/book")
             });
 
@@ -324,9 +324,10 @@ pub fn check(path: &Path, bad: &mut bool) {
 
             if trimmed.contains("dbg!")
                 && !trimmed.starts_with("//")
-                && !file
-                    .ancestors()
-                    .any(|a| a.ends_with("src/test") || a.ends_with("library/alloc/tests"))
+                && !file.ancestors().any(|a| {
+                    (a.ends_with("tests") && a.join("COMPILER_TESTS.md").exists())
+                        || a.ends_with("library/alloc/tests")
+                })
                 && filename != "tests.rs"
             {
                 suppressible_tidy_err!(
diff --git a/src/tools/tidy/src/target_specific_tests.rs b/src/tools/tidy/src/target_specific_tests.rs
index 8ba25705666..d7a157672cf 100644
--- a/src/tools/tidy/src/target_specific_tests.rs
+++ b/src/tools/tidy/src/target_specific_tests.rs
@@ -35,9 +35,8 @@ struct RevisionInfo<'a> {
 }
 
 pub fn check(path: &Path, bad: &mut bool) {
-    let tests = path.join("test");
     crate::walk::walk(
-        &tests,
+        path,
         &mut |path| path.extension().map(|p| p == "rs") == Some(false),
         &mut |entry, content| {
             let file = entry.path().display();
diff --git a/src/tools/tidy/src/ui_tests.rs b/src/tools/tidy/src/ui_tests.rs
index 166d09fa8b0..806e84025c4 100644
--- a/src/tools/tidy/src/ui_tests.rs
+++ b/src/tools/tidy/src/ui_tests.rs
@@ -13,13 +13,13 @@ const ROOT_ENTRY_LIMIT: usize = 939;
 const ISSUES_ENTRY_LIMIT: usize = 1998;
 
 fn check_entries(path: &Path, bad: &mut bool) {
-    for dir in Walk::new(&path.join("test/ui")) {
+    for dir in Walk::new(&path.join("ui")) {
         if let Ok(entry) = dir {
             if entry.file_type().map(|ft| ft.is_dir()).unwrap_or(false) {
                 let dir_path = entry.path();
                 // Use special values for these dirs.
-                let is_root = path.join("test/ui") == dir_path;
-                let is_issues_dir = path.join("test/ui/issues") == dir_path;
+                let is_root = path.join("ui") == dir_path;
+                let is_issues_dir = path.join("ui/issues") == dir_path;
                 let limit = if is_root {
                     ROOT_ENTRY_LIMIT
                 } else if is_issues_dir {
@@ -53,7 +53,7 @@ fn check_entries(path: &Path, bad: &mut bool) {
 
 pub fn check(path: &Path, bad: &mut bool) {
     check_entries(&path, bad);
-    for path in &[&path.join("test/ui"), &path.join("test/ui-fulldeps")] {
+    for path in &[&path.join("ui"), &path.join("ui-fulldeps")] {
         crate::walk::walk_no_read(path, &mut |_| false, &mut |entry| {
             let file_path = entry.path();
             if let Some(ext) = file_path.extension() {
diff --git a/src/tools/tidy/src/unit_tests.rs b/src/tools/tidy/src/unit_tests.rs
index 2c23b6ebc75..27f36c85561 100644
--- a/src/tools/tidy/src/unit_tests.rs
+++ b/src/tools/tidy/src/unit_tests.rs
@@ -22,7 +22,7 @@ pub fn check(root_path: &Path, bad: &mut bool) {
         let file_name = path.file_name().unwrap_or_default();
         if path.is_dir() {
             filter_dirs(path)
-                || path.ends_with("src/test")
+                || path.ends_with("tests")
                 || path.ends_with("src/doc")
                 || (file_name == "tests" || file_name == "benches") && !is_core(path)
         } else {