()
| 50 | #[tokio::test] |
| 51 | #[cfg_attr(miri, ignore)] |
| 52 | async fn smoke_func_wrap() -> Result<()> { |
| 53 | let component = r#" |
| 54 | (component |
| 55 | (type $f (func)) |
| 56 | (import "i" (func $f)) |
| 57 | |
| 58 | (core module $m |
| 59 | (import "imports" "i" (func $i)) |
| 60 | (func (export "thunk") call $i) |
| 61 | ) |
| 62 | |
| 63 | (core func $f (canon lower (func $f))) |
| 64 | (core instance $i (instantiate $m |
| 65 | (with "imports" (instance |
| 66 | (export "i" (func $f)) |
| 67 | )) |
| 68 | )) |
| 69 | (func (export "thunk") |
| 70 | (canon lift (core func $i "thunk")) |
| 71 | ) |
| 72 | ) |
| 73 | "#; |
| 74 | |
| 75 | let engine = super::async_engine(); |
| 76 | let component = Component::new(&engine, component)?; |
| 77 | let mut store = Store::new(&engine, ()); |
| 78 | let mut linker = Linker::new(&engine); |
| 79 | let mut root = linker.root(); |
| 80 | root.func_wrap_async("i", |_: StoreContextMut<()>, _: ()| { |
| 81 | Box::new(async { Ok(()) }) |
| 82 | })?; |
| 83 | |
| 84 | let instance = linker.instantiate_async(&mut store, &component).await?; |
| 85 | |
| 86 | let thunk = instance.get_typed_func::<(), ()>(&mut store, "thunk")?; |
| 87 | |
| 88 | thunk.call_async(&mut store, ()).await?; |
| 89 | |
| 90 | Ok(()) |
| 91 | } |
| 92 | |
| 93 | // This test stresses TLS management in combination with the `realloc` option |
| 94 | // for imported functions. This will create an async computation which invokes a |
nothing calls this directly
no test coverage detected