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

Method test

crates/fuzzing/src/oom.rs:315–318  ·  view source on GitHub ↗

Repeatedly run the given test function, injecting OOMs at different times and checking that it correctly handles them. The test function should not use threads, or else allocations may not be tracked correctly and OOM injection may be incorrect. The test function should return an `Err(_)` if and only if it encounters an OOM. Returns early once the test function returns `Ok(())` before an OOM ha

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

Source from the content-addressed store, hash-verified

313 /// Returns early once the test function returns `Ok(())` before an OOM has
314 /// been injected.
315 pub fn test(&self, test_func: impl Fn() -> Result<()>) -> Result<()> {
316 let future = self.test_async(|| async { test_func() });
317 crate::block_on(future)
318 }
319
320 /// The same as `test` but `async`.
321 pub async fn test_async(&self, test_func: impl AsyncFn() -> Result<()>) -> Result<()> {

Callers 15

HFunction · 0.45
LeFunction · 0.45
config_newFunction · 0.45
instantiateFunction · 0.45
func_newFunction · 0.45
func_new_with_typeFunction · 0.45

Calls 2

test_asyncMethod · 0.80
block_onFunction · 0.70

Tested by 15

config_newFunction · 0.36
instantiateFunction · 0.36
func_newFunction · 0.36
func_new_with_typeFunction · 0.36
func_callFunction · 0.36
func_typedFunction · 0.36
func_tyFunction · 0.36