This commit is contained in:
bjorn3 2025-02-08 22:12:13 +00:00
parent 3183b44a1e
commit 1fcae03369
287 changed files with 5888 additions and 4608 deletions

View file

@ -157,12 +157,16 @@ pub fn prebuilt_llvm_config(
/// This retrieves the LLVM sha we *want* to use, according to git history.
pub(crate) fn detect_llvm_sha(config: &Config, is_git: bool) -> String {
let llvm_sha = if is_git {
get_closest_merge_commit(Some(&config.src), &config.git_config(), &[
config.src.join("src/llvm-project"),
config.src.join("src/bootstrap/download-ci-llvm-stamp"),
// the LLVM shared object file is named `LLVM-12-rust-{version}-nightly`
config.src.join("src/version"),
])
get_closest_merge_commit(
Some(&config.src),
&config.git_config(),
&[
config.src.join("src/llvm-project"),
config.src.join("src/bootstrap/download-ci-llvm-stamp"),
// the LLVM shared object file is named `LLVM-12-rust-{version}-nightly`
config.src.join("src/version"),
],
)
.unwrap()
} else if let Some(info) = crate::utils::channel::read_commit_info_file(&config.src) {
info.sha.trim().to_owned()

View file

@ -42,11 +42,15 @@ pub enum ToolState {
impl fmt::Display for ToolState {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{}", match self {
ToolState::TestFail => "test-fail",
ToolState::TestPass => "test-pass",
ToolState::BuildFail => "build-fail",
})
write!(
f,
"{}",
match self {
ToolState::TestFail => "test-fail",
ToolState::TestPass => "test-pass",
ToolState::BuildFail => "build-fail",
}
)
}
}

View file

@ -315,29 +315,32 @@ const PATH_REMAP: &[(&str, &[&str])] = &[
// actual path is `proc-macro-srv-cli`
("rust-analyzer-proc-macro-srv", &["src/tools/rust-analyzer/crates/proc-macro-srv-cli"]),
// Make `x test tests` function the same as `x t tests/*`
("tests", &[
// tidy-alphabetical-start
"tests/assembly",
"tests/codegen",
"tests/codegen-units",
"tests/coverage",
"tests/coverage-run-rustdoc",
"tests/crashes",
"tests/debuginfo",
"tests/incremental",
"tests/mir-opt",
"tests/pretty",
"tests/run-make",
"tests/rustdoc",
"tests/rustdoc-gui",
"tests/rustdoc-js",
"tests/rustdoc-js-std",
"tests/rustdoc-json",
"tests/rustdoc-ui",
"tests/ui",
"tests/ui-fulldeps",
// tidy-alphabetical-end
]),
(
"tests",
&[
// tidy-alphabetical-start
"tests/assembly",
"tests/codegen",
"tests/codegen-units",
"tests/coverage",
"tests/coverage-run-rustdoc",
"tests/crashes",
"tests/debuginfo",
"tests/incremental",
"tests/mir-opt",
"tests/pretty",
"tests/run-make",
"tests/rustdoc",
"tests/rustdoc-gui",
"tests/rustdoc-js",
"tests/rustdoc-js-std",
"tests/rustdoc-json",
"tests/rustdoc-ui",
"tests/ui",
"tests/ui-fulldeps",
// tidy-alphabetical-end
],
),
];
fn remap_paths(paths: &mut Vec<PathBuf>) {

View file

@ -114,11 +114,14 @@ fn test_intersection() {
];
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![
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),
]);
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]
@ -135,10 +138,13 @@ fn test_resolve_parent_and_subpaths() {
let library_set = set(&["src/tools/miri", "src/tools/miri/cargo-miri"]);
library_set.intersection_removing_matches(&mut command_paths, Kind::Build);
assert_eq!(command_paths, vec![
CLIStepPath::from(PathBuf::from("src/tools/miri")).will_be_executed(true),
CLIStepPath::from(PathBuf::from("src/tools/miri/cargo-miri")).will_be_executed(true),
]);
assert_eq!(
command_paths,
vec![
CLIStepPath::from(PathBuf::from("src/tools/miri")).will_be_executed(true),
CLIStepPath::from(PathBuf::from("src/tools/miri/cargo-miri")).will_be_executed(true),
]
);
}
#[test]
@ -212,18 +218,22 @@ fn alias_and_path_for_library() {
&["library".into(), "core".into()],
configure("build", &[TEST_TRIPLE_1], &[TEST_TRIPLE_1]),
);
assert_eq!(first(cache.all::<compile::Std>()), &[
std!(TEST_TRIPLE_1 => TEST_TRIPLE_1, stage = 0),
std!(TEST_TRIPLE_1 => TEST_TRIPLE_1, stage = 1)
]);
assert_eq!(
first(cache.all::<compile::Std>()),
&[
std!(TEST_TRIPLE_1 => TEST_TRIPLE_1, stage = 0),
std!(TEST_TRIPLE_1 => TEST_TRIPLE_1, stage = 1)
]
);
let mut cache = run_build(
&["library".into(), "core".into()],
configure("doc", &[TEST_TRIPLE_1], &[TEST_TRIPLE_1]),
);
assert_eq!(first(cache.all::<doc::Std>()), &[
doc_std!(TEST_TRIPLE_1 => TEST_TRIPLE_1, stage = 0)
]);
assert_eq!(
first(cache.all::<doc::Std>()),
&[doc_std!(TEST_TRIPLE_1 => TEST_TRIPLE_1, stage = 0)]
);
}
#[test]
@ -271,10 +281,13 @@ mod defaults {
let mut cache = run_build(&[], configure("build", &[TEST_TRIPLE_1], &[TEST_TRIPLE_1]));
let a = TargetSelection::from_user(TEST_TRIPLE_1);
assert_eq!(first(cache.all::<compile::Std>()), &[
std!(TEST_TRIPLE_1 => TEST_TRIPLE_1, stage = 0),
std!(TEST_TRIPLE_1 => TEST_TRIPLE_1, stage = 1),
]);
assert_eq!(
first(cache.all::<compile::Std>()),
&[
std!(TEST_TRIPLE_1 => TEST_TRIPLE_1, stage = 0),
std!(TEST_TRIPLE_1 => TEST_TRIPLE_1, stage = 1),
]
);
assert!(!cache.all::<compile::Assemble>().is_empty());
// Make sure rustdoc is only built once.
assert_eq!(
@ -283,9 +296,10 @@ mod defaults {
// - this is the compiler it's _linked_ to, not built with.
&[tool::Rustdoc { compiler: Compiler { host: a, stage: 1 } }],
);
assert_eq!(first(cache.all::<compile::Rustc>()), &[
rustc!(TEST_TRIPLE_1 => TEST_TRIPLE_1, stage = 0)
],);
assert_eq!(
first(cache.all::<compile::Rustc>()),
&[rustc!(TEST_TRIPLE_1 => TEST_TRIPLE_1, stage = 0)],
);
}
#[test]
@ -294,9 +308,10 @@ mod defaults {
let mut cache = run_build(&[], config);
let a = TargetSelection::from_user(TEST_TRIPLE_1);
assert_eq!(first(cache.all::<compile::Std>()), &[
std!(TEST_TRIPLE_1 => TEST_TRIPLE_1, stage = 0)
]);
assert_eq!(
first(cache.all::<compile::Std>()),
&[std!(TEST_TRIPLE_1 => TEST_TRIPLE_1, stage = 0)]
);
assert!(!cache.all::<compile::Assemble>().is_empty());
assert_eq!(
first(cache.all::<tool::Rustdoc>()),
@ -323,25 +338,37 @@ mod defaults {
// there's not really a need for us to build for target A in this case
// (since we're producing stage 1 libraries/binaries). But currently
// bootstrap is just a bit buggy here; this should be fixed though.
assert_eq!(first(cache.all::<compile::Std>()), &[
std!(TEST_TRIPLE_1 => TEST_TRIPLE_1, stage = 0),
std!(TEST_TRIPLE_1 => TEST_TRIPLE_1, stage = 1),
std!(TEST_TRIPLE_1 => TEST_TRIPLE_2, stage = 0),
std!(TEST_TRIPLE_1 => TEST_TRIPLE_2, stage = 1),
]);
assert_eq!(first(cache.all::<compile::Assemble>()), &[
compile::Assemble { target_compiler: Compiler { host: a, stage: 0 } },
compile::Assemble { target_compiler: Compiler { host: a, stage: 1 } },
compile::Assemble { target_compiler: Compiler { host: b, stage: 1 } },
]);
assert_eq!(first(cache.all::<tool::Rustdoc>()), &[
tool::Rustdoc { compiler: Compiler { host: a, stage: 1 } },
tool::Rustdoc { compiler: Compiler { host: b, stage: 1 } },
],);
assert_eq!(first(cache.all::<compile::Rustc>()), &[
rustc!(TEST_TRIPLE_1 => TEST_TRIPLE_1, stage = 0),
rustc!(TEST_TRIPLE_1 => TEST_TRIPLE_2, stage = 0),
]);
assert_eq!(
first(cache.all::<compile::Std>()),
&[
std!(TEST_TRIPLE_1 => TEST_TRIPLE_1, stage = 0),
std!(TEST_TRIPLE_1 => TEST_TRIPLE_1, stage = 1),
std!(TEST_TRIPLE_1 => TEST_TRIPLE_2, stage = 0),
std!(TEST_TRIPLE_1 => TEST_TRIPLE_2, stage = 1),
]
);
assert_eq!(
first(cache.all::<compile::Assemble>()),
&[
compile::Assemble { target_compiler: Compiler { host: a, stage: 0 } },
compile::Assemble { target_compiler: Compiler { host: a, stage: 1 } },
compile::Assemble { target_compiler: Compiler { host: b, stage: 1 } },
]
);
assert_eq!(
first(cache.all::<tool::Rustdoc>()),
&[
tool::Rustdoc { compiler: Compiler { host: a, stage: 1 } },
tool::Rustdoc { compiler: Compiler { host: b, stage: 1 } },
],
);
assert_eq!(
first(cache.all::<compile::Rustc>()),
&[
rustc!(TEST_TRIPLE_1 => TEST_TRIPLE_1, stage = 0),
rustc!(TEST_TRIPLE_1 => TEST_TRIPLE_2, stage = 0),
]
);
}
#[test]
@ -355,15 +382,17 @@ mod defaults {
// error_index_generator uses stage 0 to share rustdoc artifacts with the
// rustdoc tool.
assert_eq!(first(cache.all::<doc::ErrorIndex>()), &[doc::ErrorIndex { target: a },]);
assert_eq!(first(cache.all::<tool::ErrorIndex>()), &[tool::ErrorIndex {
compiler: Compiler { host: a, stage: 0 }
}]);
assert_eq!(
first(cache.all::<tool::ErrorIndex>()),
&[tool::ErrorIndex { compiler: Compiler { host: a, stage: 0 } }]
);
// docs should be built with the beta compiler, not with the stage0 artifacts.
// recall that rustdoc is off-by-one: `stage` is the compiler rustdoc is _linked_ to,
// not the one it was built by.
assert_eq!(first(cache.all::<tool::Rustdoc>()), &[tool::Rustdoc {
compiler: Compiler { host: a, stage: 0 }
},]);
assert_eq!(
first(cache.all::<tool::Rustdoc>()),
&[tool::Rustdoc { compiler: Compiler { host: a, stage: 0 } },]
);
}
}
@ -385,18 +414,20 @@ mod dist {
assert_eq!(first(cache.all::<dist::Docs>()), &[dist::Docs { host: a },]);
assert_eq!(first(cache.all::<dist::Mingw>()), &[dist::Mingw { host: a },]);
assert_eq!(first(cache.all::<dist::Rustc>()), &[dist::Rustc {
compiler: Compiler { host: a, stage: 2 }
},]);
assert_eq!(first(cache.all::<dist::Std>()), &[dist::Std {
compiler: Compiler { host: a, stage: 1 },
target: a
},]);
assert_eq!(
first(cache.all::<dist::Rustc>()),
&[dist::Rustc { compiler: Compiler { host: a, stage: 2 } },]
);
assert_eq!(
first(cache.all::<dist::Std>()),
&[dist::Std { compiler: Compiler { host: a, stage: 1 }, target: a },]
);
assert_eq!(first(cache.all::<dist::Src>()), &[dist::Src]);
// Make sure rustdoc is only built once.
assert_eq!(first(cache.all::<tool::Rustdoc>()), &[tool::Rustdoc {
compiler: Compiler { host: a, stage: 2 }
},]);
assert_eq!(
first(cache.all::<tool::Rustdoc>()),
&[tool::Rustdoc { compiler: Compiler { host: a, stage: 2 } },]
);
}
#[test]
@ -407,19 +438,25 @@ mod dist {
let a = TargetSelection::from_user(TEST_TRIPLE_1);
let b = TargetSelection::from_user(TEST_TRIPLE_2);
assert_eq!(first(cache.all::<dist::Docs>()), &[dist::Docs { host: a }, dist::Docs {
host: b
},]);
assert_eq!(first(cache.all::<dist::Mingw>()), &[dist::Mingw { host: a }, dist::Mingw {
host: b
},]);
assert_eq!(first(cache.all::<dist::Rustc>()), &[dist::Rustc {
compiler: Compiler { host: a, stage: 2 }
},]);
assert_eq!(first(cache.all::<dist::Std>()), &[
dist::Std { compiler: Compiler { host: a, stage: 1 }, target: a },
dist::Std { compiler: Compiler { host: a, stage: 2 }, target: b },
]);
assert_eq!(
first(cache.all::<dist::Docs>()),
&[dist::Docs { host: a }, dist::Docs { host: b },]
);
assert_eq!(
first(cache.all::<dist::Mingw>()),
&[dist::Mingw { host: a }, dist::Mingw { host: b },]
);
assert_eq!(
first(cache.all::<dist::Rustc>()),
&[dist::Rustc { compiler: Compiler { host: a, stage: 2 } },]
);
assert_eq!(
first(cache.all::<dist::Std>()),
&[
dist::Std { compiler: Compiler { host: a, stage: 1 }, target: a },
dist::Std { compiler: Compiler { host: a, stage: 2 }, target: b },
]
);
assert_eq!(first(cache.all::<dist::Src>()), &[dist::Src]);
}
@ -433,27 +470,38 @@ mod dist {
let a = TargetSelection::from_user(TEST_TRIPLE_1);
let b = TargetSelection::from_user(TEST_TRIPLE_2);
assert_eq!(first(cache.all::<dist::Docs>()), &[dist::Docs { host: a }, dist::Docs {
host: b
},]);
assert_eq!(first(cache.all::<dist::Mingw>()), &[dist::Mingw { host: a }, dist::Mingw {
host: b
},]);
assert_eq!(first(cache.all::<dist::Rustc>()), &[
dist::Rustc { compiler: Compiler { host: a, stage: 2 } },
dist::Rustc { compiler: Compiler { host: b, stage: 2 } },
]);
assert_eq!(first(cache.all::<dist::Std>()), &[
dist::Std { compiler: Compiler { host: a, stage: 1 }, target: a },
dist::Std { compiler: Compiler { host: a, stage: 1 }, target: b },
]);
assert_eq!(first(cache.all::<compile::Std>()), &[
std!(TEST_TRIPLE_1 => TEST_TRIPLE_1, stage = 0),
std!(TEST_TRIPLE_1 => TEST_TRIPLE_1, stage = 1),
std!(TEST_TRIPLE_1 => TEST_TRIPLE_1, stage = 2),
std!(TEST_TRIPLE_1 => TEST_TRIPLE_2, stage = 1),
std!(TEST_TRIPLE_1 => TEST_TRIPLE_2, stage = 2),
],);
assert_eq!(
first(cache.all::<dist::Docs>()),
&[dist::Docs { host: a }, dist::Docs { host: b },]
);
assert_eq!(
first(cache.all::<dist::Mingw>()),
&[dist::Mingw { host: a }, dist::Mingw { host: b },]
);
assert_eq!(
first(cache.all::<dist::Rustc>()),
&[
dist::Rustc { compiler: Compiler { host: a, stage: 2 } },
dist::Rustc { compiler: Compiler { host: b, stage: 2 } },
]
);
assert_eq!(
first(cache.all::<dist::Std>()),
&[
dist::Std { compiler: Compiler { host: a, stage: 1 }, target: a },
dist::Std { compiler: Compiler { host: a, stage: 1 }, target: b },
]
);
assert_eq!(
first(cache.all::<compile::Std>()),
&[
std!(TEST_TRIPLE_1 => TEST_TRIPLE_1, stage = 0),
std!(TEST_TRIPLE_1 => TEST_TRIPLE_1, stage = 1),
std!(TEST_TRIPLE_1 => TEST_TRIPLE_1, stage = 2),
std!(TEST_TRIPLE_1 => TEST_TRIPLE_2, stage = 1),
std!(TEST_TRIPLE_1 => TEST_TRIPLE_2, stage = 2),
],
);
assert_eq!(first(cache.all::<dist::Src>()), &[dist::Src]);
}
@ -467,49 +515,56 @@ mod dist {
config.hosts = vec![b];
let mut cache = run_build(&[], config);
assert_eq!(first(cache.all::<dist::Rustc>()), &[dist::Rustc {
compiler: Compiler { host: b, stage: 2 }
},]);
assert_eq!(first(cache.all::<compile::Rustc>()), &[
rustc!(TEST_TRIPLE_1 => TEST_TRIPLE_1, stage = 0),
rustc!(TEST_TRIPLE_1 => TEST_TRIPLE_2, stage = 1),
]);
assert_eq!(
first(cache.all::<dist::Rustc>()),
&[dist::Rustc { compiler: Compiler { host: b, stage: 2 } },]
);
assert_eq!(
first(cache.all::<compile::Rustc>()),
&[
rustc!(TEST_TRIPLE_1 => TEST_TRIPLE_1, stage = 0),
rustc!(TEST_TRIPLE_1 => TEST_TRIPLE_2, stage = 1),
]
);
}
#[test]
fn dist_with_targets_and_hosts() {
let mut cache = run_build(
&[],
configure(&[TEST_TRIPLE_1, TEST_TRIPLE_2], &[
TEST_TRIPLE_1,
TEST_TRIPLE_2,
TEST_TRIPLE_3,
]),
configure(
&[TEST_TRIPLE_1, TEST_TRIPLE_2],
&[TEST_TRIPLE_1, TEST_TRIPLE_2, TEST_TRIPLE_3],
),
);
let a = TargetSelection::from_user(TEST_TRIPLE_1);
let b = TargetSelection::from_user(TEST_TRIPLE_2);
let c = TargetSelection::from_user(TEST_TRIPLE_3);
assert_eq!(first(cache.all::<dist::Docs>()), &[
dist::Docs { host: a },
dist::Docs { host: b },
dist::Docs { host: c },
]);
assert_eq!(first(cache.all::<dist::Mingw>()), &[
dist::Mingw { host: a },
dist::Mingw { host: b },
dist::Mingw { host: c },
]);
assert_eq!(first(cache.all::<dist::Rustc>()), &[
dist::Rustc { compiler: Compiler { host: a, stage: 2 } },
dist::Rustc { compiler: Compiler { host: b, stage: 2 } },
]);
assert_eq!(first(cache.all::<dist::Std>()), &[
dist::Std { compiler: Compiler { host: a, stage: 1 }, target: a },
dist::Std { compiler: Compiler { host: a, stage: 1 }, target: b },
dist::Std { compiler: Compiler { host: a, stage: 2 }, target: c },
]);
assert_eq!(
first(cache.all::<dist::Docs>()),
&[dist::Docs { host: a }, dist::Docs { host: b }, dist::Docs { host: c },]
);
assert_eq!(
first(cache.all::<dist::Mingw>()),
&[dist::Mingw { host: a }, dist::Mingw { host: b }, dist::Mingw { host: c },]
);
assert_eq!(
first(cache.all::<dist::Rustc>()),
&[
dist::Rustc { compiler: Compiler { host: a, stage: 2 } },
dist::Rustc { compiler: Compiler { host: b, stage: 2 } },
]
);
assert_eq!(
first(cache.all::<dist::Std>()),
&[
dist::Std { compiler: Compiler { host: a, stage: 1 }, target: a },
dist::Std { compiler: Compiler { host: a, stage: 1 }, target: b },
dist::Std { compiler: Compiler { host: a, stage: 2 }, target: c },
]
);
assert_eq!(first(cache.all::<dist::Src>()), &[dist::Src]);
}
@ -523,10 +578,10 @@ mod dist {
assert_eq!(first(cache.all::<dist::Docs>()), &[dist::Docs { host: c },]);
assert_eq!(first(cache.all::<dist::Mingw>()), &[dist::Mingw { host: c },]);
assert_eq!(first(cache.all::<dist::Std>()), &[dist::Std {
compiler: Compiler { host: a, stage: 2 },
target: c
},]);
assert_eq!(
first(cache.all::<dist::Std>()),
&[dist::Std { compiler: Compiler { host: a, stage: 2 }, target: c },]
);
}
#[test]
@ -539,65 +594,84 @@ mod dist {
let a = TargetSelection::from_user(TEST_TRIPLE_1);
let b = TargetSelection::from_user(TEST_TRIPLE_2);
assert_eq!(first(cache.all::<dist::Docs>()), &[dist::Docs { host: a }, dist::Docs {
host: b
},]);
assert_eq!(first(cache.all::<dist::Mingw>()), &[dist::Mingw { host: a }, dist::Mingw {
host: b
},]);
assert_eq!(first(cache.all::<dist::Rustc>()), &[
dist::Rustc { compiler: Compiler { host: a, stage: 2 } },
dist::Rustc { compiler: Compiler { host: b, stage: 2 } },
]);
assert_eq!(first(cache.all::<dist::Std>()), &[
dist::Std { compiler: Compiler { host: a, stage: 1 }, target: a },
dist::Std { compiler: Compiler { host: a, stage: 1 }, target: b },
]);
assert_eq!(
first(cache.all::<dist::Docs>()),
&[dist::Docs { host: a }, dist::Docs { host: b },]
);
assert_eq!(
first(cache.all::<dist::Mingw>()),
&[dist::Mingw { host: a }, dist::Mingw { host: b },]
);
assert_eq!(
first(cache.all::<dist::Rustc>()),
&[
dist::Rustc { compiler: Compiler { host: a, stage: 2 } },
dist::Rustc { compiler: Compiler { host: b, stage: 2 } },
]
);
assert_eq!(
first(cache.all::<dist::Std>()),
&[
dist::Std { compiler: Compiler { host: a, stage: 1 }, target: a },
dist::Std { compiler: Compiler { host: a, stage: 1 }, target: b },
]
);
assert_eq!(first(cache.all::<dist::Src>()), &[dist::Src]);
assert_eq!(first(cache.all::<compile::Std>()), &[
std!(TEST_TRIPLE_1 => TEST_TRIPLE_1, stage = 0),
std!(TEST_TRIPLE_1 => TEST_TRIPLE_1, stage = 1),
std!(TEST_TRIPLE_1 => TEST_TRIPLE_1, stage = 2),
std!(TEST_TRIPLE_1 => TEST_TRIPLE_2, stage = 1),
std!(TEST_TRIPLE_1 => TEST_TRIPLE_2, stage = 2),
]);
assert_eq!(first(cache.all::<compile::Assemble>()), &[
compile::Assemble { target_compiler: Compiler { host: a, stage: 0 } },
compile::Assemble { target_compiler: Compiler { host: a, stage: 1 } },
compile::Assemble { target_compiler: Compiler { host: a, stage: 2 } },
compile::Assemble { target_compiler: Compiler { host: b, stage: 2 } },
]);
assert_eq!(
first(cache.all::<compile::Std>()),
&[
std!(TEST_TRIPLE_1 => TEST_TRIPLE_1, stage = 0),
std!(TEST_TRIPLE_1 => TEST_TRIPLE_1, stage = 1),
std!(TEST_TRIPLE_1 => TEST_TRIPLE_1, stage = 2),
std!(TEST_TRIPLE_1 => TEST_TRIPLE_2, stage = 1),
std!(TEST_TRIPLE_1 => TEST_TRIPLE_2, stage = 2),
]
);
assert_eq!(
first(cache.all::<compile::Assemble>()),
&[
compile::Assemble { target_compiler: Compiler { host: a, stage: 0 } },
compile::Assemble { target_compiler: Compiler { host: a, stage: 1 } },
compile::Assemble { target_compiler: Compiler { host: a, stage: 2 } },
compile::Assemble { target_compiler: Compiler { host: b, stage: 2 } },
]
);
}
#[test]
fn build_all() {
let build = Build::new(configure(&[TEST_TRIPLE_1, TEST_TRIPLE_2], &[
TEST_TRIPLE_1,
TEST_TRIPLE_2,
TEST_TRIPLE_3,
]));
let build = Build::new(configure(
&[TEST_TRIPLE_1, TEST_TRIPLE_2],
&[TEST_TRIPLE_1, TEST_TRIPLE_2, TEST_TRIPLE_3],
));
let mut builder = Builder::new(&build);
builder.run_step_descriptions(&Builder::get_step_descriptions(Kind::Build), &[
"compiler/rustc".into(),
"library".into(),
]);
builder.run_step_descriptions(
&Builder::get_step_descriptions(Kind::Build),
&["compiler/rustc".into(), "library".into()],
);
assert_eq!(first(builder.cache.all::<compile::Std>()), &[
std!(TEST_TRIPLE_1 => TEST_TRIPLE_1, stage = 0),
std!(TEST_TRIPLE_1 => TEST_TRIPLE_1, stage = 1),
std!(TEST_TRIPLE_1 => TEST_TRIPLE_1, stage = 2),
std!(TEST_TRIPLE_1 => TEST_TRIPLE_2, stage = 1),
std!(TEST_TRIPLE_1 => TEST_TRIPLE_2, stage = 2),
std!(TEST_TRIPLE_1 => TEST_TRIPLE_3, stage = 2),
]);
assert_eq!(
first(builder.cache.all::<compile::Std>()),
&[
std!(TEST_TRIPLE_1 => TEST_TRIPLE_1, stage = 0),
std!(TEST_TRIPLE_1 => TEST_TRIPLE_1, stage = 1),
std!(TEST_TRIPLE_1 => TEST_TRIPLE_1, stage = 2),
std!(TEST_TRIPLE_1 => TEST_TRIPLE_2, stage = 1),
std!(TEST_TRIPLE_1 => TEST_TRIPLE_2, stage = 2),
std!(TEST_TRIPLE_1 => TEST_TRIPLE_3, stage = 2),
]
);
assert_eq!(builder.cache.all::<compile::Assemble>().len(), 5);
assert_eq!(first(builder.cache.all::<compile::Rustc>()), &[
rustc!(TEST_TRIPLE_1 => TEST_TRIPLE_1, stage = 0),
rustc!(TEST_TRIPLE_1 => TEST_TRIPLE_1, stage = 1),
rustc!(TEST_TRIPLE_1 => TEST_TRIPLE_1, stage = 2),
rustc!(TEST_TRIPLE_1 => TEST_TRIPLE_2, stage = 1),
rustc!(TEST_TRIPLE_1 => TEST_TRIPLE_2, stage = 2),
]);
assert_eq!(
first(builder.cache.all::<compile::Rustc>()),
&[
rustc!(TEST_TRIPLE_1 => TEST_TRIPLE_1, stage = 0),
rustc!(TEST_TRIPLE_1 => TEST_TRIPLE_1, stage = 1),
rustc!(TEST_TRIPLE_1 => TEST_TRIPLE_1, stage = 2),
rustc!(TEST_TRIPLE_1 => TEST_TRIPLE_2, stage = 1),
rustc!(TEST_TRIPLE_1 => TEST_TRIPLE_2, stage = 2),
]
);
}
#[test]
@ -626,20 +700,29 @@ mod dist {
let a = TargetSelection::from_user(TEST_TRIPLE_1);
assert_eq!(first(builder.cache.all::<compile::Std>()), &[
std!(TEST_TRIPLE_1 => TEST_TRIPLE_1, stage = 0),
std!(TEST_TRIPLE_1 => TEST_TRIPLE_1, stage = 1),
std!(TEST_TRIPLE_1 => TEST_TRIPLE_3, stage = 2),
]);
assert_eq!(first(builder.cache.all::<compile::Assemble>()), &[
compile::Assemble { target_compiler: Compiler { host: a, stage: 0 } },
compile::Assemble { target_compiler: Compiler { host: a, stage: 1 } },
compile::Assemble { target_compiler: Compiler { host: a, stage: 2 } },
]);
assert_eq!(first(builder.cache.all::<compile::Rustc>()), &[
rustc!(TEST_TRIPLE_1 => TEST_TRIPLE_1, stage = 0),
rustc!(TEST_TRIPLE_1 => TEST_TRIPLE_1, stage = 1),
]);
assert_eq!(
first(builder.cache.all::<compile::Std>()),
&[
std!(TEST_TRIPLE_1 => TEST_TRIPLE_1, stage = 0),
std!(TEST_TRIPLE_1 => TEST_TRIPLE_1, stage = 1),
std!(TEST_TRIPLE_1 => TEST_TRIPLE_3, stage = 2),
]
);
assert_eq!(
first(builder.cache.all::<compile::Assemble>()),
&[
compile::Assemble { target_compiler: Compiler { host: a, stage: 0 } },
compile::Assemble { target_compiler: Compiler { host: a, stage: 1 } },
compile::Assemble { target_compiler: Compiler { host: a, stage: 2 } },
]
);
assert_eq!(
first(builder.cache.all::<compile::Rustc>()),
&[
rustc!(TEST_TRIPLE_1 => TEST_TRIPLE_1, stage = 0),
rustc!(TEST_TRIPLE_1 => TEST_TRIPLE_1, stage = 1),
]
);
}
#[test]
@ -669,18 +752,22 @@ mod dist {
let host = TargetSelection::from_user(TEST_TRIPLE_1);
builder.run_step_descriptions(&[StepDescription::from::<test::Crate>(Kind::Test)], &[
"library/std".into(),
]);
builder.run_step_descriptions(
&[StepDescription::from::<test::Crate>(Kind::Test)],
&["library/std".into()],
);
// Ensure we don't build any compiler artifacts.
assert!(!builder.cache.contains::<compile::Rustc>());
assert_eq!(first(builder.cache.all::<test::Crate>()), &[test::Crate {
compiler: Compiler { host, stage: 0 },
target: host,
mode: crate::Mode::Std,
crates: vec!["std".to_owned()],
},]);
assert_eq!(
first(builder.cache.all::<test::Crate>()),
&[test::Crate {
compiler: Compiler { host, stage: 0 },
target: host,
mode: crate::Mode::Std,
crates: vec!["std".to_owned()],
},]
);
}
#[test]
@ -699,14 +786,16 @@ mod dist {
first(builder.cache.all::<doc::ErrorIndex>()),
&[doc::ErrorIndex { target: a },]
);
assert_eq!(first(builder.cache.all::<tool::ErrorIndex>()), &[tool::ErrorIndex {
compiler: Compiler { host: a, stage: 1 }
}]);
assert_eq!(
first(builder.cache.all::<tool::ErrorIndex>()),
&[tool::ErrorIndex { compiler: Compiler { host: a, stage: 1 } }]
);
// This is actually stage 1, but Rustdoc::run swaps out the compiler with
// stage minus 1 if --stage is not 0. Very confusing!
assert_eq!(first(builder.cache.all::<tool::Rustdoc>()), &[tool::Rustdoc {
compiler: Compiler { host: a, stage: 2 }
},]);
assert_eq!(
first(builder.cache.all::<tool::Rustdoc>()),
&[tool::Rustdoc { compiler: Compiler { host: a, stage: 2 } },]
);
}
#[test]
@ -743,9 +832,10 @@ mod dist {
first(builder.cache.all::<doc::ErrorIndex>()),
&[doc::ErrorIndex { target: a },]
);
assert_eq!(first(builder.cache.all::<tool::ErrorIndex>()), &[tool::ErrorIndex {
compiler: Compiler { host: a, stage: 1 }
}]);
assert_eq!(
first(builder.cache.all::<tool::ErrorIndex>()),
&[tool::ErrorIndex { compiler: Compiler { host: a, stage: 1 } }]
);
// Unfortunately rustdoc is built twice. Once from stage1 for compiletest
// (and other things), and once from stage0 for std crates. Ideally it
// would only be built once. If someone wants to fix this, it might be
@ -757,11 +847,14 @@ mod dist {
// The stage 0 copy is the one downloaded for bootstrapping. It is
// (currently) needed to run "cargo test" on the linkchecker, and
// should be relatively "free".
assert_eq!(first(builder.cache.all::<tool::Rustdoc>()), &[
tool::Rustdoc { compiler: Compiler { host: a, stage: 0 } },
tool::Rustdoc { compiler: Compiler { host: a, stage: 1 } },
tool::Rustdoc { compiler: Compiler { host: a, stage: 2 } },
]);
assert_eq!(
first(builder.cache.all::<tool::Rustdoc>()),
&[
tool::Rustdoc { compiler: Compiler { host: a, stage: 0 } },
tool::Rustdoc { compiler: Compiler { host: a, stage: 1 } },
tool::Rustdoc { compiler: Compiler { host: a, stage: 2 } },
]
);
}
}

View file

@ -1928,11 +1928,14 @@ impl Config {
config.rustc_default_linker = default_linker;
config.musl_root = musl_root.map(PathBuf::from);
config.save_toolstates = save_toolstates.map(PathBuf::from);
set(&mut config.deny_warnings, match flags.warnings {
Warnings::Deny => Some(true),
Warnings::Warn => Some(false),
Warnings::Default => deny_warnings,
});
set(
&mut config.deny_warnings,
match flags.warnings {
Warnings::Deny => Some(true),
Warnings::Warn => Some(false),
Warnings::Default => deny_warnings,
},
);
set(&mut config.backtrace_on_ice, backtrace_on_ice);
set(&mut config.rust_verify_llvm_ir, verify_llvm_ir);
config.rust_thin_lto_import_instr_limit = thin_lto_import_instr_limit;