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

Function standalone_backtrace_disabled

tests/all/traps.rs:1158–1183  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1156
1157#[test]
1158fn standalone_backtrace_disabled() -> Result<()> {
1159 let mut config = Config::new();
1160 config.wasm_backtrace_max_frames(None);
1161 let engine = Engine::new(&config)?;
1162 let mut store = Store::new(&engine, ());
1163 let module = Module::new(
1164 &engine,
1165 r#"
1166 (module
1167 (import "" "" (func $host))
1168 (func $foo (export "f") call $bar)
1169 (func $bar call $host)
1170 )
1171 "#,
1172 )?;
1173 let func = Func::wrap(&mut store, |cx: Caller<'_, ()>| {
1174 let trace = WasmBacktrace::capture(&cx);
1175 assert_eq!(trace.frames().len(), 0);
1176 let trace = WasmBacktrace::force_capture(&cx);
1177 assert_eq!(trace.frames().len(), 2);
1178 });
1179 let instance = Instance::new(&mut store, &module, &[func.into()])?;
1180 let f = instance.get_typed_func::<(), ()>(&mut store, "f")?;
1181 f.call(&mut store, ())?;
1182 Ok(())
1183}
1184
1185#[test]
1186fn host_return_error_no_backtrace() -> Result<()> {

Callers

nothing calls this directly

Calls 5

captureFunction · 0.85
OkFunction · 0.85
newFunction · 0.50
callMethod · 0.45

Tested by

no test coverage detected