Skip to content

Commit

Permalink
Rollup merge of rust-lang#134209 - onur-ozkan:check-skip-paths, r=jie…
Browse files Browse the repository at this point in the history
…youxu

validate `--skip` and `--exclude` paths

Fixes rust-lang#134198

cc `@ChrisDenton`
  • Loading branch information
matthiaskrgr authored Dec 12, 2024
2 parents 9df116c + 724052f commit 5943660
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion src/bootstrap/src/core/config/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1320,7 +1320,33 @@ impl Config {

// Set flags.
config.paths = std::mem::take(&mut flags.paths);
config.skip = flags.skip.into_iter().chain(flags.exclude).collect();
config.skip = flags
.skip
.into_iter()
.chain(flags.exclude)
.map(|p| {
let p = if cfg!(windows) {
PathBuf::from(p.to_str().unwrap().replace('/', "\\"))
} else {
p
};

// Jump to top-level project path to support passing paths
// from sub directories.
let top_level_path = config.src.join(&p);
assert!(
config.src.join(&top_level_path).exists(),
"{} does not exist.",
top_level_path.display()
);

// Never return top-level path here as it would break `--skip`
// logic on rustc's internal test framework which is utilized
// by compiletest.
p
})
.collect();

config.include_default_paths = flags.include_default_paths;
config.rustc_error_format = flags.rustc_error_format;
config.json_output = flags.json_output;
Expand Down

0 comments on commit 5943660

Please sign in to comment.