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"]
|
[submodule "spec_testsuite"]
|
||||||
path = spec_testsuite
|
path = tests/spec_testsuite
|
||||||
url = https://github.com/WebAssembly/testsuite
|
url = https://github.com/WebAssembly/testsuite
|
||||||
[submodule "crates/api/c-examples/wasm-c-api"]
|
[submodule "crates/api/c-examples/wasm-c-api"]
|
||||||
path = 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.
|
well as an overview of the filesystem sandboxing system.
|
||||||
|
|
||||||
Wasmtime passes the [WebAssembly spec testsuite]. To run it, update the
|
Wasmtime passes the [WebAssembly spec testsuite]. To run it, update the
|
||||||
`spec_testsuite` submodule with `git submodule update --remote`, and it will
|
`tests/spec_testsuite` submodule with `git submodule update --remote`, and it
|
||||||
be run as part of `cargo test`.
|
will be run as part of `cargo test`.
|
||||||
|
|
||||||
Wasmtime does not yet implement Spectre mitigations, however this is a subject
|
Wasmtime does not yet implement Spectre mitigations, however this is a subject
|
||||||
of ongoing research.
|
of ongoing research.
|
||||||
|
|||||||
16
build.rs
16
build.rs
@@ -25,33 +25,37 @@ fn main() -> anyhow::Result<()> {
|
|||||||
writeln!(out, "#[allow(non_snake_case)]")?;
|
writeln!(out, "#[allow(non_snake_case)]")?;
|
||||||
writeln!(out, "mod {} {{", strategy)?;
|
writeln!(out, "mod {} {{", strategy)?;
|
||||||
|
|
||||||
test_directory(&mut out, "misc_testsuite", strategy)?;
|
test_directory(&mut out, "tests/misc_testsuite", strategy)?;
|
||||||
let spec_tests = test_directory(&mut out, "spec_testsuite", strategy)?;
|
let spec_tests = test_directory(&mut out, "tests/spec_testsuite", strategy)?;
|
||||||
// Skip running spec_testsuite tests if the submodule isn't checked
|
// Skip running spec_testsuite tests if the submodule isn't checked
|
||||||
// out.
|
// out.
|
||||||
if spec_tests > 0 {
|
if spec_tests > 0 {
|
||||||
start_test_module(&mut out, "simd")?;
|
start_test_module(&mut out, "simd")?;
|
||||||
write_testsuite_tests(
|
write_testsuite_tests(
|
||||||
&mut out,
|
&mut out,
|
||||||
"spec_testsuite/proposals/simd/simd_address.wast",
|
"tests/spec_testsuite/proposals/simd/simd_address.wast",
|
||||||
"simd",
|
"simd",
|
||||||
strategy,
|
strategy,
|
||||||
)?;
|
)?;
|
||||||
write_testsuite_tests(
|
write_testsuite_tests(
|
||||||
&mut out,
|
&mut out,
|
||||||
"spec_testsuite/proposals/simd/simd_align.wast",
|
"tests/spec_testsuite/proposals/simd/simd_align.wast",
|
||||||
"simd",
|
"simd",
|
||||||
strategy,
|
strategy,
|
||||||
)?;
|
)?;
|
||||||
write_testsuite_tests(
|
write_testsuite_tests(
|
||||||
&mut out,
|
&mut out,
|
||||||
"spec_testsuite/proposals/simd/simd_const.wast",
|
"tests/spec_testsuite/proposals/simd/simd_const.wast",
|
||||||
"simd",
|
"simd",
|
||||||
strategy,
|
strategy,
|
||||||
)?;
|
)?;
|
||||||
finish_test_module(&mut out)?;
|
finish_test_module(&mut out)?;
|
||||||
|
|
||||||
test_directory(&mut out, "spec_testsuite/proposals/multi-value", strategy)
|
test_directory(
|
||||||
|
&mut out,
|
||||||
|
"tests/spec_testsuite/proposals/multi-value",
|
||||||
|
strategy,
|
||||||
|
)
|
||||||
.expect("generating tests");
|
.expect("generating tests");
|
||||||
} else {
|
} else {
|
||||||
println!("cargo:warning=The spec testsuite is disabled. To enable, run `git submodule update --remote`.");
|
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.
|
# - Check code formatting.
|
||||||
# - Make a debug build.
|
# - Make a debug build.
|
||||||
# - Make a release 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.
|
# - Build API documentation.
|
||||||
# - Optionally, run fuzzing.
|
# - Optionally, run fuzzing.
|
||||||
#
|
#
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ use std::collections::HashMap;
|
|||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use wasmtime_jit::{instantiate, CompilationStrategy, Compiler, NullResolver};
|
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.
|
/// Simple test reading a wasm-file and translating to binary representation.
|
||||||
#[test]
|
#[test]
|
||||||
|
|||||||
Reference in New Issue
Block a user