Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed wasi dir path rename #2557

Merged
merged 2 commits into from
Sep 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,9 @@ test-capi-integration-%:
test-wasi-unit:
cargo test --manifest-path lib/wasi/Cargo.toml --release

test-wasi:
cargo test --release --tests $(compiler_features) -- wasi::wasitests::snapshot1

test-examples:
cargo test --release $(compiler_features) --features wasi --examples

Expand All @@ -573,6 +576,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());
}