Move integration tests to tests dir in workspace root

This commit is contained in:
Mark McCaskey
2020-04-01 17:09:51 -07:00
parent ecafa7564d
commit 976bf9b6a3
222 changed files with 764 additions and 985 deletions

68
Cargo.lock generated
View File

@ -30,14 +30,6 @@ version = "1.0.26"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7825f6833612eb2414095684fcf6c635becf3ce97fe48cf6421321e93bfbd53c"
[[package]]
name = "api-tests"
version = "0.16.2"
dependencies = [
"wabt",
"wasmer",
]
[[package]]
name = "arrayref"
version = "0.3.6"
@ -761,6 +753,14 @@ version = "0.3.55"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f5f3913fa0bfe7ee1fd8248b6b9f42a5af4b9d65ec2dd2c3c26132b950ecfc2"
[[package]]
name = "generate-wasi-tests"
version = "0.16.2"
dependencies = [
"glob 0.3.0",
"tempfile",
]
[[package]]
name = "generational-arena"
version = "0.2.7"
@ -2739,8 +2739,10 @@ version = "0.16.2"
dependencies = [
"atty",
"byteorder",
"criterion",
"errno",
"fern",
"generate-wasi-tests",
"glob 0.3.0",
"log",
"rustc_version",
@ -2756,13 +2758,11 @@ dependencies = [
"wasmer-kernel-loader",
"wasmer-llvm-backend",
"wasmer-middleware-common",
"wasmer-middleware-common-tests",
"wasmer-runtime",
"wasmer-runtime-core",
"wasmer-singlepass-backend",
"wasmer-wasi",
"wasmer-wasi-experimental-io-devices",
"wasmer-wasi-tests",
]
[[package]]
@ -2887,16 +2887,6 @@ dependencies = [
"winapi 0.3.8",
]
[[package]]
name = "wasmer-llvm-backend-tests"
version = "0.10.2"
dependencies = [
"wabt",
"wasmer-llvm-backend",
"wasmer-runtime",
"wasmer-runtime-core",
]
[[package]]
name = "wasmer-middleware-common"
version = "0.16.2"
@ -2904,19 +2894,6 @@ dependencies = [
"wasmer-runtime-core",
]
[[package]]
name = "wasmer-middleware-common-tests"
version = "0.16.2"
dependencies = [
"criterion",
"wabt",
"wasmer-clif-backend",
"wasmer-llvm-backend",
"wasmer-middleware-common",
"wasmer-runtime-core",
"wasmer-singlepass-backend",
]
[[package]]
name = "wasmer-runtime"
version = "0.16.2"
@ -2974,17 +2951,6 @@ dependencies = [
"winapi 0.3.8",
]
[[package]]
name = "wasmer-runtime-core-tests"
version = "0.16.2"
dependencies = [
"wabt",
"wasmer-clif-backend",
"wasmer-llvm-backend",
"wasmer-runtime-core",
"wasmer-singlepass-backend",
]
[[package]]
name = "wasmer-singlepass-backend"
version = "0.16.2"
@ -3044,20 +3010,6 @@ dependencies = [
"wasmer-wasi",
]
[[package]]
name = "wasmer-wasi-tests"
version = "0.16.2"
dependencies = [
"glob 0.3.0",
"tempfile",
"wasmer-clif-backend",
"wasmer-dev-utils",
"wasmer-llvm-backend",
"wasmer-runtime",
"wasmer-singlepass-backend",
"wasmer-wasi",
]
[[package]]
name = "wasmer-win-exception-handler"
version = "0.16.2"

View File

@ -38,49 +38,48 @@ wasmer-llvm-backend = { path = "lib/llvm-backend", optional = true }
wasmer-wasi = { path = "lib/wasi", optional = true }
wasmer-kernel-loader = { path = "lib/kernel-loader", optional = true }
wasmer-dev-utils = { path = "lib/dev-utils", optional = true }
wasmer-wasi-tests = { path = "lib/wasi-tests", optional = true }
wasmer-middleware-common-tests = { path = "lib/middleware-common-tests", optional = true }
wasmer-emscripten-tests = { path = "lib/emscripten-tests", optional = true }
wasmer-wasi-experimental-io-devices = { path = "lib/wasi-experimental-io-devices", optional = true }
[workspace]
members = [
"lib/api",
"lib/api-tests",
"lib/clif-backend",
"lib/singlepass-backend",
"lib/runtime",
"lib/runtime-core",
"lib/runtime-core-tests",
"lib/emscripten",
"lib/spectests",
"lib/win-exception-handler",
"lib/runtime-c-api",
"lib/llvm-backend",
"lib/llvm-backend-tests",
"lib/wasi",
"lib/middleware-common",
"lib/kernel-loader",
"lib/kernel-net",
"lib/dev-utils",
"lib/wasi-experimental-io-devices",
"lib/wasi-tests",
"lib/emscripten-tests",
"lib/middleware-common-tests",
"lib/interface-types",
"examples/parallel",
"examples/plugin-for-example",
"examples/parallel-guest",
"tests/generate-wasi-tests",
]
[build-dependencies]
wabt = "0.9.1"
generate-wasi-tests = { path = "tests/generate-wasi-tests" }
glob = "0.3"
rustc_version = "0.2"
[dev-dependencies]
criterion = "0.3"
glob = "0.3"
serde = { version = "1", features = ["derive"] } # used by the plugin example
typetag = "0.1" # used by the plugin example
wabt = "0.9.1"
wasmer-dev-utils = { path = "lib/dev-utils" }
[features]
default = ["fast-tests", "wasi", "backend-cranelift", "wabt"]
@ -95,18 +94,15 @@ backend-cranelift = [
"wasmer-clif-backend/generate-debug-information",
"wasmer-runtime-core/generate-debug-information",
"wasmer-runtime/cranelift",
"wasmer-middleware-common-tests/clif",
]
backend-llvm = [
"wasmer-llvm-backend",
"wasmer-runtime/llvm",
"wasmer-middleware-common-tests/llvm",
"wasmer-runtime-core/generate-debug-information-no-export-symbols"
]
backend-singlepass = [
"wasmer-singlepass-backend",
"wasmer-runtime/singlepass",
"wasmer-middleware-common-tests/singlepass",
]
wasi = ["wasmer-wasi"]
experimental-io-devices = ["wasmer-wasi-experimental-io-devices"]

View File

@ -133,7 +133,7 @@ static WAT_GAS: &'static str = r#"
(elem (i32.const 0) $f2))
"#;
#[cfg(feature = "llvm")]
#[cfg(feature = "backend-llvm")]
fn get_compiler(limit: u64, metering: bool) -> impl Compiler {
use wasmer_llvm_backend::ModuleCodeGenerator;
use wasmer_runtime_core::codegen::{MiddlewareChain, StreamingCompiler};
@ -148,7 +148,7 @@ fn get_compiler(limit: u64, metering: bool) -> impl Compiler {
c
}
#[cfg(feature = "singlepass")]
#[cfg(feature = "backend-singlepass")]
fn get_compiler(limit: u64, metering: bool) -> impl Compiler {
use wasmer_runtime_core::codegen::{MiddlewareChain, StreamingCompiler};
use wasmer_singlepass_backend::ModuleCodeGenerator as SinglePassMCG;
@ -162,10 +162,14 @@ fn get_compiler(limit: u64, metering: bool) -> impl Compiler {
c
}
#[cfg(not(any(feature = "llvm", feature = "clif", feature = "singlepass")))]
#[cfg(not(any(
feature = "backend-llvm",
feature = "backend-cranelift",
feature = "backend-singlepass"
)))]
compile_error!("compiler not specified, activate a compiler via features");
#[cfg(feature = "clif")]
#[cfg(feature = "backend-cranelift")]
fn get_compiler(_limit: u64, metering: bool) -> impl Compiler {
compile_error!("cranelift does not implement metering");
use wasmer_clif_backend::CraneliftCompiler;

9
build.rs Normal file
View File

@ -0,0 +1,9 @@
//! A kind of meta-build.rs that can be configured to do different things.
//!
//! Please try to keep this file as clean as possible.
use generate_wasi_tests;
fn main() {
generate_wasi_tests::build();
}

View File

@ -1,15 +0,0 @@
[package]
name = "api-tests"
version = "0.16.2"
authors = ["The Wasmer Engineering Team <engineering@wasmer.io>"]
edition = "2018"
license = "MIT"
publish = false
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
wasmer = { version = "0.16.2", path = "../api" }
[dev-dependencies]
wabt = "0.9.1"

View File

@ -1 +0,0 @@

View File

@ -1,16 +0,0 @@
[package]
name = "wasmer-llvm-backend-tests"
version = "0.10.2"
authors = ["Nick Lewycky <nick@wasmer.io>"]
license = "MIT"
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
wabt = "0.9.1"
wasmer-runtime-core = { path = "../runtime-core", version = "0.16.2" }
wasmer-runtime = { path = "../runtime", version = "0.16.2" }
wasmer-llvm-backend = { path = "../llvm-backend", version = "0.16.2", features = ["test"] }
[features]

View File

@ -1,17 +0,0 @@
#![deny(
dead_code,
nonstandard_style,
unused_imports,
unused_mut,
unused_variables,
unused_unsafe,
unreachable_patterns
)]
pub use wabt::wat2wasm;
use wasmer_llvm_backend::LLVMCompiler;
use wasmer_runtime_core::backend::Compiler;
pub fn get_compiler() -> impl Compiler {
LLVMCompiler::new()
}

