Skip to content

Commit 5943660

Browse files
authored
Rollup merge of rust-lang#134209 - onur-ozkan:check-skip-paths, r=jieyouxu
validate `--skip` and `--exclude` paths Fixes rust-lang#134198 cc `@ChrisDenton`
2 parents 9df116c + 724052f commit 5943660

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

Diff for: src/bootstrap/src/core/config/config.rs

+27-1
Original file line numberDiff line numberDiff line change
@@ -1320,7 +1320,33 @@ impl Config {
13201320

13211321
// Set flags.
13221322
config.paths = std::mem::take(&mut flags.paths);
1323-
config.skip = flags.skip.into_iter().chain(flags.exclude).collect();
1323+
config.skip = flags
1324+
.skip
1325+
.into_iter()
1326+
.chain(flags.exclude)
1327+
.map(|p| {
1328+
let p = if cfg!(windows) {
1329+
PathBuf::from(p.to_str().unwrap().replace('/', "\\"))
1330+
} else {
1331+
p
1332+
};
1333+
1334+
// Jump to top-level project path to support passing paths
1335+
// from sub directories.
1336+
let top_level_path = config.src.join(&p);
1337+
assert!(
1338+
config.src.join(&top_level_path).exists(),
1339+
"{} does not exist.",
1340+
top_level_path.display()
1341+
);
1342+
1343+
// Never return top-level path here as it would break `--skip`
1344+
// logic on rustc's internal test framework which is utilized
1345+
// by compiletest.
1346+
p
1347+
})
1348+
.collect();
1349+
13241350
config.include_default_paths = flags.include_default_paths;
13251351
config.rustc_error_format = flags.rustc_error_format;
13261352
config.json_output = flags.json_output;

0 commit comments

Comments
 (0)