Skip to content

Commit

Permalink
Rollup merge of #80627 - bugadani:warn, r=Mark-Simulacrum
Browse files Browse the repository at this point in the history
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
  • Loading branch information
JohnTitor authored Jan 5, 2021
2 parents d85c2fe + 6002e78 commit 1c6593c
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/bootstrap/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 1c6593c

Please sign in to comment.