wasmer/tests/spectest.rs

25 lines
698 B
Rust
Raw Permalink Normal View History

2020-04-15 23:31:05 +00:00
mod utils;
2020-04-14 18:41:12 +00:00
use std::path::Path;
use wasmer_wast::Wast;
2020-04-15 23:31:05 +00:00
// The generated tests (from build.rs) look like:
2020-04-14 18:41:12 +00:00
// #[cfg(test)]
2020-04-15 23:31:05 +00:00
// mod singlepass {
// mod spec {
2020-04-14 18:41:12 +00:00
// #[test]
2020-04-15 23:31:05 +00:00
// fn address() -> anyhow::Result<()> {
// crate::run_wast("tests/spectests/address.wast", "singlepass")
2020-04-14 18:41:12 +00:00
// }
// }
// }
2020-04-15 23:31:05 +00:00
include!(concat!(env!("OUT_DIR"), "/generated_spectests.rs"));
2020-04-14 18:41:12 +00:00
fn run_wast(wast_path: &str, backend: &str) -> anyhow::Result<()> {
2020-04-15 23:31:05 +00:00
println!("Running wast {} with {}", wast_path, backend);
let backend = utils::get_backend_from_str(backend)?;
2020-04-14 18:41:12 +00:00
let mut wast = Wast::new_with_spectest(backend);
let path = Path::new(wast_path);
wast.run_file(path)
2019-07-26 03:31:19 +00:00
}