Skip to content

Commit

Permalink
Merge pull request #1586 from wasmerio/feature/clean-up-generated-was…
Browse files Browse the repository at this point in the history
…i-wast

Clean up generated wasi wast
  • Loading branch information
MarkMcCaskey authored Aug 31, 2020
2 parents 686ea59 + def6be8 commit 92e028f
Show file tree
Hide file tree
Showing 49 changed files with 150 additions and 50 deletions.
8 changes: 6 additions & 2 deletions tests/wasi-wast/src/wasitests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,11 @@ pub struct WasiTest {

impl WasiTest {
fn into_wasi_wast(&self) -> String {
let mut out = format!("(wasi_test \"{}\"", self.wasm_prog_name);
let mut out = format!(
";; This file was generated by https://github.com/wasmerio/wasi-tests\n
(wasi_test \"{}\"",
self.wasm_prog_name
);
if !self.options.env.is_empty() {
let envs = self
.options
Expand Down Expand Up @@ -312,7 +316,7 @@ impl WasiTest {
out += &format!("\n (assert_stderr {:?})", self.stderr);
}

out += "\n)";
out += "\n)\n";

out
}
Expand Down
4 changes: 3 additions & 1 deletion tests/wasi-wast/wasi/snapshot1/close_preopen_fd.wast
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
;; This file was generated by https://github.com/wasmerio/wasi-tests

(wasi_test "close_preopen_fd.wasm"
(map_dirs "hamlet:test_fs/hamlet")
(assert_return (i64.const 0))
(assert_stdout "accessing preopen fd was a success\nClosing preopen fd was a success\naccessing closed preopen fd was an EBADF error: true\n")
)
)
4 changes: 3 additions & 1 deletion tests/wasi-wast/wasi/snapshot1/create_dir.wast
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
;; This file was generated by https://github.com/wasmerio/wasi-tests

(wasi_test "create_dir.wasm"
(preopens "test_fs")
(assert_return (i64.const 0))
(assert_stdout "Test file exists: false\nDir exists: false\nDir exists: false\nDir exists: false\nSuccess\n")
)
)
4 changes: 3 additions & 1 deletion tests/wasi-wast/wasi/snapshot1/envvar.wast
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
;; This file was generated by https://github.com/wasmerio/wasi-tests

(wasi_test "envvar.wasm"
(envs "DOG=1" "CAT=2")
(assert_return (i64.const 0))
(assert_stdout "Env vars:\nCAT=2\nDOG=1\nDOG Ok(\"1\")\nDOG_TYPE Err(NotPresent)\nSET VAR Ok(\"HELLO\")\n")
)
)
4 changes: 3 additions & 1 deletion tests/wasi-wast/wasi/snapshot1/fd_allocate.wast
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
;; This file was generated by https://github.com/wasmerio/wasi-tests

(wasi_test "fd_allocate.wasm"
(temp_dirs ".")
(assert_return (i64.const 0))
(assert_stdout "171\n1405\n")
)
)
4 changes: 3 additions & 1 deletion tests/wasi-wast/wasi/snapshot1/fd_append.wast
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
;; This file was generated by https://github.com/wasmerio/wasi-tests

(wasi_test "fd_append.wasm"
(temp_dirs ".")
(assert_return (i64.const 0))
(assert_stdout "\"Hello, world!\\nGoodbye, world!\\n\"\n")
)
)
4 changes: 3 additions & 1 deletion tests/wasi-wast/wasi/snapshot1/fd_close.wast
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
;; This file was generated by https://github.com/wasmerio/wasi-tests

(wasi_test "fd_close.wasm"
(map_dirs ".:test_fs/hamlet")
(assert_return (i64.const 0))
(assert_stdout "Successfully closed file!\nSuccessfully closed stderr!\nSuccessfully closed stdin!\n")
)
)
4 changes: 3 additions & 1 deletion tests/wasi-wast/wasi/snapshot1/fd_pread.wast
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
;; This file was generated by https://github.com/wasmerio/wasi-tests

(wasi_test "fd_pread.wasm"
(preopens "test_fs")
(assert_return (i64.const 0))
(assert_stdout " POLONIUS\n\n He will come straight. Look you lay home to him:\n\n POLONIUS\n\n He will come straight. Look you lay home to him:\n\nRead the same data? true\n")
)
)
4 changes: 3 additions & 1 deletion tests/wasi-wast/wasi/snapshot1/fd_read.wast
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
;; This file was generated by https://github.com/wasmerio/wasi-tests

(wasi_test "fd_read.wasm"
(map_dirs ".:test_fs/hamlet")
(assert_return (i64.const 0))
(assert_stdout "SCENE IV. The Queen\'s closet.\n\n Enter QUEEN GERTRUDE and POLO\n")
)
)
4 changes: 3 additions & 1 deletion tests/wasi-wast/wasi/snapshot1/fd_sync.wast
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
;; This file was generated by https://github.com/wasmerio/wasi-tests

