()
| 417 | #[tokio::test] |
| 418 | #[cfg_attr(miri, ignore)] |
| 419 | async fn pulley_provenance_test_async_components() -> Result<()> { |
| 420 | let config = provenance_test_config(); |
| 421 | let engine = Engine::new(&config)?; |
| 422 | let component = if cfg!(miri) { |
| 423 | unsafe { |
| 424 | Component::deserialize_file( |
| 425 | &engine, |
| 426 | "./tests/all/pulley_provenance_test_async_component.cwasm", |
| 427 | )? |
| 428 | } |
| 429 | } else { |
| 430 | Component::from_file( |
| 431 | &engine, |
| 432 | "./tests/all/pulley_provenance_test_async_component.wat", |
| 433 | )? |
| 434 | }; |
| 435 | { |
| 436 | let mut store = Store::new(&engine, ()); |
| 437 | let mut linker = component::Linker::new(&engine); |
| 438 | linker |
| 439 | .root() |
| 440 | .func_wrap_concurrent("return-slowly", |_, ()| { |
| 441 | Box::pin(async { |
| 442 | for _ in 0..5 { |
| 443 | tokio::task::yield_now().await; |
| 444 | } |
| 445 | Ok(()) |
| 446 | }) |
| 447 | })?; |
| 448 | |
| 449 | let instance = linker.instantiate_async(&mut store, &component).await?; |
| 450 | |
| 451 | let run = instance.get_typed_func::<(), ()>(&mut store, "run-stackless")?; |
| 452 | store |
| 453 | .run_concurrent(async move |accessor| { |
| 454 | wasmtime::error::Ok(run.call_concurrent(accessor, ()).await?) |
| 455 | }) |
| 456 | .await??; |
| 457 | |
| 458 | let run = instance.get_typed_func::<(), ()>(&mut store, "run-stackful")?; |
| 459 | store |
| 460 | .run_concurrent(async move |accessor| { |
| 461 | wasmtime::error::Ok(run.call_concurrent(accessor, ()).await?) |
| 462 | }) |
| 463 | .await??; |
| 464 | |
| 465 | let run = instance.get_typed_func::<(), ()>(&mut store, "run-stackless-stackless")?; |
| 466 | store |
| 467 | .run_concurrent(async move |accessor| { |
| 468 | wasmtime::error::Ok(run.call_concurrent(accessor, ()).await?) |
| 469 | }) |
| 470 | .await??; |
| 471 | |
| 472 | let run = instance.get_typed_func::<(), ()>(&mut store, "run-stackful-stackful")?; |
| 473 | store |
| 474 | .run_concurrent(async move |accessor| { |
| 475 | wasmtime::error::Ok(run.call_concurrent(accessor, ()).await?) |
| 476 | }) |
nothing calls this directly
no test coverage detected