diff --git a/crates/fuzzing/src/oracles.rs b/crates/fuzzing/src/oracles.rs index 90fa8b6edf..16fc731ae1 100644 --- a/crates/fuzzing/src/oracles.rs +++ b/crates/fuzzing/src/oracles.rs @@ -306,13 +306,10 @@ pub fn instantiate_with_dummy(store: &mut Store, module: &Module) - } let string = e.to_string(); - // Also allow errors related to fuel consumption - if string.contains("all fuel consumed") - // Currently we instantiate with a `Linker` which can't instantiate - // every single module under the sun due to using name-based resolution - // rather than positional-based resolution - || string.contains("incompatible import type") - { + // Currently we instantiate with a `Linker` which can't instantiate + // every single module under the sun due to using name-based resolution + // rather than positional-based resolution + if string.contains("incompatible import type") { log::debug!("failed to instantiate: {}", string); return None; } diff --git a/tests/all/fuel.rs b/tests/all/fuel.rs index eec8f9dff5..9b924f7284 100644 --- a/tests/all/fuel.rs +++ b/tests/all/fuel.rs @@ -116,11 +116,7 @@ fn iloop() { let mut store = Store::new(&engine, ()); store.add_fuel(10_000).unwrap(); let error = Instance::new(&mut store, &module, &[]).err().unwrap(); - assert!( - format!("{:?}", error).contains("all fuel consumed"), - "bad error: {}", - error - ); + assert_eq!(error.downcast::().unwrap(), Trap::OutOfFuel); } } @@ -172,10 +168,7 @@ fn host_function_consumes_all() { let instance = Instance::new(&mut store, &module, &[func.into()]).unwrap(); let export = instance.get_typed_func::<(), ()>(&mut store, "").unwrap(); let trap = export.call(&mut store, ()).unwrap_err(); - assert!( - format!("{trap:?}").contains("all fuel consumed"), - "bad error: {trap:?}" - ); + assert_eq!(trap.downcast::().unwrap(), Trap::OutOfFuel); } #[test]