Rollup merge of #80627 - bugadani:warn, r=Mark-Simulacrum

Builder: Warn if test file does not exist

Running `./x.py test` with a file that does not exists (but where the path belongs to a test suite) silently ignores the missing file and runs the whole test suite. This PR prints a warning to reduce the potential surprise factor.

Closes #80621
This commit is contained in:
Yuki Okushi 2021-01-05 09:52:40 +09:00 committed by GitHub
commit 1c6593c473
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 1 deletions

View File

@ -1126,7 +1126,19 @@ note: if you're sure you want to do this, please open an issue as to why. In the
Ok(path) => path,
Err(_) => p,
})
.filter(|p| p.starts_with(suite_path) && (p.is_dir() || p.is_file()))
.filter(|p| p.starts_with(suite_path))
.filter(|p| {
let exists = p.is_dir() || p.is_file();
if !exists {
if let Some(p) = p.to_str() {
builder.info(&format!(
"Warning: Skipping \"{}\": not a regular file or directory",
p
));
}
}
exists
})
.filter_map(|p| {
// Since test suite paths are themselves directories, if we don't
// specify a directory or file, we'll get an empty string here