View File

@ -1,28 +0,0 @@
[package]
name = "wasmer-middleware-common-tests"
version = "0.16.2"
authors = ["The Wasmer Engineering Team <engineering@wasmer.io>"]
edition = "2018"
repository = "https://github.com/wasmerio/wasmer"
license = "MIT"
publish = false
[dependencies]
wasmer-runtime-core = { path = "../runtime-core", version = "0.16.2" }
wasmer-middleware-common = { path = "../middleware-common", version = "0.16.2" }
wasmer-clif-backend = { path = "../clif-backend", version = "0.16.2", optional = true }
wasmer-llvm-backend = { path = "../llvm-backend", version = "0.16.2", features = ["test"], optional = true }
wasmer-singlepass-backend = { path = "../singlepass-backend", version = "0.16.2", optional = true }
[features]
clif = ["wasmer-clif-backend"]
llvm = ["wasmer-llvm-backend"]
singlepass = ["wasmer-singlepass-backend"]
[dev-dependencies]
wabt = "0.9.1"
criterion = "0.3"
[[bench]]
name = "metering_benchmark"
harness = false

View File

@ -1,21 +0,0 @@
[package]
name = "wasmer-runtime-core-tests"
version = "0.16.2"
description = "Tests for the Wasmer runtime core crate"
license = "MIT"
authors = ["The Wasmer Engineering Team <engineering@wasmer.io>"]
edition = "2018"
publish = false
[dependencies]
wabt = "0.9.1"
wasmer-runtime-core = { path = "../runtime-core", version = "0.16.2" }
wasmer-clif-backend = { path = "../clif-backend", version = "0.16.2", optional = true }
wasmer-singlepass-backend = { path = "../singlepass-backend", version = "0.16.2", optional = true }
wasmer-llvm-backend = { path = "../llvm-backend", version = "0.16.2", features = ["test"], optional = true }
[features]
default = ["backend-cranelift"]
backend-cranelift = ["wasmer-clif-backend"]
backend-singlepass = ["wasmer-singlepass-backend"]
backend-llvm = ["wasmer-llvm-backend"]

View File

@ -1,30 +0,0 @@
[package]
name = "wasmer-wasi-tests"
version = "0.16.2"
description = "Tests for our WASI implementation"
license = "MIT"
authors = ["The Wasmer Engineering Team <engineering@wasmer.io>"]
edition = "2018"
publish = false
build = "build/mod.rs"
[dependencies]
# We set default features to false to be able to use the singlepass backend properly
wasmer-runtime = { path = "../runtime", version = "0.16.2", default-features = false }
wasmer-wasi = { path = "../wasi", version = "0.16.2" }
# hack to get tests to work
wasmer-clif-backend = { path = "../clif-backend", version = "0.16.2", optional = true}
wasmer-singlepass-backend = { path = "../singlepass-backend", version = "0.16.2", optional = true }
wasmer-llvm-backend = { path = "../llvm-backend", version = "0.16.2", features = ["test"], optional = true }
[build-dependencies]
glob = "0.3"
tempfile = "3"
[dev-dependencies]
wasmer-dev-utils = { path = "../dev-utils", version = "0.16.2"}
[features]
clif = ["wasmer-clif-backend", "wasmer-runtime/default-backend-cranelift"]
singlepass = ["wasmer-singlepass-backend", "wasmer-runtime/default-backend-singlepass"]
llvm = ["wasmer-llvm-backend", "wasmer-runtime/default-backend-llvm"]

View File

@ -1,19 +0,0 @@
// !!! THIS IS A GENERATED FILE !!!
// ANY MANUAL EDITS MAY BE OVERWRITTEN AT ANY TIME
// Files autogenerated with cargo build (build/wasitests.rs).
#[test]
#[ignore]
fn test_snapshot1_close_preopen_fd() {
assert_wasi_output!(
"../../wasitests/snapshot1/close_preopen_fd.wasm",
"snapshot1_close_preopen_fd",
vec![],
vec![(
"hamlet".to_string(),
::std::path::PathBuf::from("wasitests/test_fs/hamlet")
),],
vec![],
"../../wasitests/close_preopen_fd.out"
);
}

View File

