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

Function instance_get_func

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

Source from the content-addressed store, hash-verified

153
154#[test]
155fn instance_get_func() -> Result<()> {
156 let module_bytes = {
157 let mut config = Config::new();
158 config.concurrency_support(false);
159 let engine = Engine::new(&config)?;
160 Module::new(
161 &engine,
162 "(module (func (export \"f\") (param i32) (result i32) (local.get 0)))",
163 )?
164 .serialize()?
165 };
166 let mut config = Config::new();
167 config.enable_compiler(false);
168 config.concurrency_support(false);
169 let engine = Engine::new(&config)?;
170 let module = unsafe { Module::deserialize(&engine, &module_bytes)? };
171 let linker = Linker::<()>::new(&engine);
172 let instance_pre = linker.instantiate_pre(&module)?;
173
174 OomTest::new().test(|| {
175 let mut store = Store::try_new(&engine, ())?;
176 let instance = instance_pre.instantiate(&mut store)?;
177 let f = instance.get_func(&mut store, "f");
178 assert!(f.is_some());
179 Ok(())
180 })
181}
182
183#[test]
184fn instance_get_typed_func() -> 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_funcMethod · 0.45

Tested by

no test coverage detected