diff options
| author | onur-ozkan <work@onurozkan.dev> | 2024-10-10 10:24:41 +0300 |
|---|---|---|
| committer | onur-ozkan <work@onurozkan.dev> | 2024-10-10 10:32:15 +0300 |
| commit | f6b75575e1228762fb1bbe735cb25bf868c48d8b (patch) | |
| tree | 5786858c1b62d0b10e8869116c3bdc7da4a3fff5 /src/bootstrap | |
| parent | ef5157765691acba2b82e071b0ca4410ed71a252 (diff) | |
| download | rust-f6b75575e1228762fb1bbe735cb25bf868c48d8b.tar.gz rust-f6b75575e1228762fb1bbe735cb25bf868c48d8b.zip | |
stabilize `download_ci_llvm` test
Signed-off-by: onur-ozkan <work@onurozkan.dev>
Diffstat (limited to 'src/bootstrap')
| -rw-r--r-- | src/bootstrap/src/core/config/tests.rs | 36 |
1 files changed, 14 insertions, 22 deletions
diff --git a/src/bootstrap/src/core/config/tests.rs b/src/bootstrap/src/core/config/tests.rs index e38d4eac051..01379db500b 100644 --- a/src/bootstrap/src/core/config/tests.rs +++ b/src/bootstrap/src/core/config/tests.rs @@ -20,29 +20,21 @@ fn parse(config: &str) -> Config { #[test] fn download_ci_llvm() { - if crate::core::build_steps::llvm::is_ci_llvm_modified(&parse("")) { - eprintln!("Detected LLVM as non-available: running in CI and modified LLVM in this change"); - return; + assert!(parse("").llvm_from_ci); + assert!(parse("llvm.download-ci-llvm = true").llvm_from_ci); + assert!(!parse("llvm.download-ci-llvm = false").llvm_from_ci); + + let if_unchanged_config = parse("llvm.download-ci-llvm = \"if-unchanged\""); + if if_unchanged_config.llvm_from_ci { + let has_changes = if_unchanged_config + .last_modified_commit(&["src/llvm-project"], "download-ci-llvm", true) + .is_none(); + + assert!( + !has_changes, + "CI LLVM can't be enabled with 'if-unchanged' while there are changes in LLVM submodule." + ); } - - let parse_llvm = |s| parse(s).llvm_from_ci; - let if_unchanged = parse_llvm("llvm.download-ci-llvm = \"if-unchanged\""); - - assert!(parse_llvm("llvm.download-ci-llvm = true")); - assert!(!parse_llvm("llvm.download-ci-llvm = false")); - assert_eq!(parse_llvm(""), if_unchanged); - assert_eq!(parse_llvm("rust.channel = \"dev\""), if_unchanged); - assert!(parse_llvm("rust.channel = \"stable\"")); - assert_eq!(parse_llvm("build.build = \"x86_64-unknown-linux-gnu\""), if_unchanged); - assert_eq!( - parse_llvm( - "llvm.assertions = true \r\n build.build = \"x86_64-unknown-linux-gnu\" \r\n llvm.download-ci-llvm = \"if-unchanged\"" - ), - if_unchanged - ); - assert!(!parse_llvm( - "llvm.assertions = true \r\n build.build = \"aarch64-apple-darwin\" \r\n llvm.download-ci-llvm = \"if-unchanged\"" - )); } // FIXME(onur-ozkan): extend scope of the test |