@ -1,19 +0,0 @@
// !!! THIS IS A GENERATED FILE !!!
// ANY MANUAL EDITS MAY BE OVERWRITTEN AT ANY TIME
// Files autogenerated with cargo build (build/wasitests.rs).
#[test]
#[ignore]
fn test_snapshot1_fd_allocate() {
assert_wasi_output!(
"../../wasitests/snapshot1/fd_allocate.wasm",
"snapshot1_fd_allocate",
vec![],
vec![(
".".to_string(),
::std::path::PathBuf::from("wasitests/test_fs/temp")
),],
vec![],
"../../wasitests/fd_allocate.out"
);
}

View File

@ -1,18 +0,0 @@
// !!! THIS IS A GENERATED FILE !!!
// ANY MANUAL EDITS MAY BE OVERWRITTEN AT ANY TIME
// Files autogenerated with cargo build (build/wasitests.rs).
#[test]
fn test_snapshot1_fd_append() {
assert_wasi_output!(
"../../wasitests/snapshot1/fd_append.wasm",
"snapshot1_fd_append",
vec![],
vec![(
".".to_string(),
::std::path::PathBuf::from("wasitests/test_fs/temp")
),],
vec![],
"../../wasitests/fd_append.out"
);
}

View File

@ -1,19 +0,0 @@
// !!! THIS IS A GENERATED FILE !!!
// ANY MANUAL EDITS MAY BE OVERWRITTEN AT ANY TIME
// Files autogenerated with cargo build (build/wasitests.rs).
#[test]
#[ignore]
fn test_snapshot1_fd_close() {
assert_wasi_output!(
"../../wasitests/snapshot1/fd_close.wasm",
"snapshot1_fd_close",
vec![],
vec![(
".".to_string(),
::std::path::PathBuf::from("wasitests/test_fs/hamlet")
),],
vec![],
"../../wasitests/fd_close.out"
);
}

View File

@ -1,19 +0,0 @@
// !!! THIS IS A GENERATED FILE !!!
// ANY MANUAL EDITS MAY BE OVERWRITTEN AT ANY TIME
// Files autogenerated with cargo build (build/wasitests.rs).
#[test]
#[ignore]
fn test_snapshot1_fd_pread() {
assert_wasi_output!(
"../../wasitests/snapshot1/fd_pread.wasm",
"snapshot1_fd_pread",
vec![],
vec![(
".".to_string(),
::std::path::PathBuf::from("wasitests/test_fs/hamlet")
),],
vec![],
"../../wasitests/fd_pread.out"
);
}

View File

@ -1,19 +0,0 @@
// !!! THIS IS A GENERATED FILE !!!
// ANY MANUAL EDITS MAY BE OVERWRITTEN AT ANY TIME
// Files autogenerated with cargo build (build/wasitests.rs).
#[test]
#[ignore]
fn test_snapshot1_fd_read() {
assert_wasi_output!(
"../../wasitests/snapshot1/fd_read.wasm",
"snapshot1_fd_read",
vec![],
vec![(
".".to_string(),
::std::path::PathBuf::from("wasitests/test_fs/hamlet")
),],
vec![],
"../../wasitests/fd_read.out"
);
}

View File

@ -1,18 +0,0 @@
// !!! THIS IS A GENERATED FILE !!!
// ANY MANUAL EDITS MAY BE OVERWRITTEN AT ANY TIME
// Files autogenerated with cargo build (build/wasitests.rs).
#[test]
fn test_snapshot1_fd_sync() {
assert_wasi_output!(
"../../wasitests/snapshot1/fd_sync.wasm",
"snapshot1_fd_sync",
vec![],
vec![(
".".to_string(),
::std::path::PathBuf::from("wasitests/test_fs/temp")
),],
vec![],
"../../wasitests/fd_sync.out"
);
}

View File

@ -1,18 +0,0 @@
// !!! THIS IS A GENERATED FILE !!!
// ANY MANUAL EDITS MAY BE OVERWRITTEN AT ANY TIME
// Files autogenerated with cargo build (build/wasitests.rs).
#[test]
fn test_snapshot1_fseek() {
assert_wasi_output!(
"../../wasitests/snapshot1/fseek.wasm",
"snapshot1_fseek",
vec![],
vec![(
".".to_string(),
::std::path::PathBuf::from("wasitests/test_fs/hamlet")
),],
vec![],
"../../wasitests/fseek.out"
);
}

View File

@ -1,18 +0,0 @@
// !!! THIS IS A GENERATED FILE !!!
// ANY MANUAL EDITS MAY BE OVERWRITTEN AT ANY TIME
// Files autogenerated with cargo build (build/wasitests.rs).
#[test]
fn test_snapshot1_mapdir() {
assert_wasi_output!(
"../../wasitests/snapshot1/mapdir.wasm",
"snapshot1_mapdir",
vec![],
vec![(
".".to_string(),
::std::path::PathBuf::from("wasitests/test_fs/hamlet")
),],
vec![],
"../../wasitests/mapdir.out"
);
}

View File

@ -1,24 +0,0 @@
// !!! THIS IS A GENERATED FILE !!!
// ANY MANUAL EDITS MAY BE OVERWRITTEN AT ANY TIME
// Files autogenerated with cargo build (build/wasitests.rs).
#[test]
fn test_snapshot1_path_link() {
assert_wasi_output!(
"../../wasitests/snapshot1/path_link.wasm",
"snapshot1_path_link",
vec![],
vec![
(
"act5".to_string(),
::std::path::PathBuf::from("wasitests/test_fs/hamlet/act5")
),
(
"temp".to_string(),
::std::path::PathBuf::from("wasitests/test_fs/temp")
),
],
vec![],
"../../wasitests/path_link.out"
);
}

View File

@ -1,18 +0,0 @@
// !!! THIS IS A GENERATED FILE !!!
// ANY MANUAL EDITS MAY BE OVERWRITTEN AT ANY TIME
// Files autogenerated with cargo build (build/wasitests.rs).
#[test]
fn test_snapshot1_path_rename() {
assert_wasi_output!(
"../../wasitests/snapshot1/path_rename.wasm",
"snapshot1_path_rename",
vec![],
vec![(
"temp".to_string(),
::std::path::PathBuf::from("wasitests/test_fs/temp")
),],
vec![],
"../../wasitests/path_rename.out"
);
}

View File

@ -1,24 +0,0 @@
// !!! THIS IS A GENERATED FILE !!!
// ANY MANUAL EDITS MAY BE OVERWRITTEN AT ANY TIME
// Files autogenerated with cargo build (build/wasitests.rs).
#[test]
fn test_snapshot1_path_symlink() {
assert_wasi_output!(
"../../wasitests/snapshot1/path_symlink.wasm",
"snapshot1_path_symlink",
vec![],
vec![
(
"temp".to_string(),
::std::path::PathBuf::from("wasitests/test_fs/temp")
),
(
"hamlet".to_string(),
::std::path::PathBuf::from("wasitests/test_fs/hamlet")
),
],
vec![],
"../../wasitests/path_symlink.out"
);
}

