()
| 1156 | |
| 1157 | #[test] |
| 1158 | fn 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] |
| 1186 | fn host_return_error_no_backtrace() -> Result<()> { |
nothing calls this directly
no test coverage detected