diff options
| author | Albert Larsan <74931857+albertlarsan68@users.noreply.github.com> | 2023-01-11 18:25:33 +0000 |
|---|---|---|
| committer | Albert Larsan <74931857+albertlarsan68@users.noreply.github.com> | 2023-01-11 18:25:33 +0000 |
| commit | ebd33522d701c03f816f49d2e1a05d1d1078ded9 (patch) | |
| tree | bda41248156f82f0db7becdc97a5e63d0ab636e6 | |
| parent | b22c152958eade17a71d899b29a2d39bcc77aa48 (diff) | |
| download | rust-ebd33522d701c03f816f49d2e1a05d1d1078ded9.tar.gz rust-ebd33522d701c03f816f49d2e1a05d1d1078ded9.zip | |
Deny having src/test exisiting in tidy
| -rw-r--r-- | src/tools/tidy/src/lib.rs | 1 | ||||
| -rw-r--r-- | src/tools/tidy/src/main.rs | 1 | ||||
| -rw-r--r-- | src/tools/tidy/src/tests_placement.rs | 15 |
3 files changed, 17 insertions, 0 deletions
diff --git a/src/tools/tidy/src/lib.rs b/src/tools/tidy/src/lib.rs index 15c641d748c..1eb146989e4 100644 --- a/src/tools/tidy/src/lib.rs +++ b/src/tools/tidy/src/lib.rs @@ -64,6 +64,7 @@ pub mod pal; pub mod primitive_docs; pub mod style; pub mod target_specific_tests; +pub mod tests_placement; pub mod ui_tests; pub mod unit_tests; pub mod unstable_book; diff --git a/src/tools/tidy/src/main.rs b/src/tools/tidy/src/main.rs index 2a4853b37be..79441cda64c 100644 --- a/src/tools/tidy/src/main.rs +++ b/src/tools/tidy/src/main.rs @@ -76,6 +76,7 @@ fn main() { check!(extdeps, &root_path); // Checks over tests. + check!(tests_placement, &root_path); check!(debug_artifacts, &tests_path); check!(ui_tests, &tests_path); check!(mir_opt_tests, &tests_path, bless); diff --git a/src/tools/tidy/src/tests_placement.rs b/src/tools/tidy/src/tests_placement.rs new file mode 100644 index 00000000000..9d0057df8bc --- /dev/null +++ b/src/tools/tidy/src/tests_placement.rs @@ -0,0 +1,15 @@ +use std::path::Path; + +const FORBIDDEN_PATH: &str = "src/test"; +const ALLOWED_PATH: &str = "tests"; + +pub fn check(root_path: impl AsRef<Path>, bad: &mut bool) { + if root_path.as_ref().join(FORBIDDEN_PATH).exists() { + tidy_error!( + bad, + "Tests have been moved, please move them from {} to {}", + root_path.as_ref().join(FORBIDDEN_PATH).display(), + root_path.as_ref().join(ALLOWED_PATH).display() + ) + } +} |
