MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / test_async

Method test_async

crates/fuzzing/src/oom.rs:321–338  ·  view source on GitHub ↗

The same as `test` but `async`.

(&self, test_func: impl AsyncFn() -> Result<()>)

Source from the content-addressed store, hash-verified

319
320 /// The same as `test` but `async`.
321 pub async fn test_async(&self, test_func: impl AsyncFn() -> Result<()>) -> Result<()> {
322 let total_allocs = Self::count_allocations(&test_func).await?;
323
324 let start = time::Instant::now();
325
326 for i in 0..total_allocs {
327 if self.max_iters.is_some_and(|n| i >= n)
328 || self.max_duration.is_some_and(|d| start.elapsed() >= d)
329 {
330 break;
331 }
332
333 log::trace!("=== Injecting OOM after {i} allocations ===");
334 self.run_one_oom_injection(&test_func, i).await?;
335 }
336
337 Ok(())
338 }
339
340 /// Similar to `test` but instead of exhaustively injecting OOMs on every
341 /// allocation, randomly chooses which allocation to OOM each iteration.

Callers 15

testMethod · 0.80
func_call_asyncFunction · 0.80
typed_func_call_asyncFunction · 0.80
instance_new_asyncFunction · 0.80
linker_instantiate_asyncFunction · 0.80
linker_module_asyncFunction · 0.80
memory_new_asyncFunction · 0.80

Calls 2

OkFunction · 0.85
run_one_oom_injectionMethod · 0.80

Tested by

no test coverage detected