()
| 759 | #[tokio::test] |
| 760 | #[cfg_attr(miri, ignore)] |
| 761 | async fn drop_debuggee_and_store() -> Result<()> { |
| 762 | let _ = env_logger::try_init(); |
| 763 | |
| 764 | let mut config = Config::new(); |
| 765 | config.guest_debug(true); |
| 766 | let engine = Engine::new(&config)?; |
| 767 | let module = Module::new( |
| 768 | &engine, |
| 769 | r#" |
| 770 | (module |
| 771 | (func (export "main") (param i32 i32) (result i32) |
| 772 | local.get 0 |
| 773 | local.get 1 |
| 774 | i32.add)) |
| 775 | "#, |
| 776 | )?; |
| 777 | |
| 778 | let mut store = Store::new(&engine, ()); |
| 779 | let instance = Instance::new_async(&mut store, &module, &[]).await?; |
| 780 | let main = instance.get_func(&mut store, "main").unwrap(); |
| 781 | |
| 782 | let mut debuggee = Debuggee::new(store, move |store| { |
| 783 | Box::pin(async move { |
| 784 | let mut results = [Val::I32(0)]; |
| 785 | store.edit_breakpoints().unwrap().single_step(true).unwrap(); |
| 786 | main.call_async(&mut *store, &[Val::I32(1), Val::I32(2)], &mut results[..]) |
| 787 | .await?; |
| 788 | assert_eq!(results[0].unwrap_i32(), 3); |
| 789 | Ok(()) |
| 790 | }) |
| 791 | }); |
| 792 | |
| 793 | // Step once, then drop everything at the end of this |
| 794 | // function. Wasmtime's fiber cleanup should safely happen |
| 795 | // without attempting to raise debug async handler calls with |
| 796 | // missing async context. |
| 797 | let _ = debuggee.run().await?; |
| 798 | |
| 799 | Ok(()) |
| 800 | } |
| 801 | } |
nothing calls this directly
no test coverage detected