-
Notifications
You must be signed in to change notification settings - Fork 824
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
451: implement map-dir for WASI; fix bug in path_open r=MarkMcCaskey a=MarkMcCaskey Colon separated mapping, implemented to be compatible with wasmtime resolves #458 example: ```Rust use std::fs; fn main() { let read_dir = fs::read_dir(".").unwrap(); for entry in read_dir { println!("{:?}", entry.unwrap().path()); } } ``` ```shell $ cargo run --release --bin wasmer -- run --mapdir=.:src list-files.wasm "./bin" "./installer" "./lib" "./update" "./utils" "./webassembly" ``` Co-authored-by: Mark McCaskey <[email protected]> Co-authored-by: Mark McCaskey <[email protected]>
- Loading branch information
Showing
37 changed files
with
8,061 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#[test] | ||
fn test_mapdir() { | ||
assert_wasi_output!( | ||
"../../wasitests/mapdir.wasm", | ||
"mapdir", | ||
vec![], | ||
"../../wasitests/mapdir.out" | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,4 +8,5 @@ mod _common; | |
mod create_dir; | ||
mod file_metadata; | ||
mod hello; | ||
mod mapdir; | ||
mod quine; |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
"wasitests/test_fs/hamlet/README.md" | ||
"wasitests/test_fs/hamlet/act1" | ||
"wasitests/test_fs/hamlet/act2" | ||
"wasitests/test_fs/hamlet/act3" | ||
"wasitests/test_fs/hamlet/act4" | ||
"wasitests/test_fs/hamlet/act5" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Args: | ||
// mapdir: .:wasitests/test_fs/hamlet | ||
|
||
use std::fs; | ||
|
||
fn main() { | ||
#[cfg(not(target = "wasi"))] | ||
let read_dir = fs::read_dir("wasitests/test_fs/hamlet").unwrap(); | ||
#[cfg(target = "wasi")] | ||
let read_dir = fs::read_dir(".").unwrap(); | ||
let mut out = vec![]; | ||
for entry in read_dir { | ||
out.push(format!("{:?}", entry.unwrap().path())); | ||
} | ||
out.sort(); | ||
|
||
for p in out { | ||
println!("{}", p); | ||
} | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Test FS | ||
|
||
This is a test "file system" used in some of the WASI integration tests. | ||
|
||
It's just a bunch of files in a tree. | ||
|
||
If you make changes here, please regenerate the tests with `make wasitests`! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Hamlet split in to acts and scenes | ||
|
||
From: http://shakespeare.mit.edu/hamlet/full.html |
Oops, something went wrong.