Skip to content

Commit 3423ed4

Browse files
committed
Get tests passing on pulley platforms
* Add a check to `supports_host` for the generated test and assert failure also when that is false. * Remove `pulley_unsupported` test as it falls out of `#[wasmtime_test]` * Remove `exceptions_store` helper as it falls out of `#[wasmtime_test]` * Remove miri annotations as they fall out of `#[wasmtime_test]`
1 parent 8665c92 commit 3423ed4

File tree

3 files changed

+17
-41
lines changed

3 files changed

+17
-41
lines changed

crates/test-macros/src/wasmtime_test.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -270,20 +270,21 @@ fn expand(test_config: &TestConfig, func: Fn) -> Result<TokenStream> {
270270
&mut config,
271271
&#test_config,
272272
);
273+
let compiler = wasmtime_test_util::wast::Compiler::#strategy_ident;
273274
wasmtime_test_util::wasmtime_wast::apply_wast_config(
274275
&mut config,
275276
&wasmtime_test_util::wast::WastConfig {
276-
compiler: wasmtime_test_util::wast::Compiler::#strategy_ident,
277+
compiler,
277278
pooling: false,
278279
collector: wasmtime_test_util::wast::Collector::Auto,
279280
},
280281
);
281282
let result = #func_name(&mut config) #await_;
282-
if wasmtime_test_util::wast::Compiler::#strategy_ident.should_fail(&#test_config) {
283-
assert!(result.is_err());
284-
} else {
285-
result.unwrap();
286-
}
283+
if !compiler.supports_host() || compiler.should_fail(&#test_config) {
284+
assert!(result.is_err());
285+
} else {
286+
result.unwrap();
287+
}
287288
}
288289
};
289290

tests/all/exceptions.rs

Lines changed: 10 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1-
use super::exceptions_store;
21
use wasmtime::*;
32
use wasmtime_test_macros::wasmtime_test;
43

5-
#[cfg_attr(miri, ignore)]
64
#[wasmtime_test(wasm_features(exceptions))]
75
fn basic_throw(config: &mut Config) -> Result<()> {
8-
let mut store = exceptions_store(config)?;
9-
let engine = store.engine();
6+
let engine = Engine::new(config)?;
7+
let mut store = Store::new(&engine, ());
108

119
let module = Module::new(
1210
&engine,
@@ -39,10 +37,9 @@ fn basic_throw(config: &mut Config) -> Result<()> {
3937
}
4038

4139
#[wasmtime_test(wasm_features(exceptions))]
42-
#[cfg_attr(miri, ignore)]
4340
fn dynamic_tags(config: &mut Config) -> Result<()> {
44-
let mut store = exceptions_store(config)?;
45-
let engine = store.engine();
41+
let engine = Engine::new(config)?;
42+
let mut store = Store::new(&engine, ());
4643

4744
let module = Module::new(
4845
&engine,
@@ -99,10 +96,9 @@ fn dynamic_tags(config: &mut Config) -> Result<()> {
9996
}
10097

10198
#[wasmtime_test(wasm_features(exceptions))]
102-
#[cfg_attr(miri, ignore)]
10399
fn exception_escape_to_host(config: &mut Config) -> Result<()> {
104-
let mut store = exceptions_store(config)?;
105-
let engine = store.engine();
100+
let engine = Engine::new(config)?;
101+
let mut store = Store::new(&engine, ());
106102

107103
let module = Module::new(
108104
&engine,
@@ -132,10 +128,9 @@ fn exception_escape_to_host(config: &mut Config) -> Result<()> {
132128
}
133129

134130
#[wasmtime_test(wasm_features(exceptions))]
135-
#[cfg_attr(miri, ignore)]
136131
fn exception_from_host(config: &mut Config) -> Result<()> {
137-
let mut store = exceptions_store(config)?;
138-
let engine = store.engine();
132+
let engine = Engine::new(config)?;
133+
let mut store = Store::new(&engine, ());
139134

140135
let module = Module::new(
141136
&engine,
@@ -183,10 +178,9 @@ fn exception_from_host(config: &mut Config) -> Result<()> {
183178
}
184179

185180
#[wasmtime_test(wasm_features(exceptions))]
186-
#[cfg_attr(miri, ignore)]
187181
fn exception_across_no_wasm(config: &mut Config) -> Result<()> {
188-
let mut store = exceptions_store(config)?;
189-
let engine = store.engine();
182+
let engine = Engine::new(config)?;
183+
let mut store = Store::new(&engine, ());
190184

191185
let functy = FuncType::new(&engine, [ValType::I32], []);
192186
let tagty = TagType::new(functy.clone());
@@ -214,15 +208,3 @@ fn exception_across_no_wasm(config: &mut Config) -> Result<()> {
214208

215209
Ok(())
216210
}
217-
218-
#[test]
219-
#[cfg_attr(miri, ignore)]
220-
fn pulley_unsupported() -> Result<()> {
221-
use wasmtime_environ::TripleExt;
222-
let mut config = wasmtime::Config::new();
223-
config.target(&target_lexicon::Triple::pulley_host().to_string())?;
224-
config.wasm_exceptions(true);
225-
assert!(wasmtime::Engine::new(&config).is_err());
226-
227-
Ok(())
228-
}

tests/all/main.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -123,13 +123,6 @@ pub(crate) fn gc_store() -> Result<wasmtime::Store<()>> {
123123
Ok(wasmtime::Store::new(&engine, ()))
124124
}
125125

126-
pub(crate) fn exceptions_store(config: &mut Config) -> Result<wasmtime::Store<()>> {
127-
let _ = env_logger::try_init();
128-
config.wasm_exceptions(true);
129-
let engine = wasmtime::Engine::new(config)?;
130-
Ok(wasmtime::Store::new(&engine, ()))
131-
}
132-
133126
trait ErrorExt {
134127
fn assert_contains(&self, msg: &str);
135128
}

0 commit comments

Comments
 (0)