1 //! A single-test executable which only tests `Engine::unload_process_handlers` 2 //! is possible. 3 //! 4 //! It's not safe for this binary to contain any other tests. 5 6 #![cfg(not(miri))] 7 #![cfg(has_native_signals)] 8 9 use wasmtime::*; 10 11 #[test] test_unload_engine()12fn test_unload_engine() { 13 for _ in 0..3 { 14 std::thread::spawn(|| { 15 let engine = Engine::default(); 16 { 17 let module = 18 Module::new(&engine, r#"(module (func (export "x") unreachable))"#).unwrap(); 19 let mut store = Store::new(&engine, ()); 20 let instance = Instance::new(&mut store, &module, &[]).unwrap(); 21 let func = instance.get_typed_func::<(), ()>(&mut store, "x").unwrap(); 22 assert!(func.call(&mut store, ()).unwrap_err().is::<Trap>()); 23 } 24 unsafe { 25 engine.unload_process_handlers(); 26 } 27 }) 28 .join() 29 .unwrap(); 30 } 31 } 32