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