Browse Source

Remove HostRefs in custom_signal_handlers

pull/785/head
Jakub Konka 5 years ago
parent
commit
64afd0305a
  1. 21
      tests/custom_signal_handler.rs

21
tests/custom_signal_handler.rs

@ -74,11 +74,11 @@ mod tests {
#[test] #[test]
fn test_custom_signal_handler_single_instance() { fn test_custom_signal_handler_single_instance() {
let engine = HostRef::new(Engine::new(&Config::default())); let engine = Engine::new(&Config::default());
let store = HostRef::new(Store::new(&engine)); let store = Store::new(&engine);
let data = let data =
std::fs::read("tests/custom_signal_handler.wasm").expect("failed to read wasm file"); std::fs::read("tests/custom_signal_handler.wasm").expect("failed to read wasm file");
let module = HostRef::new(Module::new(&store, &data).expect("failed to create module")); let module = Module::new(&store, &data).expect("failed to create module");
let instance = HostRef::new( let instance = HostRef::new(
Instance::new(&store, &module, &[]).expect("failed to instantiate module"), Instance::new(&store, &module, &[]).expect("failed to instantiate module"),
); );
@ -128,7 +128,6 @@ mod tests {
println!("calling read_out_of_bounds..."); println!("calling read_out_of_bounds...");
let trap = read_out_of_bounds_func.borrow().call(&[]).unwrap_err(); let trap = read_out_of_bounds_func.borrow().call(&[]).unwrap_err();
assert!(trap assert!(trap
.borrow()
.message() .message()
.starts_with("wasm trap: out of bounds memory access")); .starts_with("wasm trap: out of bounds memory access"));
} }
@ -136,11 +135,11 @@ mod tests {
#[test] #[test]
fn test_custom_signal_handler_multiple_instances() { fn test_custom_signal_handler_multiple_instances() {
let engine = HostRef::new(Engine::new(&Config::default())); let engine = Engine::new(&Config::default());
let store = HostRef::new(Store::new(&engine)); let store = Store::new(&engine);
let data = let data =
std::fs::read("tests/custom_signal_handler.wasm").expect("failed to read wasm file"); std::fs::read("tests/custom_signal_handler.wasm").expect("failed to read wasm file");
let module = HostRef::new(Module::new(&store, &data).expect("failed to create module")); let module = Module::new(&store, &data).expect("failed to create module");
// Set up multiple instances // Set up multiple instances
@ -237,13 +236,13 @@ mod tests {
#[test] #[test]
fn test_custom_signal_handler_instance_calling_another_instance() { fn test_custom_signal_handler_instance_calling_another_instance() {
let engine = HostRef::new(Engine::new(&Config::default())); let engine = Engine::new(&Config::default());
let store = HostRef::new(Store::new(&engine)); let store = Store::new(&engine);
// instance1 which defines 'read' // instance1 which defines 'read'
let data1 = let data1 =
std::fs::read("tests/custom_signal_handler.wasm").expect("failed to read wasm file"); std::fs::read("tests/custom_signal_handler.wasm").expect("failed to read wasm file");
let module1 = HostRef::new(Module::new(&store, &data1).expect("failed to create module")); let module1 = Module::new(&store, &data1).expect("failed to create module");
let instance1: HostRef<Instance> = HostRef::new( let instance1: HostRef<Instance> = HostRef::new(
Instance::new(&store, &module1, &[]).expect("failed to instantiate module"), Instance::new(&store, &module1, &[]).expect("failed to instantiate module"),
); );
@ -262,7 +261,7 @@ mod tests {
// instance2 wich calls 'instance1.read' // instance2 wich calls 'instance1.read'
let data2 = let data2 =
std::fs::read("tests/custom_signal_handler_2.wasm").expect("failed to read wasm file"); std::fs::read("tests/custom_signal_handler_2.wasm").expect("failed to read wasm file");
let module2 = HostRef::new(Module::new(&store, &data2).expect("failed to create module")); let module2 = Module::new(&store, &data2).expect("failed to create module");
let instance2 = HostRef::new( let instance2 = HostRef::new(
Instance::new(&store, &module2, &[instance1_read]) Instance::new(&store, &module2, &[instance1_read])
.expect("failed to instantiate module"), .expect("failed to instantiate module"),

Loading…
Cancel
Save