wasm: move linking tests to test_gen and execute the module

This commit is contained in:
Brian Carroll 2022-06-14 22:09:16 +01:00
parent 115c2b524e
commit c1aa9f229a
No known key found for this signature in database
GPG key ID: 9CF4E3BF9C4722C7
5 changed files with 51 additions and 11 deletions

View file

@ -50,7 +50,7 @@ pub fn compile_and_load<'a, T: Wasm32Result>(
save_wasm_file(&compiled_bytes, build_dir_hash)
};
load_bytes_into_runtime(compiled_bytes)
load_bytes_into_runtime(&compiled_bytes)
}
fn get_preprocessed_host_path() -> PathBuf {
@ -173,12 +173,12 @@ fn save_wasm_file(app_module_bytes: &[u8], build_dir_hash: u64) {
);
}
fn load_bytes_into_runtime(bytes: Vec<u8>) -> wasmer::Instance {
fn load_bytes_into_runtime(bytes: &[u8]) -> wasmer::Instance {
use wasmer::{Module, Store};
use wasmer_wasi::WasiState;
let store = Store::default();
let wasmer_module = Module::new(&store, &bytes).unwrap();
let wasmer_module = Module::new(&store, bytes).unwrap();
// First, we create the `WasiEnv`
let mut wasi_env = WasiState::new("hello").finalize().unwrap();