More rollback fixes

This commit is contained in:
ptitSeb
2022-09-01 18:02:14 +02:00
parent cc9fb4693d
commit 2752f7d390
4 changed files with 10 additions and 10 deletions

View File

@@ -55,7 +55,7 @@
//! "#; //! "#;
//! //!
//! let mut store = Store::default(); //! let mut store = Store::default();
//! let module = Module::new(&store, module_wat)?; //! let module = Module::new(&store, &module_wat)?;
//! // The module doesn't import anything, so we create an empty import object. //! // The module doesn't import anything, so we create an empty import object.
//! let import_object = imports! {}; //! let import_object = imports! {};
//! let instance = Instance::new(&mut store, &module, &import_object)?; //! let instance = Instance::new(&mut store, &module, &import_object)?;

View File

@@ -40,7 +40,7 @@ fn get_module(store: &Store) -> Result<Module> {
(start $foo) (start $foo)
"#; "#;
let module = Module::new(store, wat)?; let module = Module::new(store, &wat)?;
Ok(module) Ok(module)
} }
@@ -339,7 +339,7 @@ fn static_function_that_fails(config: crate::Config) -> Result<()> {
(start $foo) (start $foo)
"#; "#;
let module = Module::new(&store, wat)?; let module = Module::new(&store, &wat)?;
let f0 = Function::new_typed(&mut store, || -> Result<Infallible, RuntimeError> { let f0 = Function::new_typed(&mut store, || -> Result<Infallible, RuntimeError> {
Err(RuntimeError::new("oops")) Err(RuntimeError::new("oops"))
}); });
@@ -375,7 +375,7 @@ fn get_module2(store: &Store) -> Result<Module> {
(call 0)) (call 0))
"#; "#;
let module = Module::new(store, wat)?; let module = Module::new(store, &wat)?;
Ok(module) Ok(module)
} }

View File

@@ -262,7 +262,7 @@ fn trap_start_function_import(config: crate::Config) -> Result<()> {
) )
"#; "#;
let module = Module::new(&store, binary)?; let module = Module::new(&store, &binary)?;
let sig = FunctionType::new(vec![], vec![]); let sig = FunctionType::new(vec![], vec![]);
let func = Function::new(&mut store, &sig, |_| Err(RuntimeError::new("user trap"))); let func = Function::new(&mut store, &sig, |_| Err(RuntimeError::new("user trap")));
let err = Instance::new( let err = Instance::new(
@@ -302,7 +302,7 @@ fn rust_panic_import(config: crate::Config) -> Result<()> {
) )
"#; "#;
let module = Module::new(&store, binary)?; let module = Module::new(&store, &binary)?;
let sig = FunctionType::new(vec![], vec![]); let sig = FunctionType::new(vec![], vec![]);
let func = Function::new(&mut store, &sig, |_| panic!("this is a panic")); let func = Function::new(&mut store, &sig, |_| panic!("this is a panic"));
let f0 = Function::new_typed(&mut store, || panic!("this is another panic")); let f0 = Function::new_typed(&mut store, || panic!("this is another panic"));
@@ -347,7 +347,7 @@ fn rust_panic_start_function(config: crate::Config) -> Result<()> {
) )
"#; "#;
let module = Module::new(&store, binary)?; let module = Module::new(&store, &binary)?;
let sig = FunctionType::new(vec![], vec![]); let sig = FunctionType::new(vec![], vec![]);
let func = Function::new(&mut store, &sig, |_| panic!("this is a panic")); let func = Function::new(&mut store, &sig, |_| panic!("this is a panic"));
let err = panic::catch_unwind(AssertUnwindSafe(|| { let err = panic::catch_unwind(AssertUnwindSafe(|| {
@@ -393,7 +393,7 @@ fn mismatched_arguments(config: crate::Config) -> Result<()> {
) )
"#; "#;
let module = Module::new(&store, binary)?; let module = Module::new(&store, &binary)?;
let instance = Instance::new(&mut store, &module, &imports! {})?; let instance = Instance::new(&mut store, &module, &imports! {})?;
let func: &Function = instance.exports.get("foo")?; let func: &Function = instance.exports.get("foo")?;
assert_eq!( assert_eq!(
@@ -432,7 +432,7 @@ fn call_signature_mismatch(config: crate::Config) -> Result<()> {
) )
"#; "#;
let module = Module::new(&store, binary)?; let module = Module::new(&store, &binary)?;
let err = Instance::new(&mut store, &module, &imports! {}) let err = Instance::new(&mut store, &module, &imports! {})
.err() .err()
.expect("expected error"); .expect("expected error");

View File

@@ -82,7 +82,7 @@ impl<'a> WasiTest<'a> {
wasm_module.read_to_end(&mut out)?; wasm_module.read_to_end(&mut out)?;
out out
}; };
let module = Module::new(store, wasm_bytes)?; let module = Module::new(store, &wasm_bytes)?;
let (env, _tempdirs, stdout_rx, stderr_rx) = let (env, _tempdirs, stdout_rx, stderr_rx) =
self.create_wasi_env(store, filesystem_kind)?; self.create_wasi_env(store, filesystem_kind)?;
let imports = self.get_imports(store, &env.env, &module)?; let imports = self.get_imports(store, &env.env, &module)?;