adapt bootstrap tests to the new path resolution logic
Signed-off-by: onur-ozkan <work@onurozkan.dev>
This commit is contained in:
parent
a8516c052e
commit
00cd943709
4 changed files with 21 additions and 6 deletions
|
@ -93,7 +93,7 @@ impl Step for Std {
|
||||||
const DEFAULT: bool = true;
|
const DEFAULT: bool = true;
|
||||||
|
|
||||||
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
|
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
|
||||||
run.crate_or_deps("sysroot").path("library")
|
run.crate_or_deps("sysroot").path("library").alias("core")
|
||||||
}
|
}
|
||||||
|
|
||||||
fn make_run(run: RunConfig<'_>) {
|
fn make_run(run: RunConfig<'_>) {
|
||||||
|
|
|
@ -574,7 +574,10 @@ impl Step for Std {
|
||||||
|
|
||||||
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
|
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
|
||||||
let builder = run.builder;
|
let builder = run.builder;
|
||||||
run.crate_or_deps("sysroot").path("library").default_condition(builder.config.docs)
|
run.crate_or_deps("sysroot")
|
||||||
|
.path("library")
|
||||||
|
.alias("core")
|
||||||
|
.default_condition(builder.config.docs)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn make_run(run: RunConfig<'_>) {
|
fn make_run(run: RunConfig<'_>) {
|
||||||
|
|
|
@ -367,6 +367,14 @@ struct CLIStepPath {
|
||||||
will_be_executed: bool,
|
will_be_executed: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
impl CLIStepPath {
|
||||||
|
fn will_be_executed(mut self, will_be_executed: bool) -> Self {
|
||||||
|
self.will_be_executed = will_be_executed;
|
||||||
|
self
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl Debug for CLIStepPath {
|
impl Debug for CLIStepPath {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
write!(f, "{}", self.path.display())
|
write!(f, "{}", self.path.display())
|
||||||
|
|
|
@ -108,13 +108,17 @@ fn test_intersection() {
|
||||||
};
|
};
|
||||||
let library_set = set(&["library/core", "library/alloc", "library/std"]);
|
let library_set = set(&["library/core", "library/alloc", "library/std"]);
|
||||||
let mut command_paths = vec![
|
let mut command_paths = vec![
|
||||||
PathBuf::from("library/core"),
|
CLIStepPath::from(PathBuf::from("library/core")),
|
||||||
PathBuf::from("library/alloc"),
|
CLIStepPath::from(PathBuf::from("library/alloc")),
|
||||||
PathBuf::from("library/stdarch"),
|
CLIStepPath::from(PathBuf::from("library/stdarch")),
|
||||||
];
|
];
|
||||||
let subset = library_set.intersection_removing_matches(&mut command_paths, Kind::Build);
|
let subset = library_set.intersection_removing_matches(&mut command_paths, Kind::Build);
|
||||||
assert_eq!(subset, set(&["library/core", "library/alloc"]),);
|
assert_eq!(subset, set(&["library/core", "library/alloc"]),);
|
||||||
assert_eq!(command_paths, vec![PathBuf::from("library/stdarch")]);
|
assert_eq!(command_paths, vec![
|
||||||
|
CLIStepPath::from(PathBuf::from("library/core")).will_be_executed(true),
|
||||||
|
CLIStepPath::from(PathBuf::from("library/alloc")).will_be_executed(true),
|
||||||
|
CLIStepPath::from(PathBuf::from("library/stdarch")).will_be_executed(false),
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue