()
| 1218 | #[test] |
| 1219 | #[cfg_attr(miri, ignore)] |
| 1220 | fn debug_ids() -> wasmtime::Result<()> { |
| 1221 | let mut config = Config::default(); |
| 1222 | config.guest_debug(true); |
| 1223 | config.wasm_exceptions(true); |
| 1224 | let engine = Engine::new(&config)?; |
| 1225 | let mut store = Store::new(&engine, ()); |
| 1226 | let module1 = Module::new( |
| 1227 | &engine, |
| 1228 | r#" |
| 1229 | (module |
| 1230 | (memory 1 1) |
| 1231 | (memory 1 1) |
| 1232 | (global (mut i32) (i32.const 0)) |
| 1233 | (global (mut i32) (i32.const 1)) |
| 1234 | (table 1 1 funcref) |
| 1235 | (table 1 1 funcref) |
| 1236 | (tag (param i32)) |
| 1237 | (tag (param i64))) |
| 1238 | "#, |
| 1239 | )?; |
| 1240 | |
| 1241 | let module2 = Module::new( |
| 1242 | &engine, |
| 1243 | r#" |
| 1244 | (module |
| 1245 | (memory (export "m") 1 1)) |
| 1246 | "#, |
| 1247 | )?; |
| 1248 | |
| 1249 | let instance1 = Instance::new(&mut store, &module1, &[])?; |
| 1250 | let instance2 = Instance::new(&mut store, &module2, &[])?; |
| 1251 | let instance3 = Instance::new(&mut store, &module1, &[])?; |
| 1252 | |
| 1253 | assert_ne!( |
| 1254 | module1.debug_index_in_engine(), |
| 1255 | module2.debug_index_in_engine() |
| 1256 | ); |
| 1257 | assert_ne!( |
| 1258 | instance1.debug_index_in_store(), |
| 1259 | instance2.debug_index_in_store() |
| 1260 | ); |
| 1261 | assert_ne!( |
| 1262 | instance1 |
| 1263 | .debug_memory(&mut store, 0) |
| 1264 | .unwrap() |
| 1265 | .debug_index_in_store(), |
| 1266 | instance1 |
| 1267 | .debug_memory(&mut store, 1) |
| 1268 | .unwrap() |
| 1269 | .debug_index_in_store() |
| 1270 | ); |
| 1271 | assert_ne!( |
| 1272 | instance1 |
| 1273 | .debug_memory(&mut store, 0) |
| 1274 | .unwrap() |
| 1275 | .debug_index_in_store(), |
| 1276 | instance2 |
| 1277 | .debug_memory(&mut store, 0) |
nothing calls this directly
no test coverage detected