Skip to content

Commit 6baf25e

Browse files
authored
Rollup merge of rust-lang#93399 - ehuss:fix-compiletest-path-relative, 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).
2 parents 2b4ce0c + 38f59a3 commit 6baf25e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/bootstrap/util.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -282,9 +282,10 @@ pub fn is_valid_test_suite_arg<'a, P: AsRef<Path>>(
282282
if !path.starts_with(suite_path) {
283283
return None;
284284
}
285-
let exists = path.is_dir() || path.is_file();
285+
let abs_path = builder.src.join(path);
286+
let exists = abs_path.is_dir() || abs_path.is_file();
286287
if !exists {
287-
if let Some(p) = path.to_str() {
288+
if let Some(p) = abs_path.to_str() {
288289
builder.info(&format!("Warning: Skipping \"{}\": not a regular file or directory", p));
289290
}
290291
return None;

0 commit comments

Comments
 (0)