Skip to content

Commit 5a8d6e7

Browse files
committed
Fix bootstrap test failures
There are a number of fixes here: * if-unchanged is supposed to be the default for channel=dev, but actually used different logic. Make sure it is the same. * If no llvm section was specified at all, different logic was also used. Go through the standard helper. * Some more assertions should depend on if_unchanged.
1 parent bb7c483 commit 5a8d6e7

File tree

2 files changed

+21
-21
lines changed

2 files changed

+21
-21
lines changed

Diff for: src/bootstrap/src/core/config/config.rs

+18-18
Original file line numberDiff line numberDiff line change
@@ -1791,8 +1791,7 @@ impl Config {
17911791
config.llvm_link_shared.set(Some(true));
17921792
}
17931793
} else {
1794-
config.llvm_from_ci = config.channel == "dev"
1795-
&& crate::core::build_steps::llvm::is_ci_llvm_available(&config, false);
1794+
config.llvm_from_ci = config.parse_download_ci_llvm(None, false);
17961795
}
17971796

17981797
if let Some(t) = toml.target {
@@ -2337,29 +2336,30 @@ impl Config {
23372336
download_ci_llvm: Option<StringOrBool>,
23382337
asserts: bool,
23392338
) -> bool {
2339+
let if_unchanged = || {
2340+
// Git is needed to track modifications here, but tarball source is not available.
2341+
// If not modified here or built through tarball source, we maintain consistency
2342+
// with '"if available"'.
2343+
if !self.rust_info.is_from_tarball()
2344+
&& self
2345+
.last_modified_commit(&["src/llvm-project"], "download-ci-llvm", true)
2346+
.is_none()
2347+
{
2348+
// there are some untracked changes in the the given paths.
2349+
false
2350+
} else {
2351+
llvm::is_ci_llvm_available(&self, asserts)
2352+
}
2353+
};
23402354
match download_ci_llvm {
2341-
None => self.channel == "dev" && llvm::is_ci_llvm_available(&self, asserts),
2355+
None => self.channel == "dev" && if_unchanged(),
23422356
Some(StringOrBool::Bool(b)) => b,
23432357
// FIXME: "if-available" is deprecated. Remove this block later (around mid 2024)
23442358
// to not break builds between the recent-to-old checkouts.
23452359
Some(StringOrBool::String(s)) if s == "if-available" => {
23462360
llvm::is_ci_llvm_available(&self, asserts)
23472361
}
2348-
Some(StringOrBool::String(s)) if s == "if-unchanged" => {
2349-
// Git is needed to track modifications here, but tarball source is not available.
2350-
// If not modified here or built through tarball source, we maintain consistency
2351-
// with '"if available"'.
2352-
if !self.rust_info.is_from_tarball()
2353-
&& self
2354-
.last_modified_commit(&["src/llvm-project"], "download-ci-llvm", true)
2355-
.is_none()
2356-
{
2357-
// there are some untracked changes in the the given paths.
2358-
false
2359-
} else {
2360-
llvm::is_ci_llvm_available(&self, asserts)
2361-
}
2362-
}
2362+
Some(StringOrBool::String(s)) if s == "if-unchanged" => if_unchanged(),
23632363
Some(StringOrBool::String(other)) => {
23642364
panic!("unrecognized option for download-ci-llvm: {:?}", other)
23652365
}

Diff for: src/bootstrap/src/tests/config.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ fn download_ci_llvm() {
3131
assert_eq!(parse_llvm(""), if_unchanged);
3232
assert_eq!(parse_llvm("rust.channel = \"dev\""), if_unchanged);
3333
assert!(!parse_llvm("rust.channel = \"stable\""));
34-
assert!(parse_llvm("build.build = \"x86_64-unknown-linux-gnu\""));
35-
assert!(parse_llvm(
34+
assert_eq!(parse_llvm("build.build = \"x86_64-unknown-linux-gnu\""), if_unchanged);
35+
assert_eq!(parse_llvm(
3636
"llvm.assertions = true \r\n build.build = \"x86_64-unknown-linux-gnu\" \r\n llvm.download-ci-llvm = \"if-unchanged\""
37-
));
37+
), if_unchanged);
3838
assert!(!parse_llvm(
3939
"llvm.assertions = true \r\n build.build = \"aarch64-apple-darwin\" \r\n llvm.download-ci-llvm = \"if-unchanged\""
4040
));

0 commit comments

Comments
 (0)