View File

@ -1,25 +0,0 @@
// !!! THIS IS A GENERATED FILE !!!
// ANY MANUAL EDITS MAY BE OVERWRITTEN AT ANY TIME
// Files autogenerated with cargo build (build/wasitests.rs).
#[test]
#[ignore]
fn test_snapshot1_poll_oneoff() {
assert_wasi_output!(
"../../wasitests/snapshot1/poll_oneoff.wasm",
"snapshot1_poll_oneoff",
vec![],
vec![
(
"hamlet".to_string(),
::std::path::PathBuf::from("wasitests/test_fs/hamlet")
),
(
"temp".to_string(),
::std::path::PathBuf::from("wasitests/test_fs/temp")
),
],
vec![],
"../../wasitests/poll_oneoff.out"
);
}

View File

@ -1,18 +0,0 @@
// !!! THIS IS A GENERATED FILE !!!
// ANY MANUAL EDITS MAY BE OVERWRITTEN AT ANY TIME
// Files autogenerated with cargo build (build/wasitests.rs).
#[test]
fn test_snapshot1_readlink() {
assert_wasi_output!(
"../../wasitests/snapshot1/readlink.wasm",
"snapshot1_readlink",
vec![],
vec![(
".".to_string(),
::std::path::PathBuf::from("wasitests/test_fs/hamlet")
),],
vec![],
"../../wasitests/readlink.out"
);
}

View File

@ -1,28 +0,0 @@
// !!! THIS IS A GENERATED FILE !!!
// ANY MANUAL EDITS MAY BE OVERWRITTEN AT ANY TIME
// Files autogenerated with cargo build (build/wasitests.rs).
#[test]
fn test_snapshot1_wasi_sees_virtual_root() {
assert_wasi_output!(
"../../wasitests/snapshot1/wasi_sees_virtual_root.wasm",
"snapshot1_wasi_sees_virtual_root",
vec![],
vec![
(
"act1".to_string(),
::std::path::PathBuf::from("wasitests/test_fs/hamlet/act1")
),
(
"act2".to_string(),
::std::path::PathBuf::from("wasitests/test_fs/hamlet/act2")
),
(
"act1-again".to_string(),
::std::path::PathBuf::from("wasitests/test_fs/hamlet/act1")
),
],
vec![],
"../../wasitests/wasi_sees_virtual_root.out"
);
}

View File

@ -1,28 +0,0 @@
// !!! THIS IS A GENERATED FILE !!!
// ANY MANUAL EDITS MAY BE OVERWRITTEN AT ANY TIME
// Files autogenerated with cargo build (build/wasitests.rs).
#[test]
fn test_snapshot1_writing() {
assert_wasi_output!(
"../../wasitests/snapshot1/writing.wasm",
"snapshot1_writing",
vec![],
vec![
(
"act1".to_string(),
::std::path::PathBuf::from("wasitests/test_fs/hamlet/act1")
),
(
"act2".to_string(),
::std::path::PathBuf::from("wasitests/test_fs/hamlet/act2")
),
(
"act1-again".to_string(),
::std::path::PathBuf::from("wasitests/test_fs/hamlet/act1")
),
],
vec![],
"../../wasitests/writing.out"
);
}

View File

@ -1,18 +0,0 @@
// !!! THIS IS A GENERATED FILE !!!
// ANY MANUAL EDITS MAY BE OVERWRITTEN AT ANY TIME
// Files autogenerated with cargo build (build/wasitests.rs).
#[test]
fn test_unstable_close_preopen_fd() {
assert_wasi_output!(
"../../wasitests/unstable/close_preopen_fd.wasm",
"unstable_close_preopen_fd",
vec![],
vec![(
"hamlet".to_string(),
::std::path::PathBuf::from("wasitests/test_fs/hamlet")
),],
vec![],
"../../wasitests/close_preopen_fd.out"
);
}

View File

@ -1,18 +0,0 @@
// !!! THIS IS A GENERATED FILE !!!
// ANY MANUAL EDITS MAY BE OVERWRITTEN AT ANY TIME
// Files autogenerated with cargo build (build/wasitests.rs).
#[test]
fn test_unstable_fd_allocate() {
assert_wasi_output!(
"../../wasitests/unstable/fd_allocate.wasm",
"unstable_fd_allocate",
vec![],
vec![(
".".to_string(),
::std::path::PathBuf::from("wasitests/test_fs/temp")
),],
vec![],
"../../wasitests/fd_allocate.out"
);
}

View File

@ -1,18 +0,0 @@
// !!! THIS IS A GENERATED FILE !!!
// ANY MANUAL EDITS MAY BE OVERWRITTEN AT ANY TIME
// Files autogenerated with cargo build (build/wasitests.rs).
#[test]
fn test_unstable_fd_append() {
assert_wasi_output!(
"../../wasitests/unstable/fd_append.wasm",
"unstable_fd_append",
vec![],
vec![(
".".to_string(),
::std::path::PathBuf::from("wasitests/test_fs/temp")
),],
vec![],
"../../wasitests/fd_append.out"
);
}

View File

@ -1,18 +0,0 @@
// !!! THIS IS A GENERATED FILE !!!
// ANY MANUAL EDITS MAY BE OVERWRITTEN AT ANY TIME
// Files autogenerated with cargo build (build/wasitests.rs).
#[test]
fn test_unstable_fd_close() {
assert_wasi_output!(
"../../wasitests/unstable/fd_close.wasm",
"unstable_fd_close",
vec![],
vec![(
".".to_string(),
::std::path::PathBuf::from("wasitests/test_fs/hamlet")
),],
vec![],
"../../wasitests/fd_close.out"
);
}

View File

@ -1,18 +0,0 @@
// !!! THIS IS A GENERATED FILE !!!
// ANY MANUAL EDITS MAY BE OVERWRITTEN AT ANY TIME
// Files autogenerated with cargo build (build/wasitests.rs).
#[test]
fn test_unstable_fd_pread() {
assert_wasi_output!(
"../../wasitests/unstable/fd_pread.wasm",
"unstable_fd_pread",
vec![],
vec![(
".".to_string(),
::std::path::PathBuf::from("wasitests/test_fs/hamlet")
),],
vec![],
"../../wasitests/fd_pread.out"
);
}

View File

@ -1,18 +0,0 @@
// !!! THIS IS A GENERATED FILE !!!
// ANY MANUAL EDITS MAY BE OVERWRITTEN AT ANY TIME
// Files autogenerated with cargo build (build/wasitests.rs).
#[test]
fn test_unstable_fd_read() {
assert_wasi_output!(
"../../wasitests/unstable/fd_read.wasm",
"unstable_fd_read",
vec![],
vec![(
".".to_string(),
::std::path::PathBuf::from("wasitests/test_fs/hamlet")
),],
vec![],
"../../wasitests/fd_read.out"
);
}

View File

