Skip to content

Commit e25cba0

Browse files
authored
Unrolled build for #146618
Rollup merge of #146618 - GuillaumeGomez:backend-run-llvm-options, r=kobzol Do not run ui test if options specific to LLVM are used when another codegen backend is used Based on errors in #146414, some tests with LLVM-specific options are run when another codegen is actually the one used. This PR ignores these tests in such cases now to prevent this situation. r? `@kobzol`
2 parents a9d0a6f + a535042 commit e25cba0

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

src/tools/compiletest/src/common.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,10 @@ impl CodegenBackend {
203203
Self::Llvm => "llvm",
204204
}
205205
}
206+
207+
pub fn is_llvm(self) -> bool {
208+
matches!(self, Self::Llvm)
209+
}
206210
}
207211

208212
/// Configuration for `compiletest` *per invocation*.

src/tools/compiletest/src/directives/needs.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@ pub(super) fn handle_needs(
8181
},
8282
Need {
8383
name: "needs-enzyme",
84-
condition: config.has_enzyme,
85-
ignore_reason: "ignored when LLVM Enzyme is disabled",
84+
condition: config.has_enzyme && config.default_codegen_backend.is_llvm(),
85+
ignore_reason: "ignored when LLVM Enzyme is disabled or LLVM is not the default codegen backend",
8686
},
8787
Need {
8888
name: "needs-run-enabled",
@@ -161,8 +161,8 @@ pub(super) fn handle_needs(
161161
},
162162
Need {
163163
name: "needs-llvm-zstd",
164-
condition: cache.llvm_zstd,
165-
ignore_reason: "ignored if LLVM wasn't build with zstd for ELF section compression",
164+
condition: cache.llvm_zstd && config.default_codegen_backend.is_llvm(),
165+
ignore_reason: "ignored if LLVM wasn't build with zstd for ELF section compression or LLVM is not the default codegen backend",
166166
},
167167
Need {
168168
name: "needs-rustc-debug-assertions",
@@ -279,7 +279,10 @@ pub(super) fn handle_needs(
279279

280280
// Handled elsewhere.
281281
if name == "needs-llvm-components" {
282-
return IgnoreDecision::Continue;
282+
if config.default_codegen_backend.is_llvm() {
283+
return IgnoreDecision::Continue;
284+
}
285+
return IgnoreDecision::Ignore { reason: "LLVM specific test".into() };
283286
}
284287

285288
let mut found_valid = false;

0 commit comments

Comments
 (0)