Reorganize tests.
- Move spec_testsuite and misc_testsuite under the tests directory. - Remove some redundant tests from filetests. - Move wat tests to wat/tests.
This commit is contained in:
2
.gitmodules
vendored
2
.gitmodules
vendored
@@ -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
|
||||
|
||||
@@ -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.
|
||||
|
||||
18
build.rs
18
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`.");
|
||||
}
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
(module
|
||||
(memory 1 1)
|
||||
(func $main
|
||||
i32.const 65536
|
||||
i32.const 65536
|
||||
i32.store
|
||||
)
|
||||
(start $main)
|
||||
)
|
||||
@@ -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)
|
||||
)
|
||||
@@ -1,9 +0,0 @@
|
||||
(module
|
||||
(memory 0 0)
|
||||
(func $main
|
||||
i32.const 0
|
||||
i32.const 0
|
||||
i32.store
|
||||
)
|
||||
(start $main)
|
||||
)
|
||||
@@ -1,9 +0,0 @@
|
||||
(module
|
||||
(func $foo
|
||||
(call $main)
|
||||
)
|
||||
(func $main
|
||||
(call $foo)
|
||||
)
|
||||
(start $main)
|
||||
)
|
||||
@@ -1,9 +0,0 @@
|
||||
(module
|
||||
(func $foo
|
||||
(unreachable)
|
||||
)
|
||||
(func $main
|
||||
(call $foo)
|
||||
)
|
||||
(start $main)
|
||||
)
|
||||
@@ -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.
|
||||
#
|
||||
|
||||
@@ -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]
|
||||
|
||||
Reference in New Issue
Block a user