@ -1,18 +0,0 @@
// !!! THIS IS A GENERATED FILE !!!
// ANY MANUAL EDITS MAY BE OVERWRITTEN AT ANY TIME
// Files autogenerated with cargo build (build/wasitests.rs).
#[test]
fn test_unstable_fd_sync() {
assert_wasi_output!(
"../../wasitests/unstable/fd_sync.wasm",
"unstable_fd_sync",
vec![],
vec![(
".".to_string(),
::std::path::PathBuf::from("wasitests/test_fs/temp")
),],
vec![],
"../../wasitests/fd_sync.out"
);
}

View File

@ -1,18 +0,0 @@
// !!! THIS IS A GENERATED FILE !!!
// ANY MANUAL EDITS MAY BE OVERWRITTEN AT ANY TIME
// Files autogenerated with cargo build (build/wasitests.rs).
#[test]
fn test_unstable_fseek() {
assert_wasi_output!(
"../../wasitests/unstable/fseek.wasm",
"unstable_fseek",
vec![],
vec![(
".".to_string(),
::std::path::PathBuf::from("wasitests/test_fs/hamlet")
),],
vec![],
"../../wasitests/fseek.out"
);
}

View File

@ -1,18 +0,0 @@
// !!! THIS IS A GENERATED FILE !!!
// ANY MANUAL EDITS MAY BE OVERWRITTEN AT ANY TIME
// Files autogenerated with cargo build (build/wasitests.rs).
#[test]
fn test_unstable_mapdir() {
assert_wasi_output!(
"../../wasitests/unstable/mapdir.wasm",
"unstable_mapdir",
vec![],
vec![(
".".to_string(),
::std::path::PathBuf::from("wasitests/test_fs/hamlet")
),],
vec![],
"../../wasitests/mapdir.out"
);
}

View File

@ -1,24 +0,0 @@
// !!! THIS IS A GENERATED FILE !!!
// ANY MANUAL EDITS MAY BE OVERWRITTEN AT ANY TIME
// Files autogenerated with cargo build (build/wasitests.rs).
#[test]
fn test_unstable_path_link() {
assert_wasi_output!(
"../../wasitests/unstable/path_link.wasm",
"unstable_path_link",
vec![],
vec![
(
"act5".to_string(),
::std::path::PathBuf::from("wasitests/test_fs/hamlet/act5")
),
(
"temp".to_string(),
::std::path::PathBuf::from("wasitests/test_fs/temp")
),
],
vec![],
"../../wasitests/path_link.out"
);
}

View File

@ -1,18 +0,0 @@
// !!! THIS IS A GENERATED FILE !!!
// ANY MANUAL EDITS MAY BE OVERWRITTEN AT ANY TIME
// Files autogenerated with cargo build (build/wasitests.rs).
#[test]
fn test_unstable_path_rename() {
assert_wasi_output!(
"../../wasitests/unstable/path_rename.wasm",
"unstable_path_rename",
vec![],
vec![(
"temp".to_string(),
::std::path::PathBuf::from("wasitests/test_fs/temp")
),],
vec![],
"../../wasitests/path_rename.out"
);
}

View File

@ -1,24 +0,0 @@
// !!! THIS IS A GENERATED FILE !!!
// ANY MANUAL EDITS MAY BE OVERWRITTEN AT ANY TIME
// Files autogenerated with cargo build (build/wasitests.rs).
#[test]
fn test_unstable_path_symlink() {
assert_wasi_output!(
"../../wasitests/unstable/path_symlink.wasm",
"unstable_path_symlink",
vec![],
vec![
(
"temp".to_string(),
::std::path::PathBuf::from("wasitests/test_fs/temp")
),
(
"hamlet".to_string(),
::std::path::PathBuf::from("wasitests/test_fs/hamlet")
),
],
vec![],
"../../wasitests/path_symlink.out"
);
}

View File

@ -1,24 +0,0 @@
// !!! THIS IS A GENERATED FILE !!!
// ANY MANUAL EDITS MAY BE OVERWRITTEN AT ANY TIME
// Files autogenerated with cargo build (build/wasitests.rs).
#[test]
fn test_unstable_poll_oneoff() {
assert_wasi_output!(
"../../wasitests/unstable/poll_oneoff.wasm",
"unstable_poll_oneoff",
vec![],
vec![
(
"hamlet".to_string(),
::std::path::PathBuf::from("wasitests/test_fs/hamlet")
),
(
"temp".to_string(),
::std::path::PathBuf::from("wasitests/test_fs/temp")
),
],
vec![],
"../../wasitests/poll_oneoff.out"
);
}

View File

@ -1,18 +0,0 @@
// !!! THIS IS A GENERATED FILE !!!
// ANY MANUAL EDITS MAY BE OVERWRITTEN AT ANY TIME
// Files autogenerated with cargo build (build/wasitests.rs).
#[test]
fn test_unstable_readlink() {
assert_wasi_output!(
"../../wasitests/unstable/readlink.wasm",
"unstable_readlink",
vec![],
vec![(
".".to_string(),
::std::path::PathBuf::from("wasitests/test_fs/hamlet")
),],
vec![],
"../../wasitests/readlink.out"
);
}

View File

@ -1,28 +0,0 @@
// !!! THIS IS A GENERATED FILE !!!
// ANY MANUAL EDITS MAY BE OVERWRITTEN AT ANY TIME
// Files autogenerated with cargo build (build/wasitests.rs).
#[test]
fn test_unstable_wasi_sees_virtual_root() {
assert_wasi_output!(
"../../wasitests/unstable/wasi_sees_virtual_root.wasm",
"unstable_wasi_sees_virtual_root",
vec![],
vec![
(
"act1".to_string(),
::std::path::PathBuf::from("wasitests/test_fs/hamlet/act1")
),
(
"act2".to_string(),
::std::path::PathBuf::from("wasitests/test_fs/hamlet/act2")
),
(
"act1-again".to_string(),
::std::path::PathBuf::from("wasitests/test_fs/hamlet/act1")
),
],
vec![],
"../../wasitests/wasi_sees_virtual_root.out"
);
}

View File

@ -1,28 +0,0 @@
// !!! THIS IS A GENERATED FILE !!!
// ANY MANUAL EDITS MAY BE OVERWRITTEN AT ANY TIME
// Files autogenerated with cargo build (build/wasitests.rs).
#[test]
fn test_unstable_writing() {
assert_wasi_output!(
"../../wasitests/unstable/writing.wasm",
"unstable_writing",
vec![],
vec![
(
"act1".to_string(),
::std::path::PathBuf::from("wasitests/test_fs/hamlet/act1")
),
(
"act2".to_string(),
::std::path::PathBuf::from("wasitests/test_fs/hamlet/act2")
),
(
"act1-again".to_string(),
::std::path::PathBuf::from("wasitests/test_fs/hamlet/act1")
),
],
vec![],
"../../wasitests/writing.out"
);
}

