Skip to content

Commit 12e9992

Browse files
committed
Convert wasmtime check into a compiletest needs directive
1 parent 0885380 commit 12e9992

File tree

3 files changed

+7
-9
lines changed

3 files changed

+7
-9
lines changed

src/tools/compiletest/src/header.rs

+1
Original file line numberDiff line numberDiff line change
@@ -837,6 +837,7 @@ const KNOWN_DIRECTIVE_NAMES: &[&str] = &[
837837
"needs-sanitizer-thread",
838838
"needs-threads",
839839
"needs-unwind",
840+
"needs-wasmtime",
840841
"needs-xray",
841842
"no-prefer-dynamic",
842843
"normalize-stderr-32bit",

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

+5
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,11 @@ pub(super) fn handle_needs(
149149
condition: config.target_cfg().relocation_model == "pic",
150150
ignore_reason: "ignored on targets without PIC relocation model",
151151
},
152+
Need {
153+
name: "needs-wasmtime",
154+
condition: config.runner.as_ref().is_some_and(|r| r.contains("wasmtime")),
155+
ignore_reason: "ignored when wasmtime runner is not available",
156+
},
152157
];
153158

154159
let (name, comment) = match ln.split_once([':', ' ']) {

tests/run-make/wasm-abi/rmake.rs

+1-9
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
//@ only-wasm32-wasip1
2+
//@ needs-wasmtime
23

34
extern crate run_make_support;
45

@@ -11,15 +12,6 @@ fn main() {
1112

1213
let file = tmp_dir().join("foo.wasm");
1314

14-
let has_wasmtime = match Command::new("wasmtime").arg("--version").output() {
15-
Ok(s) => s.status.success(),
16-
_ => false,
17-
};
18-
if !has_wasmtime {
19-
println!("skipping test, wasmtime isn't available");
20-
return;
21-
}
22-
2315
run(&file, "return_two_i32", "1\n2\n");
2416
run(&file, "return_two_i64", "3\n4\n");
2517
run(&file, "return_two_f32", "5\n6\n");

0 commit comments

Comments
 (0)