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

Function infinite_wasm_stack_does_not_panic

tests/all/stack_overflow.rs:167–183  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

165
166#[test]
167fn infinite_wasm_stack_does_not_panic() -> Result<()> {
168 let mut config = Config::new();
169 config.max_wasm_stack(usize::MAX);
170 config.async_stack_size(usize::MAX);
171 let engine = Engine::new(&config)?;
172 // If the store can't get allocated that's probably because we're using
173 // pulley and can't allocate a usize::MAX stack, ignore that failure.
174 // This'll still run on cranelift-native platforms.
175 let Ok(mut store) = Store::try_new(&engine, ()) else {
176 return Ok(());
177 };
178 let module = Module::new(store.engine(), r#"(module (func (export "f")))"#)?;
179 let instance = Instance::new(&mut store, &module, &[])?;
180 let func = instance.get_typed_func::<(), ()>(&mut store, "f")?;
181 func.call(&mut store, ())?;
182 Ok(())
183}

Callers

nothing calls this directly

Calls 7

OkFunction · 0.85
async_stack_sizeMethod · 0.80
newFunction · 0.50
try_newFunction · 0.50
max_wasm_stackMethod · 0.45
engineMethod · 0.45
callMethod · 0.45

Tested by

no test coverage detected