1
Fork 0

adapt bootstrap tests to the new path resolution logic

Signed-off-by: onur-ozkan <work@onurozkan.dev>
This commit is contained in:
onur-ozkan 2025-01-02 18:39:25 +03:00
parent a8516c052e
commit 00cd943709
4 changed files with 21 additions and 6 deletions

View file

@ -93,7 +93,7 @@ impl Step for Std {
const DEFAULT: bool = true;
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<'_>) {

View file

@ -574,7 +574,10 @@ impl Step for Std {
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
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<'_>) {

View file

@ -367,6 +367,14 @@ struct CLIStepPath {
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 {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{}", self.path.display())

View file

@ -108,13 +108,17 @@ fn test_intersection() {
};
let library_set = set(&["library/core", "library/alloc", "library/std"]);
let mut command_paths = vec![
PathBuf::from("library/core"),
PathBuf::from("library/alloc"),
PathBuf::from("library/stdarch"),
CLIStepPath::from(PathBuf::from("library/core")),
CLIStepPath::from(PathBuf::from("library/alloc")),
CLIStepPath::from(PathBuf::from("library/stdarch")),
];
let subset = library_set.intersection_removing_matches(&mut command_paths, Kind::Build);
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]