Skip to content

Commit

Permalink
Reorganize tests.
Browse files Browse the repository at this point in the history
 - Move spec_testsuite and misc_testsuite under the tests directory.
 - Remove some redundant tests from filetests.
 - Move wat tests to wat/tests.
  • Loading branch information
sunfishcode committed Nov 8, 2019
1 parent 32a71c0 commit b158666
Show file tree
Hide file tree
Showing 14 changed files with 16 additions and 59 deletions.
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
18 changes: 11 additions & 7 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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`.");
}
Expand Down
9 changes: 0 additions & 9 deletions filetests/trap_bounds.wat

This file was deleted.

11 changes: 0 additions & 11 deletions filetests/trap_divbyzero.wat

This file was deleted.

9 changes: 0 additions & 9 deletions filetests/trap_empty_mem.wat

This file was deleted.

9 changes: 0 additions & 9 deletions filetests/trap_stackoverflow.wat

This file was deleted.

9 changes: 0 additions & 9 deletions filetests/trap_unreachable.wat

This file was deleted.

2 changes: 1 addition & 1 deletion scripts/test-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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.
#
Expand Down
2 changes: 1 addition & 1 deletion tests/instantiate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit b158666

Please sign in to comment.