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

Function instance_get_memory

crates/fuzzing/tests/oom/instance.rs:237–259  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

235
236#[test]
237fn instance_get_memory() -> Result<()> {
238 let module_bytes = {
239 let mut config = Config::new();
240 config.concurrency_support(false);
241 let engine = Engine::new(&config)?;
242 Module::new(&engine, "(module (memory (export \"m\") 1))")?.serialize()?
243 };
244 let mut config = Config::new();
245 config.enable_compiler(false);
246 config.concurrency_support(false);
247 let engine = Engine::new(&config)?;
248 let module = unsafe { Module::deserialize(&engine, &module_bytes)? };
249 let linker = Linker::<()>::new(&engine);
250 let instance_pre = linker.instantiate_pre(&module)?;
251
252 OomTest::new().test(|| {
253 let mut store = Store::try_new(&engine, ())?;
254 let instance = instance_pre.instantiate(&mut store)?;
255 let m = instance.get_memory(&mut store, "m");
256 assert!(m.is_some());
257 Ok(())
258 })
259}
260
261#[test]
262fn instance_get_global() -> Result<()> {

Callers

nothing calls this directly

Calls 11

OkFunction · 0.85
enable_compilerMethod · 0.80
newFunction · 0.50
deserializeFunction · 0.50
try_newFunction · 0.50
concurrency_supportMethod · 0.45
serializeMethod · 0.45
instantiate_preMethod · 0.45
testMethod · 0.45
instantiateMethod · 0.45
get_memoryMethod · 0.45

Tested by

no test coverage detected