Skip to content

Commit 565de58

Browse files
committed
Skip test download_ci_llvm with modified LLVM
1 parent 313f04f commit 565de58

File tree

2 files changed

+17
-9
lines changed

2 files changed

+17
-9
lines changed

src/bootstrap/config/tests.rs

+5
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ fn parse(config: &str) -> Config {
1111

1212
#[test]
1313
fn download_ci_llvm() {
14+
if crate::native::is_ci_llvm_modified(&parse("")) {
15+
eprintln!("Detected LLVM as non-available: running in CI and modified LLVM in this change");
16+
return;
17+
}
18+
1419
let parse_llvm = |s| parse(s).llvm_from_ci;
1520
let if_available = parse_llvm("llvm.download-ci-llvm = \"if-available\"");
1621

src/bootstrap/native.rs

+12-9
Original file line numberDiff line numberDiff line change
@@ -216,21 +216,24 @@ pub(crate) fn is_ci_llvm_available(config: &Config, asserts: bool) -> bool {
216216
}
217217
}
218218

219-
if CiEnv::is_ci() {
219+
if is_ci_llvm_modified(config) {
220+
eprintln!("Detected LLVM as non-available: running in CI and modified LLVM in this change");
221+
return false;
222+
}
223+
224+
true
225+
}
226+
227+
/// Returns true if we're running in CI with modified LLVM (and thus can't download it)
228+
pub(crate) fn is_ci_llvm_modified(config: &Config) -> bool {
229+
CiEnv::is_ci() && {
220230
// We assume we have access to git, so it's okay to unconditionally pass
221231
// `true` here.
222232
let llvm_sha = detect_llvm_sha(config, true);
223233
let head_sha = output(config.git().arg("rev-parse").arg("HEAD"));
224234
let head_sha = head_sha.trim();
225-
if llvm_sha == head_sha {
226-
eprintln!(
227-
"Detected LLVM as non-available: running in CI and modified LLVM in this change"
228-
);
229-
return false;
230-
}
235+
llvm_sha == head_sha
231236
}
232-
233-
true
234237
}
235238

236239
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]

0 commit comments

Comments
 (0)