diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000000..cddceb58fd --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "tests/misc-tests"] + path = tests/misc-tests + url = https://github.com/kubkon/misc-tests.git diff --git a/Cargo.toml b/Cargo.toml index 8b1796c65e..8a2c7f17dd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -32,7 +32,6 @@ cranelift-entity = "0.30.0" cranelift-wasm = "0.30.0" cranelift-native = "0.30.0" target-lexicon = "0.3.0" -pretty_env_logger = "0.3" [lib] name = "wasi_common" diff --git a/tests/misc-tests b/tests/misc-tests new file mode 160000 index 0000000000..149048a645 --- /dev/null +++ b/tests/misc-tests @@ -0,0 +1 @@ +Subproject commit 149048a6459700793159318503a661b77fc2cf8c diff --git a/tests/misc_tests.rs b/tests/misc_tests.rs index 85b99f2d78..70e677fb63 100644 --- a/tests/misc_tests.rs +++ b/tests/misc_tests.rs @@ -1,54 +1,66 @@ mod runtime; -use std::sync::{Once, ONCE_INIT}; - -static INIT: Once = ONCE_INIT; - -fn setup() { - INIT.call_once(|| { - std::env::set_var("RUST_LOG", "wasi_common=trace"); - pretty_env_logger::init_custom_env("RUST_LOG"); - }); -} - #[test] fn sched_yield() { - setup(); - runtime::run_wasm("tests/misc-testsuite/sched_yield.wasm") + runtime::run_test("tests/misc-tests/bin/sched_yield.wasm") } #[test] fn truncation_rights() { - setup(); - runtime::run_wasm("tests/misc-testsuite/truncation_rights.wasm") + runtime::run_test("tests/misc-tests/bin/truncation_rights.wasm") } #[test] -fn unlink_dir() { - setup(); - runtime::run_wasm("tests/misc-testsuite/unlink_dir.wasm") +fn unlink_directory() { + runtime::run_test("tests/misc-tests/bin/unlink_directory.wasm") } #[test] -fn remove_nonempty_dir() { - setup(); - runtime::run_wasm("tests/misc-testsuite/remove_nonempty_dir.wasm") +fn remove_nonempty_directory() { + runtime::run_test("tests/misc-tests/bin/remove_nonempty_directory.wasm") } #[test] fn interesting_paths() { - setup(); - runtime::run_wasm("tests/misc-testsuite/interesting_paths.wasm") + runtime::run_test("tests/misc-tests/bin/interesting_paths.wasm") } #[test] fn nofollow_errors() { - setup(); - runtime::run_wasm("tests/misc-testsuite/nofollow_errors.wasm") + runtime::run_test("tests/misc-tests/bin/nofollow_errors.wasm") } #[test] fn symlink_loop() { - setup(); - runtime::run_wasm("tests/misc-testsuite/symlink_loop.wasm") + runtime::run_test("tests/misc-tests/bin/symlink_loop.wasm") +} + +#[test] +fn close_preopen() { + runtime::run_test("tests/misc-tests/bin/close_preopen.wasm") +} + +#[test] +fn clock_time_get() { + runtime::run_test("tests/misc-tests/bin/clock_time_get.wasm") +} + +#[test] +fn readlink_no_buffer() { + runtime::run_test("tests/misc-tests/bin/readlink_no_buffer.wasm") +} + +#[test] +fn isatty() { + runtime::run_test("tests/misc-tests/bin/isatty.wasm") +} + +#[test] +fn directory_seek() { + runtime::run_test("tests/misc-tests/bin/directory_seek.wasm") +} + +#[test] +fn big_random_buf() { + runtime::run_test("tests/misc-tests/bin/big_random_buf.wasm") } diff --git a/tests/runtime/mod.rs b/tests/runtime/mod.rs index abd49a6720..c620ffb88f 100644 --- a/tests/runtime/mod.rs +++ b/tests/runtime/mod.rs @@ -64,7 +64,7 @@ fn preopen_workspace(workspace: String) -> (String, File) { (".".to_owned(), preopen_dir) } -pub fn run_wasm>(path: P) { +pub fn run_test>(path: P) { let isa_builder = cranelift_native::builder().unwrap_or_else(|_| { panic!("host machine is not a supported target"); });