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

Function instance_get_global

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

Source from the content-addressed store, hash-verified

260
261#[test]
262fn instance_get_global() -> Result<()> {
263 let module_bytes = {
264 let mut config = Config::new();
265 config.concurrency_support(false);
266 let engine = Engine::new(&config)?;
267 Module::new(
268 &engine,
269 "(module (global (export \"g\") i32 (i32.const 42)))",
270 )?
271 .serialize()?
272 };
273 let mut config = Config::new();
274 config.enable_compiler(false);
275 config.concurrency_support(false);
276 let engine = Engine::new(&config)?;
277 let module = unsafe { Module::deserialize(&engine, &module_bytes)? };
278 let linker = Linker::<()>::new(&engine);
279 let instance_pre = linker.instantiate_pre(&module)?;
280
281 OomTest::new().test(|| {
282 let mut store = Store::try_new(&engine, ())?;
283 let instance = instance_pre.instantiate(&mut store)?;
284 let g = instance.get_global(&mut store, "g");
285 assert!(g.is_some());
286 Ok(())
287 })
288}
289
290#[test]
291fn instance_global_init_with_imported_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_globalMethod · 0.45

Tested by

no test coverage detected