Skip to content

Commit

Permalink
continue
Browse files Browse the repository at this point in the history
  • Loading branch information
Hywan committed Aug 31, 2021
1 parent 971915a commit a1ecfe0
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions tests/lib/wast/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ edition = "2018"
anyhow = "1.0"
wasmer = { path = "../../../lib/api", version = "2.0.0", default-features = false, features = ["experimental-reference-types-extern-ref"] }
wasmer-wasi = { path = "../../../lib/wasi", version = "2.0.0" }
wasmer-vfs = { path = "../../../lib/vfs", version = "2.0.0" }
wast = "37.0"
serde = "1"
tempfile = "3"
Expand Down
12 changes: 10 additions & 2 deletions tests/lib/wast/src/wasi_wast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ impl<'a> WasiTest<'a> {
out
};
let module = Module::new(&store, &wasm_bytes)?;
let (env, _tempdirs) = self.create_wasi_env()?;
let (env, _tempdirs) = self.create_wasi_env(filesystem_kind)?;
let imports = self.get_imports(store, &module, env.clone())?;
let instance = Instance::new(&module, &imports)?;

Expand Down Expand Up @@ -141,7 +141,10 @@ impl<'a> WasiTest<'a> {
}

/// Create the wasi env with the given metadata.
fn create_wasi_env(&self) -> anyhow::Result<(WasiEnv, Vec<tempfile::TempDir>)> {
fn create_wasi_env(
&self,
filesystem_kind: WasiFileSystemKind,
) -> anyhow::Result<(WasiEnv, Vec<tempfile::TempDir>)> {
let mut builder = WasiState::new(self.wasm_path);

let stdin_pipe = Pipe::new();
Expand Down Expand Up @@ -169,6 +172,11 @@ impl<'a> WasiTest<'a> {
temp_dirs.push(td);
}

builder.set_fs(match filesystem_kind {
WasiFileSystemKind::Host => Box::new(wasmer_vfs::host_fs::FileSystem::default()),
WasiFileSystemKind::InMemory => Box::new(wasmer_vfs::mem_fs::FileSystem::default()),
});

let out = builder
.args(&self.args)
// adding this causes some tests to fail. TODO: investigate this
Expand Down

0 comments on commit a1ecfe0

Please sign in to comment.