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

Function instance_exports

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

Source from the content-addressed store, hash-verified

124
125#[test]
126fn instance_exports() -> Result<()> {
127 let module_bytes = {
128 let mut config = Config::new();
129 config.concurrency_support(false);
130 let engine = Engine::new(&config)?;
131 Module::new(
132 &engine,
133 "(module (func (export \"f\")) (memory (export \"m\") 1) (global (export \"g\") i32 (i32.const 0)))",
134 )?
135 .serialize()?
136 };
137 let mut config = Config::new();
138 config.enable_compiler(false);
139 config.concurrency_support(false);
140 let engine = Engine::new(&config)?;
141 let module = unsafe { Module::deserialize(&engine, &module_bytes)? };
142 let linker = Linker::<()>::new(&engine);
143 let instance_pre = linker.instantiate_pre(&module)?;
144
145 OomTest::new().test(|| {
146 let mut store = Store::try_new(&engine, ())?;
147 let instance = instance_pre.instantiate(&mut store)?;
148 let count = instance.exports(&mut store).count();
149 assert_eq!(count, 3);
150 Ok(())
151 })
152}
153
154#[test]
155fn instance_get_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
exportsMethod · 0.45

Tested by

no test coverage detected