(wasi_test "fd_sync.wasm"
(temp_dirs ".")
(assert_return (i64.const 0))
(assert_stdout "170\n1404\n")
)
)
4 changes: 3 additions & 1 deletion tests/wasi-wast/wasi/snapshot1/file_metadata.wast
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
;; This file was generated by https://github.com/wasmerio/wasi-tests

(wasi_test "file_metadata.wasm"
(preopens "test_fs")
(assert_return (i64.const 0))
(assert_stdout "is dir: false\nfiletype: false true false\nfile info: 8866\n")
)
)
4 changes: 3 additions & 1 deletion tests/wasi-wast/wasi/snapshot1/fs_sandbox_test.wast
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
;; This file was generated by https://github.com/wasmerio/wasi-tests

(wasi_test "fs_sandbox_test.wasm"
(assert_return (i64.const 0))
(assert_stdout "Reading the parent directory was okay? false\n")
)
)
4 changes: 3 additions & 1 deletion tests/wasi-wast/wasi/snapshot1/fseek.wast
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
;; This file was generated by https://github.com/wasmerio/wasi-tests

(wasi_test "fseek.wasm"
(map_dirs ".:test_fs/hamlet")
(assert_return (i64.const 0))
(assert_stdout "SCENE III. A room in Polonius\' h\nouse.\n\n Enter LAERTES and OPH\n And, sister, as the winds gi\nr talk with the Lord Hamlet.\n \nuits,\n Breathing like sanctif\nis is for all:\n I would not, \n")
)
)
4 changes: 3 additions & 1 deletion tests/wasi-wast/wasi/snapshot1/hello.wast
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
;; This file was generated by https://github.com/wasmerio/wasi-tests

(wasi_test "hello.wasm"
(assert_return (i64.const 0))
(assert_stdout "Hello, world!\n")
)
)
4 changes: 3 additions & 1 deletion tests/wasi-wast/wasi/snapshot1/isatty.wast
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
;; This file was generated by https://github.com/wasmerio/wasi-tests

(wasi_test "isatty.wasm"
(assert_return (i64.const 0))
(assert_stdout "stdin: 1\nstdout: 1\nstderr: 1\n")
)
)
4 changes: 3 additions & 1 deletion tests/wasi-wast/wasi/snapshot1/mapdir.wast
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
;; This file was generated by https://github.com/wasmerio/wasi-tests

(wasi_test "mapdir.wasm"
(map_dirs ".:test_fs/hamlet")
(assert_return (i64.const 0))
(assert_stdout "\"./README.md\"\n\"./act1\"\n\"./act2\"\n\"./act3\"\n\"./act4\"\n\"./act5\"\n\"./bookmarks\"\n")
)
)
4 changes: 3 additions & 1 deletion tests/wasi-wast/wasi/snapshot1/path_link.wast
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
;; This file was generated by https://github.com/wasmerio/wasi-tests

(wasi_test "path_link.wasm"
(map_dirs "act5:test_fs/hamlet/act5")
(temp_dirs "temp")
(assert_return (i64.const 0))
(assert_stdout "ACT V\nSCENE I. A churchyard.\n\n Enter two Clowns, with spades,\nACT V\nSCENE I. A churchyard.\n\n Enter two Clowns, with spades,\nPath still exists\n")
)
)
4 changes: 3 additions & 1 deletion tests/wasi-wast/wasi/snapshot1/path_rename.wast
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
;; This file was generated by https://github.com/wasmerio/wasi-tests

(wasi_test "path_rename.wasm"
(temp_dirs "temp")
(assert_return (i64.const 0))
(assert_stdout "The original file does not still exist!\n柴犬\n")
)
)
4 changes: 3 additions & 1 deletion tests/wasi-wast/wasi/snapshot1/path_symlink.wast
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
;; This file was generated by https://github.com/wasmerio/wasi-tests

(wasi_test "path_symlink.wasm"
(map_dirs "hamlet:test_fs/hamlet")
(temp_dirs "temp")
(assert_return (i64.const 0))
(assert_stdout "ACT III\nSCENE I. A room in the castle.\n\n Enter KING CLAUDIUS,\n")
)
)
4 changes: 3 additions & 1 deletion tests/wasi-wast/wasi/snapshot1/poll_oneoff.wast
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
;; This file was generated by https://github.com/wasmerio/wasi-tests

(wasi_test "poll_oneoff.wasm"
(map_dirs "hamlet:test_fs/hamlet")
(temp_dirs "temp")
(assert_return (i64.const 0))
(assert_stdout "__wasi_event_t { userdata: 1193046, error: 0, type_: 1, u: __wasi_event_u { __wasi_event_fd_readwrite_t { nbytes: 2259, flags: 0 } } }\n[__wasi_event_t { userdata: 1193046, error: 0, type_: 1, u: __wasi_event_u { __wasi_event_fd_readwrite_t { nbytes: 2259, flags: 0 } } }, __wasi_event_t { userdata: 1193046, error: 0, type_: 2, u: __wasi_event_u { __wasi_event_fd_readwrite_t { nbytes: 1234, flags: 0 } } }]\nStdin: OK\nStdout: OK\nStderr: OK\n")
)
)
Loading

0 comments on commit 92e028f

Please sign in to comment.