Skip to content

Commit 724052f

Browse files
committed
validate --skip and --exclude paths
Signed-off-by: onur-ozkan <[email protected]>
1 parent ae3703c commit 724052f

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

src/bootstrap/src/core/config/config.rs

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

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

0 commit comments

Comments
 (0)