Skip to content

Commit 339616b

Browse files
committed
compiletest: implement needs-subprocess directive
1 parent cf577f3 commit 339616b

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed

src/tools/compiletest/src/common.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -488,6 +488,17 @@ impl Config {
488488
git_merge_commit_email: &self.git_merge_commit_email,
489489
}
490490
}
491+
492+
pub fn has_subprocess_support(&self) -> bool {
493+
// FIXME(#135928): compiletest is always a **host** tool. Building and running an
494+
// capability detection executable against the **target** is not trivial. The short term
495+
// solution here is to hard-code some targets to allow/deny, unfortunately.
496+
497+
let unsupported_target = self.target_cfg().env == "sgx"
498+
|| matches!(self.target_cfg().arch.as_str(), "wasm32" | "wasm64")
499+
|| self.target_cfg().os == "emscripten";
500+
!unsupported_target
501+
}
491502
}
492503

493504
/// Known widths of `target_has_atomic`.

src/tools/compiletest/src/directive-list.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ const KNOWN_DIRECTIVE_NAMES: &[&str] = &[
152152
"needs-sanitizer-support",
153153
"needs-sanitizer-thread",
154154
"needs-std-debug-assertions",
155+
"needs-subprocess",
155156
"needs-symlink",
156157
"needs-target-has-atomic",
157158
"needs-threads",

src/tools/compiletest/src/header/needs.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,11 @@ pub(super) fn handle_needs(
9494
condition: config.has_threads(),
9595
ignore_reason: "ignored on targets without threading support",
9696
},
97+
Need {
98+
name: "needs-subprocess",
99+
condition: config.has_subprocess_support(),
100+
ignore_reason: "ignored on targets without subprocess support",
101+
},
97102
Need {
98103
name: "needs-unwind",
99104
condition: config.can_unwind(),
@@ -351,6 +356,9 @@ fn find_dlltool(config: &Config) -> bool {
351356
dlltool_found
352357
}
353358

359+
// FIXME(#135928): this is actually not quite right because this detection is run on the **host**.
360+
// This however still helps the case of windows -> windows local development in case symlinks are
361+
// not available.
354362
#[cfg(windows)]
355363
fn has_symlinks() -> bool {
356364
if std::env::var_os("CI").is_some() {

0 commit comments

Comments
 (0)