View File

@ -1,5 +1,7 @@
mod runtime_core_tests;
use runtime_core_tests::{get_compiler, wat2wasm};
use wasmer_runtime_core::{compile_with, imports};
use wasmer_runtime_core_tests::{get_compiler, wat2wasm};
#[test]
fn exception_handling_works() {

View File

@ -0,0 +1,21 @@
[package]
name = "generate-wasi-tests"
version = "0.16.2"
description = "Tests for our WASI implementation"
license = "MIT"
authors = ["The Wasmer Engineering Team <engineering@wasmer.io>"]
edition = "2018"
publish = false
[dependencies]
glob = "0.3"
tempfile = "3"
# We set default features to false to be able to use the singlepass backend properly
#[dev-dependencies]
#wasmer-dev-utils = { path = "../../lib/dev-utils", version = "0.16.2"}
#[features]
#clif = ["wasmer-clif-backend", "wasmer-runtime/default-backend-cranelift"]
#singlepass = ["wasmer-singlepass-backend", "wasmer-runtime/default-backend-singlepass"]
#llvm = ["wasmer-llvm-backend", "wasmer-runtime/default-backend-llvm"]

View File

@ -1,14 +1,19 @@
use std::env;
mod set_up_toolchain;
mod util;
mod wasi_version;
mod wasitests;
pub mod set_up_toolchain;
pub mod util;
pub mod wasi_version;
pub mod wasitests;
static WASITESTS_ENV_VAR: &str = "WASM_WASI_GENERATE_WASITESTS";
static WASITESTS_SET_UP_TOOLCHAIN: &str = "WASM_WASI_SET_UP_TOOLCHAIN";
static WASITESTS_GENERATE_ALL: &str = "WASI_TEST_GENERATE_ALL";
fn main() {
pub fn build() {
//println!("cargo:rerun-if-changed=tests/wasi_test_resources/*.rs");
println!("cargo:rerun-if-env-changed={}", WASITESTS_ENV_VAR);
println!("cargo:rerun-if-env-changed={}", WASITESTS_SET_UP_TOOLCHAIN);
println!("cargo:rerun-if-env-changed={}", WASITESTS_GENERATE_ALL);
let do_all_wasi_tests = util::should_operate_on_all_wasi_tests();
if env::var(WASITESTS_SET_UP_TOOLCHAIN).unwrap_or("0".to_string()) == "1" {
set_up_toolchain::set_it_up(do_all_wasi_tests);

View File

@ -1,5 +1,5 @@
use crate::util;
use crate::wasi_version::*;
use super::util;
use super::wasi_version::*;
use std::process::Command;

View File

@ -15,12 +15,12 @@ use std::fs::File;
use std::io::prelude::*;
use std::io::{self, BufReader};
use crate::util;
use crate::wasi_version::*;
use super::util;
use super::wasi_version::*;
static BANNER: &str = "// !!! THIS IS A GENERATED FILE !!!
// ANY MANUAL EDITS MAY BE OVERWRITTEN AT ANY TIME
// Files autogenerated with cargo build (build/wasitests.rs).\n";
// Files autogenerated with cargo build.\n";
/// Compile and execute the test file as native code, saving the results to be
/// compared against later.
@ -56,12 +56,19 @@ fn generate_native_output(temp_dir: &Path, file: &str, normalized_name: &str) ->
fs::set_permissions(&executable_path, perm)?;
}
println!(
"Executing native program at {}",
executable_path.to_string_lossy()
);
// workspace root
const EXECUTE_DIR: &str = concat!(env!("CARGO_MANIFEST_DIR"), "/../..");
let result = Command::new(&executable_path)
.current_dir(EXECUTE_DIR)
.output()
.expect("Failed to execute native program");
util::print_info_on_error(&result, "NATIVE PROGRAM FAILED");
let mut output_path = executable_path.clone();
let mut output_path = PathBuf::from(file);
output_path.set_extension("out");
println!("Writing output to {}", output_path.to_string_lossy());
@ -207,26 +214,26 @@ fn generate_test_file(
#[test]{ignore}
fn test_{test_name}() {{
assert_wasi_output!(
\"../../{module_path}\",
\"{module_path}\",
\"{test_name}\",
{dir_args},
{mapdir_args},
{envvar_args},
\"../../{test_output_path}\"
\"{test_output_path}\"
);
}}
",
banner = BANNER,
ignore = ignored,
module_path = wasm_out_name,
module_path = format!("../wasi_test_resources/{}.wasm", wasm_out_name),
test_name = &test_name,
test_output_path = format!("wasitests/{}.out", rs_module_name),
test_output_path = format!("../wasi_test_resources/{}.out", rs_module_name),
dir_args = dir_args,
mapdir_args = mapdir_args,
envvar_args = envvar_args
);
let rust_test_filepath = format!(
concat!(env!("CARGO_MANIFEST_DIR"), "/tests/wasitests/{}.rs"),
concat!(env!("CARGO_MANIFEST_DIR"), "/../wasitests/{}.rs"),
&test_name,
);
fs::write(&rust_test_filepath, contents.as_bytes())?;
@ -252,18 +259,21 @@ fn compile(
};
let base_dir = Path::new(file).parent().unwrap();
generate_native_output(temp_dir, &file, &rs_mod_name).expect("Generate native output");
let mut out = vec![];
for &version in wasi_versions {
let wasm_out_path = compile_wasm_for_version(temp_dir, file, base_dir, &rs_mod_name, version)
wasi_versions
.into_iter()
.map(|&version| {
compile_wasm_for_version(temp_dir, file, base_dir, &rs_mod_name, version)
.expect(&format!("Could not compile Wasm to WASI version {:?}, perhaps you need to install the `{}` rust toolchain", version, version.get_compiler_toolchain()));
let wasm_out_name = wasm_out_path.to_string_lossy();
let test_mod = generate_test_file(file, &rs_mod_name, &wasm_out_name, version, ignores)
.expect(&format!("generate test file {}", &rs_mod_name));
out.push(test_mod);
}
let wasm_out_relative_path = {
let base_path = PathBuf::from(version.get_directory_name());
base_path.join(&rs_mod_name)
};
let wasm_out_name = wasm_out_relative_path.to_string_lossy();
out
generate_test_file(file, &rs_mod_name, &wasm_out_name, version, ignores)
.expect(&format!("generate test file {}", &rs_mod_name))
}).collect::<Vec<String>>()
}
fn run_prelude(should_gen_all: bool) -> &'static [WasiVersion] {
@ -284,15 +294,16 @@ fn run_prelude(should_gen_all: bool) -> &'static [WasiVersion] {
}
}
const WASI_TEST_SRC_DIR: &str = concat!(env!("CARGO_MANIFEST_DIR"), "/../wasi_test_resources/*.rs");
pub fn build(should_gen_all: bool) {
let rust_test_modpath = concat!(env!("CARGO_MANIFEST_DIR"), "/tests/wasitests/mod.rs");
let rust_test_modpath = concat!(env!("CARGO_MANIFEST_DIR"), "/../wasitests/mod.rs");
let mut modules: Vec<String> = Vec::new();
let wasi_versions = run_prelude(should_gen_all);
let temp_dir = tempfile::TempDir::new().unwrap();
let ignores = read_ignore_list();
for entry in glob("wasitests/*.rs").unwrap() {
for entry in glob(WASI_TEST_SRC_DIR).unwrap() {
match entry {
Ok(path) => {
let test = path.to_str().unwrap();
@ -333,8 +344,12 @@ pub fn build(should_gen_all: bool) {
}
}
const IGNORE_LIST_PATH: &str = concat!(
env!("CARGO_MANIFEST_DIR"),
"/../wasi_test_resources/ignores.txt"
);
fn read_ignore_list() -> HashSet<String> {
let f = File::open("wasitests/ignores.txt").unwrap();
let f = File::open(IGNORE_LIST_PATH).unwrap();
let f = BufReader::new(f);
f.lines()
.filter_map(Result::ok)

View File

@ -1,3 +1,6 @@
mod runtime_core_tests;
use runtime_core_tests::{get_compiler, wat2wasm};
use std::{convert::TryInto, sync::Arc};
use wasmer_runtime_core::{
compile_with,
@ -10,7 +13,6 @@ use wasmer_runtime_core::{
units::Pages,
vm, DynFunc, Instance,
};
use wasmer_runtime_core_tests::{get_compiler, wat2wasm};
#[test]
fn new_api_works() {

View File

@ -1,5 +1,23 @@
#![cfg(all(feature = "backend-llvm", test))]
#![deny(
dead_code,
nonstandard_style,
unused_imports,
unused_mut,
unused_variables,
unused_unsafe,
unreachable_patterns
)]
use wabt::wat2wasm;
use wasmer_llvm_backend::LLVMCompiler;
use wasmer_runtime_core::backend::Compiler;
pub fn get_compiler() -> impl Compiler {
LLVMCompiler::new()
}
use wasmer_llvm_backend::{InkwellModule, LLVMBackendConfig, LLVMCallbacks};
use wasmer_llvm_backend_tests::{get_compiler, wat2wasm};
use wasmer_runtime::{imports, CompilerConfig};
use wasmer_runtime_core::{backend::BackendCompilerConfig, compile_with, compile_with_config};

View File

@ -1,4 +1,4 @@
#[cfg(all(test, any(feature = "singlepass", feature = "llvm")))]
#[cfg(all(test, any(feature = "backend-singlepass", feature = "backend-llvm")))]
mod tests {
use wabt::wat2wasm;
@ -9,13 +9,13 @@ mod tests {
use wasmer_runtime_core::state::CodeVersion;
use wasmer_runtime_core::{backend::Compiler, compile_with, imports, Func};
#[cfg(feature = "llvm")]
#[cfg(feature = "backend-llvm")]
use wasmer_llvm_backend::ModuleCodeGenerator as MCG;
#[cfg(feature = "singlepass")]
#[cfg(feature = "backend-singlepass")]
use wasmer_singlepass_backend::ModuleCodeGenerator as MCG;
#[cfg(feature = "clif")]
#[cfg(feature = "backend-cranelift")]
compile_error!("cranelift does not implement metering yet");
fn get_compiler(limit: u64) -> impl Compiler {
@ -27,7 +27,11 @@ mod tests {
c
}
#[cfg(not(any(feature = "llvm", feature = "clif", feature = "singlepass")))]
#[cfg(not(any(
feature = "backend-llvm",
feature = "backend-cranelift",
feature = "backend-singlepass"
)))]
compile_error!("compiler not specified, activate a compiler via features");
// Assemblyscript

View File

@ -4,6 +4,8 @@ use wasmer_wasi::{state::*, *};
use std::ffi::c_void;
// TODO: fix this test!
#[ignore]
#[cfg(not(feature = "singlepass"))]
#[test]
fn serializing_works() {
@ -15,7 +17,7 @@ fn serializing_works() {
b"PATH=/bin".into_iter().cloned().collect(),
b"GOROOT=$HOME/.cargo/bin".into_iter().cloned().collect(),
];
let wasm_binary = include_bytes!("../wasitests/unstable/fd_read.wasm");
let wasm_binary = include_bytes!("wasi_test_resources/unstable/fd_read.wasm");
let module = compile(&wasm_binary[..])
.map_err(|e| format!("Can't compile module: {:?}", e))
.unwrap();
@ -28,7 +30,7 @@ fn serializing_works() {
vec![],
vec![(
".".to_string(),
std::path::PathBuf::from("wasitests/test_fs/hamlet"),
std::path::PathBuf::from("wasi_test_resources/test_fs/hamlet"),
)],
);

View File

@ -1,5 +1,5 @@
// Args:
// mapdir: hamlet:wasitests/test_fs/hamlet
// mapdir: hamlet:tests/wasi_test_resources/test_fs/hamlet
use std::fs;
use std::path::PathBuf;

View File

@ -1,5 +1,5 @@
// Args:
// mapdir: .:wasitests/test_fs/temp
// mapdir: .:tests/wasi_test_resources/test_fs/temp
use std::fs;
#[cfg(target_os = "wasi")]

View File

@ -1,5 +1,5 @@
// Args:
// mapdir: .:wasitests/test_fs/temp
// mapdir: .:tests/wasi_test_resources/test_fs/temp
use std::fs::OpenOptions;
use std::io::{Read, Write};
@ -11,7 +11,7 @@ static STR2: &str = "Goodbye, world!\n";
fn main() {
let file = {
#[cfg(not(target_os = "wasi"))]
let mut base = PathBuf::from("wasitests/test_fs/temp");
let mut base = PathBuf::from("tests/wasi_test_resources/test_fs/temp");
#[cfg(target_os = "wasi")]
let mut base = PathBuf::from(".");

View File

@ -1,5 +1,5 @@
// Args:
// mapdir: .:wasitests/test_fs/hamlet
// mapdir: .:tests/wasi_test_resources/test_fs/hamlet
use std::fs;
#[cfg(target_os = "wasi")]
@ -14,7 +14,7 @@ extern "C" {
fn main() {
#[cfg(not(target_os = "wasi"))]
let mut base = PathBuf::from("wasitests/test_fs/hamlet");
let mut base = PathBuf::from("tests/wasi_test_resources/test_fs/hamlet");
#[cfg(target_os = "wasi")]
let mut base = PathBuf::from(".");

View File

@ -1,5 +1,5 @@
// Args:
// mapdir: .:wasitests/test_fs/hamlet
// mapdir: .:tests/wasi_test_resources/test_fs/hamlet
use std::fs;
#[cfg(target_os = "wasi")]
@ -45,7 +45,7 @@ fn pread(fd: u32, iovs: &[&mut [u8]], offset: u64) -> u32 {
fn main() {
#[cfg(not(target_os = "wasi"))]
let mut base = PathBuf::from("wasitests/test_fs/hamlet");
let mut base = PathBuf::from("tests/wasi_test_resources/test_fs/hamlet");
#[cfg(target_os = "wasi")]
let mut base = PathBuf::from(".");

View File

@ -1,5 +1,5 @@
// Args:
// mapdir: .:wasitests/test_fs/hamlet
// mapdir: .:tests/wasi_test_resources/test_fs/hamlet
// this program is used in the pause/resume test
@ -46,7 +46,7 @@ fn read(fd: u32, iovs: &[&mut [u8]]) -> u32 {
fn main() {
#[cfg(not(target_os = "wasi"))]
let mut base = PathBuf::from("wasitests/test_fs/hamlet");
let mut base = PathBuf::from("tests/wasi_test_resources/test_fs/hamlet");
#[cfg(target_os = "wasi")]
let mut base = PathBuf::from(".");

View File

@ -1,5 +1,5 @@
// Args:
// mapdir: .:wasitests/test_fs/temp
// mapdir: .:tests/wasi_test_resources/test_fs/temp
use std::fs;
use std::path::PathBuf;

View File

@ -1,3 +1,3 @@
is dir: false
filetype: false true false
file info: 476
file info: 493

View File

@ -5,8 +5,8 @@ use std::fs;
use std::io::Read;
fn main() {
let mut this_file =
fs::File::open("wasitests/file_metadata.rs").expect("could not find src file");
let mut this_file = fs::File::open("tests/wasi_test_resources/file_metadata.rs")
.expect("could not find src file");
let md = this_file.metadata().unwrap();
println!("is dir: {}", md.is_dir());
let filetype = md.file_type();

View File

@ -1,5 +1,5 @@
// Args:
// mapdir: .:wasitests/test_fs/hamlet
// mapdir: .:tests/wasi_test_resources/test_fs/hamlet
use std::fs;
use std::io::{Read, Seek, SeekFrom};
@ -7,7 +7,7 @@ use std::path::PathBuf;
fn main() {
#[cfg(not(target_os = "wasi"))]
let mut base = PathBuf::from("wasitests/test_fs/hamlet");
let mut base = PathBuf::from("tests/wasi_test_resources/test_fs/hamlet");
#[cfg(target_os = "wasi")]
let mut base = PathBuf::from(".");

View File

@ -1,11 +1,11 @@
// Args:
// mapdir: .:wasitests/test_fs/hamlet
// mapdir: .:tests/wasi_test_resources/test_fs/hamlet
use std::fs;
fn main() {
#[cfg(not(target_os = "wasi"))]
std::env::set_current_dir("wasitests/test_fs/hamlet").unwrap();
std::env::set_current_dir("tests/wasi_test_resources/test_fs/hamlet").unwrap();
let read_dir = fs::read_dir(".").unwrap();
let mut out = vec![];

View File

@ -1,6 +1,6 @@
// Args:
// mapdir: act5:wasitests/test_fs/hamlet/act5
// mapdir: temp:wasitests/test_fs/temp
// mapdir: act5:tests/wasi_test_resources/test_fs/hamlet/act5
// mapdir: temp:tests/wasi_test_resources/test_fs/temp
use std::fs;
use std::io::Read;

View File

@ -1,5 +1,5 @@
// Args:
// mapdir: temp:wasitests/test_fs/temp
// mapdir: temp:tests/wasi_test_resources/test_fs/temp
use std::fs;
use std::io::{Read, Write};
@ -7,7 +7,7 @@ use std::path::PathBuf;
fn main() {
#[cfg(not(target_os = "wasi"))]
let mut base = PathBuf::from("wasitests/test_fs");
let mut base = PathBuf::from("tests/wasi_test_resources/test_fs");
#[cfg(target_os = "wasi")]
let mut base = PathBuf::from("/");

View File

@ -1,6 +1,6 @@
// Args:
// mapdir: temp:wasitests/test_fs/temp
// mapdir: hamlet:wasitests/test_fs/hamlet
// mapdir: temp:tests/wasi_test_resources/test_fs/temp
// mapdir: hamlet:tests/wasi_test_resources/test_fs/hamlet
use std::fs;
use std::io::{Read, Seek, SeekFrom};
@ -8,7 +8,7 @@ use std::path::PathBuf;
fn main() {
#[cfg(not(target_os = "wasi"))]
let mut base = PathBuf::from("wasitests/test_fs");
let mut base = PathBuf::from("tests/wasi_test_resources/test_fs");
#[cfg(target_os = "wasi")]
let mut base = PathBuf::from("/");

View File

@ -1,6 +1,6 @@
// Args:
// mapdir: hamlet:wasitests/test_fs/hamlet
// mapdir: temp:wasitests/test_fs/temp
// mapdir: hamlet:tests/wasi_test_resources/test_fs/hamlet
// mapdir: temp:tests/wasi_test_resources/test_fs/temp
use std::fs;
use std::io::{Read, Seek, SeekFrom};
@ -139,7 +139,7 @@ fn poll(fds: &[u32], read: &[bool], write: &[bool]) -> Result<Vec<__wasi_event_t
fn main() {
#[cfg(not(target_os = "wasi"))]
let mut base = PathBuf::from("wasitests/test_fs");
let mut base = PathBuf::from("tests/wasi_test_resources/test_fs");
#[cfg(target_os = "wasi")]
let mut base = PathBuf::from("/");

View File

@ -5,7 +5,8 @@ use std::fs;
use std::io::Read;
fn main() {
let mut this_file = fs::File::open("wasitests/quine.rs").expect("could not find src file");
let mut this_file =
fs::File::open("tests/wasi_test_resources/quine.rs").expect("could not find src file");
let md = this_file.metadata().unwrap();
let mut in_str = String::new();
this_file.read_to_string(&mut in_str).unwrap();

View File

@ -5,7 +5,8 @@ use std::fs;
use std::io::Read;
fn main() {
let mut this_file = fs::File::open("wasitests/quine.rs").expect("could not find src file");
let mut this_file =
fs::File::open("tests/wasi_test_resources/quine.rs").expect("could not find src file");
let md = this_file.metadata().unwrap();
let mut in_str = String::new();
this_file.read_to_string(&mut in_str).unwrap();

View File

@ -1,10 +1,10 @@
// Args:
// mapdir: .:wasitests/test_fs/hamlet
// mapdir: .:tests/wasi_test_resources/test_fs/hamlet
use std::io::Read;
fn main() {
#[cfg(not(target_os = "wasi"))]
std::env::set_current_dir("wasitests/test_fs/hamlet").unwrap();
std::env::set_current_dir("tests/wasi_test_resources/test_fs/hamlet").unwrap();
let sym_link_path = "bookmarks/2019-07-16";

Some files were not shown because too many files have changed in this diff Show More