diff --git a/.gitmodules b/.gitmodules index 0d62170cd0..6447c5a6c9 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,5 +1,5 @@ [submodule "spec_testsuite"] - path = spec_testsuite + path = tests/spec_testsuite url = https://github.com/WebAssembly/testsuite [submodule "crates/api/c-examples/wasm-c-api"] path = crates/api/c-examples/wasm-c-api diff --git a/README.md b/README.md index f53b1c7bc7..50771b8573 100644 --- a/README.md +++ b/README.md @@ -20,8 +20,8 @@ for a tutorial on compiling and running programs using WASI and wasmtime, as well as an overview of the filesystem sandboxing system. Wasmtime passes the [WebAssembly spec testsuite]. To run it, update the -`spec_testsuite` submodule with `git submodule update --remote`, and it will -be run as part of `cargo test`. +`tests/spec_testsuite` submodule with `git submodule update --remote`, and it +will be run as part of `cargo test`. Wasmtime does not yet implement Spectre mitigations, however this is a subject of ongoing research. diff --git a/build.rs b/build.rs index 0c3bf69053..440ad8b3d2 100644 --- a/build.rs +++ b/build.rs @@ -25,34 +25,38 @@ fn main() -> anyhow::Result<()> { writeln!(out, "#[allow(non_snake_case)]")?; writeln!(out, "mod {} {{", strategy)?; - test_directory(&mut out, "misc_testsuite", strategy)?; - let spec_tests = test_directory(&mut out, "spec_testsuite", strategy)?; + test_directory(&mut out, "tests/misc_testsuite", strategy)?; + let spec_tests = test_directory(&mut out, "tests/spec_testsuite", strategy)?; // Skip running spec_testsuite tests if the submodule isn't checked // out. if spec_tests > 0 { start_test_module(&mut out, "simd")?; write_testsuite_tests( &mut out, - "spec_testsuite/proposals/simd/simd_address.wast", + "tests/spec_testsuite/proposals/simd/simd_address.wast", "simd", strategy, )?; write_testsuite_tests( &mut out, - "spec_testsuite/proposals/simd/simd_align.wast", + "tests/spec_testsuite/proposals/simd/simd_align.wast", "simd", strategy, )?; write_testsuite_tests( &mut out, - "spec_testsuite/proposals/simd/simd_const.wast", + "tests/spec_testsuite/proposals/simd/simd_const.wast", "simd", strategy, )?; finish_test_module(&mut out)?; - test_directory(&mut out, "spec_testsuite/proposals/multi-value", strategy) - .expect("generating tests"); + test_directory( + &mut out, + "tests/spec_testsuite/proposals/multi-value", + strategy, + ) + .expect("generating tests"); } else { println!("cargo:warning=The spec testsuite is disabled. To enable, run `git submodule update --remote`."); } diff --git a/filetests/trap_bounds.wat b/filetests/trap_bounds.wat deleted file mode 100644 index efdf7957b3..0000000000 --- a/filetests/trap_bounds.wat +++ /dev/null @@ -1,9 +0,0 @@ -(module - (memory 1 1) - (func $main - i32.const 65536 - i32.const 65536 - i32.store - ) - (start $main) -) diff --git a/filetests/trap_divbyzero.wat b/filetests/trap_divbyzero.wat deleted file mode 100644 index 34a831ac10..0000000000 --- a/filetests/trap_divbyzero.wat +++ /dev/null @@ -1,11 +0,0 @@ -(module - (func $foo (result i32) - i32.const 1 - i32.const 0 - i32.div_s - ) - (func $main - (drop (call $foo)) - ) - (start $main) -) diff --git a/filetests/trap_empty_mem.wat b/filetests/trap_empty_mem.wat deleted file mode 100644 index e56d563bed..0000000000 --- a/filetests/trap_empty_mem.wat +++ /dev/null @@ -1,9 +0,0 @@ -(module - (memory 0 0) - (func $main - i32.const 0 - i32.const 0 - i32.store - ) - (start $main) -) diff --git a/filetests/trap_stackoverflow.wat b/filetests/trap_stackoverflow.wat deleted file mode 100644 index 060d680895..0000000000 --- a/filetests/trap_stackoverflow.wat +++ /dev/null @@ -1,9 +0,0 @@ -(module - (func $foo - (call $main) - ) - (func $main - (call $foo) - ) - (start $main) -) diff --git a/filetests/trap_unreachable.wat b/filetests/trap_unreachable.wat deleted file mode 100644 index 575fccdfbf..0000000000 --- a/filetests/trap_unreachable.wat +++ /dev/null @@ -1,9 +0,0 @@ -(module - (func $foo - (unreachable) - ) - (func $main - (call $foo) - ) - (start $main) -) diff --git a/scripts/test-all.sh b/scripts/test-all.sh index 14ed7c17ac..80bac319fc 100755 --- a/scripts/test-all.sh +++ b/scripts/test-all.sh @@ -6,7 +6,7 @@ set -euo pipefail # - Check code formatting. # - Make a debug build. # - Make a release build. -# - Run unit tests for all Rust crates (including the filetests) +# - Run unit tests for all Rust crates # - Build API documentation. # - Optionally, run fuzzing. # diff --git a/tests/instantiate.rs b/tests/instantiate.rs index fc0d5237eb..5f6fbbd7dd 100644 --- a/tests/instantiate.rs +++ b/tests/instantiate.rs @@ -8,7 +8,7 @@ use std::collections::HashMap; use std::path::PathBuf; use wasmtime_jit::{instantiate, CompilationStrategy, Compiler, NullResolver}; -const PATH_MODULE_RS2WASM_ADD_FUNC: &str = r"filetests/rs2wasm-add-func.wat"; +const PATH_MODULE_RS2WASM_ADD_FUNC: &str = r"tests/wat/rs2wasm-add-func.wat"; /// Simple test reading a wasm-file and translating to binary representation. #[test] diff --git a/misc_testsuite/misc_traps.wast b/tests/misc_testsuite/misc_traps.wast similarity index 100% rename from misc_testsuite/misc_traps.wast rename to tests/misc_testsuite/misc_traps.wast diff --git a/misc_testsuite/stack_overflow.wast b/tests/misc_testsuite/stack_overflow.wast similarity index 100% rename from misc_testsuite/stack_overflow.wast rename to tests/misc_testsuite/stack_overflow.wast diff --git a/spec_testsuite b/tests/spec_testsuite similarity index 100% rename from spec_testsuite rename to tests/spec_testsuite diff --git a/filetests/rs2wasm-add-func.wat b/tests/wat/rs2wasm-add-func.wat similarity index 100% rename from filetests/rs2wasm-add-func.wat rename to tests/wat/rs2wasm-add-func.wat