Convert the wast test harness into a crate.

This uses a build.rs file to collect all the wast tests and create
individual `#[test]` lines for them, so that `cargo test` can run them
in parallel.
This commit is contained in:
Dan Gohman
2018-12-03 04:19:20 -08:00
parent 4c47ce9b53
commit 83f8a31010
13 changed files with 592 additions and 291 deletions

View File

@@ -0,0 +1,22 @@
extern crate cranelift_codegen;
extern crate cranelift_native;
extern crate wasmtime_wast;
use cranelift_codegen::isa;
use cranelift_codegen::settings;
use cranelift_codegen::settings::Configurable;
use std::path::Path;
use wasmtime_wast::wast_file;
include!(concat!(env!("OUT_DIR"), "/run_wast_files.rs"));
#[cfg(test)]
fn native_isa() -> Box<isa::TargetIsa> {
let mut flag_builder = settings::builder();
flag_builder.enable("enable_verifier").unwrap();
let isa_builder = cranelift_native::builder().unwrap_or_else(|_| {
panic!("host machine is not a supported target");
});
isa_builder.finish(settings::Flags::new(flag_builder))
}