Skip to content

Commit f6b7557

Browse files
committedOct 10, 2024·
stabilize download_ci_llvm test
Signed-off-by: onur-ozkan <work@onurozkan.dev>
1 parent ef51577 commit f6b7557

File tree

1 file changed

+14
-22
lines changed

1 file changed

+14
-22
lines changed
 

‎src/bootstrap/src/core/config/tests.rs

+14-22
Original file line numberDiff line numberDiff line change
@@ -20,29 +20,21 @@ fn parse(config: &str) -> Config {
2020

2121
#[test]
2222
fn download_ci_llvm() {
23-
if crate::core::build_steps::llvm::is_ci_llvm_modified(&parse("")) {
24-
eprintln!("Detected LLVM as non-available: running in CI and modified LLVM in this change");
25-
return;
23+
assert!(parse("").llvm_from_ci);
24+
assert!(parse("llvm.download-ci-llvm = true").llvm_from_ci);
25+
assert!(!parse("llvm.download-ci-llvm = false").llvm_from_ci);
26+
27+
let if_unchanged_config = parse("llvm.download-ci-llvm = \"if-unchanged\"");
28+
if if_unchanged_config.llvm_from_ci {
29+
let has_changes = if_unchanged_config
30+
.last_modified_commit(&["src/llvm-project"], "download-ci-llvm", true)
31+
.is_none();
32+
33+
assert!(
34+
!has_changes,
35+
"CI LLVM can't be enabled with 'if-unchanged' while there are changes in LLVM submodule."
36+
);
2637
}
27-
28-
let parse_llvm = |s| parse(s).llvm_from_ci;
29-
let if_unchanged = parse_llvm("llvm.download-ci-llvm = \"if-unchanged\"");
30-
31-
assert!(parse_llvm("llvm.download-ci-llvm = true"));
32-
assert!(!parse_llvm("llvm.download-ci-llvm = false"));
33-
assert_eq!(parse_llvm(""), if_unchanged);
34-
assert_eq!(parse_llvm("rust.channel = \"dev\""), if_unchanged);
35-
assert!(parse_llvm("rust.channel = \"stable\""));
36-
assert_eq!(parse_llvm("build.build = \"x86_64-unknown-linux-gnu\""), if_unchanged);
37-
assert_eq!(
38-
parse_llvm(
39-
"llvm.assertions = true \r\n build.build = \"x86_64-unknown-linux-gnu\" \r\n llvm.download-ci-llvm = \"if-unchanged\""
40-
),
41-
if_unchanged
42-
);
43-
assert!(!parse_llvm(
44-
"llvm.assertions = true \r\n build.build = \"aarch64-apple-darwin\" \r\n llvm.download-ci-llvm = \"if-unchanged\""
45-
));
4638
}
4739

4840
// FIXME(onur-ozkan): extend scope of the test

0 commit comments

Comments
 (0)
Please sign in to comment.