Skip to content

check if x test tests missing any test directory #124969

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 3 commits into from
May 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/bootstrap/src/core/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -317,11 +317,13 @@ const PATH_REMAP: &[(&str, &[&str])] = &[
(
"tests",
&[
// tidy-alphabetical-start
"tests/assembly",
"tests/codegen",
"tests/codegen-units",
"tests/coverage",
"tests/coverage-run-rustdoc",
"tests/crashes",
"tests/debuginfo",
"tests/incremental",
"tests/mir-opt",
Expand All @@ -337,6 +339,7 @@ const PATH_REMAP: &[(&str, &[&str])] = &[
"tests/rustdoc-ui",
"tests/ui",
"tests/ui-fulldeps",
// tidy-alphabetical-end
],
),
];
Expand Down
20 changes: 20 additions & 0 deletions src/bootstrap/src/core/builder/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"]);
Expand Down
Loading