wasmer/tests/spectest.rs

25 lines
698 B
Rust

mod utils;
use std::path::Path;
use wasmer_wast::Wast;
// The generated tests (from build.rs) look like:
// #[cfg(test)]
// mod singlepass {
// mod spec {
// #[test]
// fn address() -> anyhow::Result<()> {
// crate::run_wast("tests/spectests/address.wast", "singlepass")
// }
// }
// }
include!(concat!(env!("OUT_DIR"), "/generated_spectests.rs"));
fn run_wast(wast_path: &str, backend: &str) -> anyhow::Result<()> {
println!("Running wast {} with {}", wast_path, backend);
let backend = utils::get_backend_from_str(backend)?;
let mut wast = Wast::new_with_spectest(backend);
let path = Path::new(wast_path);
wast.run_file(path)
}