Files
wasmtime/tests/all/main.rs
Andrew Brown ad584f428a wasi-threads: run test suite (#5907)
* wasi-threads: run test suite

This change enables the running of the wasi-threads [test suite]. It
relies on a Wasmtime CLI binary being available and runs all `*.wasm`
and `*.wat` files present in the test suite directory. The results of
each execution are compared against a JSON spec file with the same base
name as the WebAssembly module. The spec file defines the expected exit
code, e.g.

This commit does not yet build any `*.c` or `*.s` files from the test
suite. That could be done later, perhaps upstream; in the meantime, this
work is still valuable as it lays the foundation for running other WASI
tests from the in-progress [wasi-testsuite] which share the same JSON
spec infrastructure.

[test suite]: https://github.com/WebAssembly/wasi-threads/tree/main/test/testsuite
[wasi-testsuite]: https://github.com/WebAssembly/wasi-testsuite

* review: move testsuite to top-level tests

* fix: remove now-unnecessary wasi-threads test

* fix: update testsuite submodule name

* fix: ignore tests on Windows

prtest:full

* fix: `cfg_attr` syntax

prtest:full
2023-03-04 21:50:15 +00:00

71 lines
1.6 KiB
Rust

mod async_functions;
mod call_hook;
mod cli_tests;
mod component_model;
mod custom_signal_handler;
mod debug;
mod epoch_interruption;
mod externals;
mod fuel;
mod func;
mod funcref;
mod gc;
mod globals;
mod host_funcs;
mod iloop;
mod import_calling_export;
mod import_indexes;
mod instance;
mod invoke_func_via_table;
mod limits;
mod linker;
mod memory;
mod memory_creator;
mod module;
mod module_serialize;
mod name;
mod pooling_allocator;
mod relocs;
mod stack_overflow;
mod store;
mod table;
mod threads;
mod traps;
mod wait_notify;
mod wasi_testsuite;
mod wast;
/// A helper to compile a module in a new store with reference types enabled.
pub(crate) fn ref_types_module(
use_epochs: bool,
source: &str,
) -> anyhow::Result<(wasmtime::Store<()>, wasmtime::Module)> {
use wasmtime::*;
let _ = env_logger::try_init();
let mut config = Config::new();
config.wasm_reference_types(true);
if use_epochs {
config.epoch_interruption(true);
}
let engine = Engine::new(&config)?;
let mut store = Store::new(&engine, ());
if use_epochs {
store.set_epoch_deadline(1);
}
let module = Module::new(&engine, source)?;
Ok((store, module))
}
/// A helper determining whether the pooling allocator tests should be skipped.
pub(crate) fn skip_pooling_allocator_tests() -> bool {
// There are a couple of issues when running the pooling allocator tests under QEMU:
// - high memory usage that may exceed the limits imposed by the environment (e.g. CI)
// - https://github.com/bytecodealliance/wasmtime/pull/2518#issuecomment-747280133
std::env::var("WASMTIME_TEST_NO_HOG_MEMORY").is_ok()
}