Skip to content

Commit

Permalink
Added WASI test generator command. Added new dir path rename wasi tes…
Browse files Browse the repository at this point in the history
…tcase
  • Loading branch information
syrusakbary committed Sep 6, 2021
1 parent 76e00c5 commit 66e71fc
Show file tree
Hide file tree
Showing 9 changed files with 71 additions and 5 deletions.
46 changes: 44 additions & 2 deletions Cargo.lock

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

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ wasmer-engine-dylib = { version = "2.0.0", path = "lib/engine-dylib", optional =
wasmer-engine-staticlib = { version = "2.0.0", path = "lib/engine-staticlib", optional = true }
wasmer-wasi = { version = "2.0.0", path = "lib/wasi", optional = true }
wasmer-wast = { version = "2.0.0", path = "tests/lib/wast", optional = true }
wasi-test-generator = { version = "2.0.0", path = "tests/wasi-wast", optional = true }
wasmer-cache = { version = "2.0.0", path = "lib/cache", optional = true }
wasmer-types = { version = "2.0.0", path = "lib/types" }
wasmer-middlewares = { version = "2.0.0", path = "lib/middlewares", optional = true }
Expand Down Expand Up @@ -50,6 +51,7 @@ members = [
"lib/wasi-types",
"lib/wasi-experimental-io-devices",
"lib/types",
"tests/wasi-wast",
"tests/lib/wast",
"tests/lib/compiler-test-derive",
"tests/integration/cli",
Expand Down
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -573,6 +573,10 @@ test-integration:
test-integration-ios:
cargo test -p wasmer-integration-tests-ios

generate-wasi-tests:
# Uncomment the following for installing the toolchain
# cargo run -p wasi-test-generator -- -s
cargo run -p wasi-test-generator -- -g
#####
#
# Packaging.
Expand Down
2 changes: 1 addition & 1 deletion tests/wasi-wast/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "wasi-test-generator"
version = "0.17.0"
version = "2.0.0"
description = "Tests for our WASI implementation"
license = "MIT"
authors = ["Wasmer Engineering Team <[email protected]>"]
Expand Down
2 changes: 1 addition & 1 deletion tests/wasi-wast/src/wasi_version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ impl WasiVersion {
pub fn get_compiler_toolchain(&self) -> &'static str {
match self {
WasiVersion::Unstable => "nightly-2019-09-13",
WasiVersion::Snapshot1 => "nightly-2019-12-18",
WasiVersion::Snapshot1 => "1.53.0",
}
}

Expand Down
2 changes: 1 addition & 1 deletion tests/wasi-wast/src/wasitests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ fn compile_wasm_for_version(
.create(true)
.open(&temp_wasi_rs_file_name)
.unwrap();
actual_file.write_all(b"#![feature(wasi_ext)]\n").unwrap();
// actual_file.write_all(b"#![feature(wasi_ext)]\n").unwrap();
actual_file.write_all(file_contents.as_bytes()).unwrap();
}

Expand Down
Binary file not shown.
7 changes: 7 additions & 0 deletions tests/wasi-wast/wasi/snapshot1/fd_rename_path.wast
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
;; This file was generated by https://github.com/wasmerio/wasi-tests

(wasi_test "fd_rename_path.wasm"
(preopens "test_fs")
(assert_return (i64.const 101))
(assert_stderr "thread 'main' panicked at 'assertion failed: fs::rename(old_path, new_path).is_ok()', /Users/syrus/Development/wasmer/tests/wasi-wast/wasi/tests/fd_rename_path.rs:10:3\nnote: run with `RUST_BACKTRACE=1` environment variable to display a backtrace\n")
)
11 changes: 11 additions & 0 deletions tests/wasi-wast/wasi/tests/fd_rename_path.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// WASI:
// dir: test_fs

use std::fs;

fn main() {
let old_path = "test_fs/oldname";
let new_path = "test_fs/newname";

assert!(fs::rename(old_path, new_path).is_ok());
}

0 comments on commit 66e71fc

Please sign in to comment.