Generate WASI tests on nightly, see which ones fail in CI

This commit is contained in:
Felix Schütt
2022-10-19 18:43:36 +02:00
parent 798d27a8ca
commit ec92613a06
54 changed files with 199 additions and 2 deletions

View File

@ -20,6 +20,8 @@ fn main() -> anyhow::Result<()> {
.expect("Can't get directory"); .expect("Can't get directory");
build_deps::rerun_if_changed_paths("tests/wasi-wast/wasi/snapshot1/*") build_deps::rerun_if_changed_paths("tests/wasi-wast/wasi/snapshot1/*")
.expect("Can't get directory"); .expect("Can't get directory");
build_deps::rerun_if_changed_paths("tests/wasi-wast/wasi/nightly-2022-10-18/*")
.expect("Can't get directory");
let out_dir = PathBuf::from( let out_dir = PathBuf::from(
env::var_os("OUT_DIR").expect("The OUT_DIR environment variable must be set"), env::var_os("OUT_DIR").expect("The OUT_DIR environment variable must be set"),
@ -66,7 +68,7 @@ fn main() -> anyhow::Result<()> {
}; };
with_test_module(&mut wasitests, "wasitests", |wasitests| { with_test_module(&mut wasitests, "wasitests", |wasitests| {
for wasi_version in &["unstable", "snapshot1"] { for wasi_version in &["unstable", "snapshot1", "nightly_2022_10_18"] {
with_test_module(wasitests, wasi_version, |wasitests| { with_test_module(wasitests, wasi_version, |wasitests| {
for (wasi_filesystem_test_name, wasi_filesystem_kind) in &[ for (wasi_filesystem_test_name, wasi_filesystem_kind) in &[
("host_fs", "WasiFileSystemKind::Host"), ("host_fs", "WasiFileSystemKind::Host"),

View File

@ -33,7 +33,7 @@ impl WasiVersion {
match self { match self {
WasiVersion::Unstable => "unstable", WasiVersion::Unstable => "unstable",
WasiVersion::Snapshot1 => "snapshot1", WasiVersion::Snapshot1 => "snapshot1",
WasiVersion::CurrentNightly => "nightly-2022-10-18", WasiVersion::CurrentNightly => "nightly_2022_10_18",
} }
} }
} }

View File

@ -0,0 +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")
)

Binary file not shown.

View File

@ -0,0 +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")
)

Binary file not shown.

View File

@ -0,0 +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")
)

View File

@ -0,0 +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")
)

Binary file not shown.

View File

@ -0,0 +1,7 @@
;; This file was generated by https://github.com/wasmerio/wasi-tests
(wasi_test "fd_append.wasm"
(temp_dirs ".")
(assert_return (i64.const 101))
(assert_stderr "thread 'main' panicked at 'Couldn't create file: Os { code: 2, kind: NotFound, message: \"No such file or directory\" }', /Users/fs/Development/wasmer/tests/wasi-wast/wasi/tests/fd_append.rs:27:14\nnote: run with `RUST_BACKTRACE=1` environment variable to display a backtrace\n")
)

View File

@ -0,0 +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")
)

View File

@ -0,0 +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")
)

View File

@ -0,0 +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")
)

Binary file not shown.

View File

@ -0,0 +1,6 @@
;; This file was generated by https://github.com/wasmerio/wasi-tests
(wasi_test "fd_rename_path.wasm"
(preopens "test_fs")
(assert_return (i64.const 0))
)

Binary file not shown.

View File

@ -0,0 +1,6 @@
;; This file was generated by https://github.com/wasmerio/wasi-tests
(wasi_test "fd_rights.wasm"
(assert_return (i64.const 101))
(assert_stderr "thread 'main' panicked at 'assertion failed: files.is_empty()', /Users/fs/Development/wasmer/tests/wasi-wast/wasi/tests/fd_rights.rs:6:5\nnote: run with `RUST_BACKTRACE=1` environment variable to display a backtrace\n")
)

Binary file not shown.

View File

@ -0,0 +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")
)

Binary file not shown.

View File

@ -0,0 +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")
)

Binary file not shown.

View File

@ -0,0 +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")
)

Binary file not shown.

View File

@ -0,0 +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")
)

Binary file not shown.

View File

@ -0,0 +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")
)

Binary file not shown.

View File

@ -0,0 +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")
)

Binary file not shown.

View File

@ -0,0 +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")
)

