From c9fb74e08eeadcaa67f60bb7b07120a1e6c5f412 Mon Sep 17 00:00:00 2001 From: onur-ozkan Date: Fri, 10 May 2024 16:06:38 +0300 Subject: [PATCH 1/3] check if `x test tests` missing any test directory Signed-off-by: onur-ozkan --- src/bootstrap/src/core/builder/tests.rs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/bootstrap/src/core/builder/tests.rs b/src/bootstrap/src/core/builder/tests.rs index 9898d495c023d..9710365ef114d 100644 --- a/src/bootstrap/src/core/builder/tests.rs +++ b/src/bootstrap/src/core/builder/tests.rs @@ -128,6 +128,26 @@ fn validate_path_remap() { }); } +#[test] +fn check_missing_paths_for_x_test_tests() { + let build = Build::new(configure("test", &["A-A"], &["A-A"])); + + let (_, tests_remap_paths) = + PATH_REMAP.iter().find(|(target_path, _)| *target_path == "tests").unwrap(); + + let tests_dir = fs::read_dir(build.src.join("tests")).unwrap(); + for dir in tests_dir { + let path = dir.unwrap().path(); + + // Skip if not a test directory. + if path.ends_with("tests/auxiliary") || !path.is_dir() { + continue + } + + assert!(tests_remap_paths.iter().any(|item| path.ends_with(*item)), "{} is missing in PATH_REMAP tests list.", path.display()); + } +} + #[test] fn test_exclude() { let mut config = configure("test", &["A-A"], &["A-A"]); From 569e547f189ed0aae49ef1902f6a485b0aa4275f Mon Sep 17 00:00:00 2001 From: onur-ozkan Date: Fri, 10 May 2024 16:06:56 +0300 Subject: [PATCH 2/3] remap missing path `tests/crashes` to `tests` Signed-off-by: onur-ozkan --- src/bootstrap/src/core/builder.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/bootstrap/src/core/builder.rs b/src/bootstrap/src/core/builder.rs index 8d7e53d2440bc..1d5dc0dddc063 100644 --- a/src/bootstrap/src/core/builder.rs +++ b/src/bootstrap/src/core/builder.rs @@ -322,6 +322,7 @@ const PATH_REMAP: &[(&str, &[&str])] = &[ "tests/codegen-units", "tests/coverage", "tests/coverage-run-rustdoc", + "tests/crashes", "tests/debuginfo", "tests/incremental", "tests/mir-opt", From 0a0b40a9e001ce67f7bfbb7b050cd55223023d87 Mon Sep 17 00:00:00 2001 From: onur-ozkan Date: Fri, 10 May 2024 16:16:05 +0300 Subject: [PATCH 3/3] add "tidy-alphabetical" check on "tests" remap list Signed-off-by: onur-ozkan --- src/bootstrap/src/core/builder.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/bootstrap/src/core/builder.rs b/src/bootstrap/src/core/builder.rs index 1d5dc0dddc063..feffa89e8a579 100644 --- a/src/bootstrap/src/core/builder.rs +++ b/src/bootstrap/src/core/builder.rs @@ -317,6 +317,7 @@ const PATH_REMAP: &[(&str, &[&str])] = &[ ( "tests", &[ + // tidy-alphabetical-start "tests/assembly", "tests/codegen", "tests/codegen-units", @@ -338,6 +339,7 @@ const PATH_REMAP: &[(&str, &[&str])] = &[ "tests/rustdoc-ui", "tests/ui", "tests/ui-fulldeps", + // tidy-alphabetical-end ], ), ];