Skip to content

Commit

Permalink
Rollup merge of rust-lang#93399 - ehuss:fix-compiletest-path-relative…
Browse files Browse the repository at this point in the history
…, r=Mark-Simulacrum

rustbuild: Fix compiletest warning when building outside of root.

This fixes a warning that would happen when passing arguments to compiletest (like `x.py test src/test/ui`) when running `x.py` outside of the root source directory. For example, the CI builders do this, which causes a confusing warning message. This also fixes it so that passing a full path works (like `x.py test src/test/ui/hello.rs`) in the same scenario (previously it would just ignore the `hello.rs` part).
  • Loading branch information
matthiaskrgr authored Jan 28, 2022
2 parents be1c9b5 + 38f59a3 commit e9105fe
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/bootstrap/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -282,9 +282,10 @@ pub fn is_valid_test_suite_arg<'a, P: AsRef<Path>>(
if !path.starts_with(suite_path) {
return None;
}
let exists = path.is_dir() || path.is_file();
let abs_path = builder.src.join(path);
let exists = abs_path.is_dir() || abs_path.is_file();
if !exists {
if let Some(p) = path.to_str() {
if let Some(p) = abs_path.to_str() {
builder.info(&format!("Warning: Skipping \"{}\": not a regular file or directory", p));
}
return None;
Expand Down

0 comments on commit e9105fe

Please sign in to comment.