* Update cranelift to 0.58.0 * Update `wasmprinter` dep to require 0.2.1 We already had it in the lock file, but this ensures we won't ever go back down. * Ensure that our error messages match `assert_invalid`'s The bulk of this work was done in https://github.com/bytecodealliance/wasmparser/pull/186 but now we can test it at the `wasmtime` level as well. Fixes #492 * Stop feeling guilty about not matching `assert_malformed` messages Remove the "TODO" and stop printing warning messages. These would just be busy work to implement, and getting all the messages the exact same relies on using the same structure as the spec interpreter's parser, which means that where you have a helper function and they don't, then things go wrong, and vice versa. Not worth it. Fixes #492 * Enable (but ignore) the reference-types proposal tests * Match test suite directly, instead of roundabout starts/endswith * Enable (but ignore) bulk memory operations proposal test suite
33 lines
1.1 KiB
Rust
33 lines
1.1 KiB
Rust
use std::path::Path;
|
|
use wasmtime::{Config, Engine, Store, Strategy};
|
|
use wasmtime_wast::WastContext;
|
|
|
|
include!(concat!(env!("OUT_DIR"), "/wast_testsuite_tests.rs"));
|
|
|
|
// Each of the tests included from `wast_testsuite_tests` will call this
|
|
// function which actually executes the `wast` test suite given the `strategy`
|
|
// to compile it.
|
|
fn run_wast(wast: &str, strategy: Strategy) -> anyhow::Result<()> {
|
|
let wast = Path::new(wast);
|
|
|
|
let simd = wast.iter().any(|s| s == "simd");
|
|
|
|
// Some simd tests assume support for multiple tables, which are introduced
|
|
// by reference types.
|
|
let reftypes = simd || wast.iter().any(|s| s == "reference-types");
|
|
|
|
let multi_val = wast.iter().any(|s| s == "multi-value");
|
|
|
|
let mut cfg = Config::new();
|
|
cfg.wasm_simd(simd)
|
|
.wasm_reference_types(reftypes)
|
|
.wasm_multi_value(multi_val)
|
|
.strategy(strategy)?
|
|
.cranelift_debug_verifier(true);
|
|
let store = Store::new(&Engine::new(&cfg));
|
|
let mut wast_context = WastContext::new(store);
|
|
wast_context.register_spectest()?;
|
|
wast_context.run_file(wast)?;
|
|
Ok(())
|
|
}
|