View File

@ -0,0 +1,7 @@
;; This file was generated by https://github.com/wasmerio/wasi-tests
(wasi_test "mapdir_with_leading_slash.wasm"
(map_dirs "/hamlet:test_fs/hamlet")
(assert_return (i64.const 0))
(assert_stdout "File exists? true\nSCENE III. A room in the castle.\n\n Enter KING CLAUDIUS, ROSENCRANTZ, and GUILDENSTERN \n\nKING CLAUDIUS\n\n I like him not, nor stands it safe with us\n To let his madness range. Therefore prepare you;\n I your commission will forthwith dispatch,\n \n")
)

Binary file not shown.

View File

@ -0,0 +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")
)

Binary file not shown.

View File

@ -0,0 +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!\nFound item: path_renamed_file.txt\n柴犬\nThe original file does not still exist!\nFound item: path_renamed_file.txt\n柴犬\nrun_with_sub_dir: The original file does not still exist!\nrun_with_different_sub_dirs: The original file does not still exist!\n")
)

Binary file not shown.

View File

@ -0,0 +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 101))
(assert_stderr "thread 'main' panicked at 'Could not open file: Os { code: 2, kind: NotFound, message: \"No such file or directory\" }', /Users/fs/Development/wasmer/tests/wasi-wast/wasi/tests/path_symlink.rs:21:44\nnote: run with `RUST_BACKTRACE=1` environment variable to display a backtrace\n")
)

Binary file not shown.

View File

@ -0,0 +1,7 @@
;; This file was generated by https://github.com/wasmerio/wasi-tests
(wasi_test "pipe_reverse.wasm"
(assert_return (i64.const 0))
(stdin "Hello, world!")
(assert_stdout "!dlrow ,olleH\n")
)

View File

@ -0,0 +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 101))
(assert_stderr "thread 'main' panicked at 'Could not open file: Os { code: 2, kind: NotFound, message: \"No such file or directory\" }', /Users/fs/Development/wasmer/tests/wasi-wast/wasi/tests/poll_oneoff.rs:155:14\nnote: run with `RUST_BACKTRACE=1` environment variable to display a backtrace\n")
)

Binary file not shown.

File diff suppressed because one or more lines are too long

Binary file not shown.

View File

@ -0,0 +1,8 @@
;; This file was generated by https://github.com/wasmerio/wasi-tests
(wasi_test "readlink.wasm"
(preopens "test_fs")
(assert_return (i64.const 0))
(assert_stdout "true\n../act1/scene2.txt\nSCENE II. A room of state in the castle.\n\n Enter KING CLAUDIUS, QUEEN GERTRUDE, HAMLET, POLONIUS, LAERTES, VOLTIMAND, CORNELI\n")
(assert_stderr "[/Users/fs/Development/wasmer/tests/wasi-wast/wasi/tests/readlink.rs:10] &p = \"test_fs/hamlet/bookmarks/2019-07-16\"\n")
)

View File

@ -0,0 +1,7 @@
;; This file was generated by https://github.com/wasmerio/wasi-tests
(wasi_test "unix_open_special_files.wasm"
(map_dirs "/dev:/dev")
(assert_return (i64.const 0))
(assert_stdout "13\n")
)

View File

@ -0,0 +1,7 @@
;; This file was generated by https://github.com/wasmerio/wasi-tests
(wasi_test "wasi_sees_virtual_root.wasm"
(map_dirs "act1:test_fs/hamlet/act1" "act2:test_fs/hamlet/act2" "act1-again:test_fs/hamlet/act1")
(assert_return (i64.const 0))
(assert_stdout "\"/act1\"\n\"/act1-again\"\n\"/act2\"\n\"/act1\"\n\"/act1-again\"\n\"/act2\"\n\"/act1\"\n\"/act1-again\"\n\"/act2\"\n\"/act1\"\n\"/act1-again\"\n\"/act2\"\nROOT IS SAFE\n")
)

Binary file not shown.

View File

@ -0,0 +1,7 @@
;; This file was generated by https://github.com/wasmerio/wasi-tests
(wasi_test "writing.wasm"
(map_dirs "act1:test_fs/hamlet/act1" "act2:test_fs/hamlet/act2" "act1-again:test_fs/hamlet/act1")
(assert_return (i64.const 0))
(assert_stdout "abcdefghijklmnopqrstuvwxyz\nfile is gone\n")
)