mirror of
https://github.com/fluencelabs/wasmer
synced 2024-12-13 06:15:33 +00:00
Setup the spectests lib to use llvm-backend
This commit is contained in:
parent
51c9091fc5
commit
b80252e165
1
Cargo.lock
generated
1
Cargo.lock
generated
@ -1273,6 +1273,7 @@ version = "0.1.2"
|
||||
dependencies = [
|
||||
"wabt 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"wasmer-clif-backend 0.1.2",
|
||||
"wasmer-llvm-backend 0.1.0",
|
||||
"wasmer-runtime-core 0.1.2",
|
||||
]
|
||||
|
||||
|
@ -1,9 +1,4 @@
|
||||
use crate::{
|
||||
memory::MemoryType,
|
||||
module::ModuleInfo,
|
||||
structures::TypedIndex,
|
||||
units::Pages,
|
||||
};
|
||||
use crate::{memory::MemoryType, module::ModuleInfo, structures::TypedIndex, units::Pages};
|
||||
use std::{borrow::Cow, mem};
|
||||
|
||||
/// Represents a WebAssembly type.
|
||||
|
@ -16,6 +16,7 @@ wabt = "0.7.2"
|
||||
|
||||
[dev-dependencies]
|
||||
wasmer-clif-backend = { path = "../clif-backend", version = "0.1.2" }
|
||||
wasmer-llvm-backend = { path = "../llvm-backend", version = "0.1.0" }
|
||||
wabt = "0.7.2"
|
||||
|
||||
[features]
|
||||
|
@ -78,6 +78,7 @@ static COMMON: &'static str = r##"
|
||||
use std::{{f32, f64}};
|
||||
use wabt::wat2wasm;
|
||||
use wasmer_clif_backend::CraneliftCompiler;
|
||||
use wasmer_llvm_backend::LLVMCompiler;
|
||||
use wasmer_runtime_core::import::ImportObject;
|
||||
use wasmer_runtime_core::types::Value;
|
||||
use wasmer_runtime_core::{{Instance, module::Module}};
|
||||
@ -97,7 +98,7 @@ static IMPORT_MODULE: &str = r#"
|
||||
|
||||
pub fn generate_imports() -> ImportObject {
|
||||
let wasm_binary = wat2wasm(IMPORT_MODULE.as_bytes()).expect("WAST not valid or malformed");
|
||||
let module = wasmer_runtime_core::compile_with(&wasm_binary[..], &CraneliftCompiler::new())
|
||||
let module = wasmer_runtime_core::compile_with(&wasm_binary[..], &LLVMCompiler::new())
|
||||
.expect("WASM can't be compiled");
|
||||
let instance = module
|
||||
.instantiate(&ImportObject::new())
|
||||
@ -358,7 +359,7 @@ fn test_module_{}() {{
|
||||
let module_str = \"{}\";
|
||||
println!(\"{{}}\", module_str);
|
||||
let wasm_binary = wat2wasm(module_str.as_bytes()).expect(\"WAST not valid or malformed\");
|
||||
let module = wasmer_runtime_core::compile_with(&wasm_binary[..], &CraneliftCompiler::new()).expect(\"WASM can't be compiled\");
|
||||
let module = wasmer_runtime_core::compile_with(&wasm_binary[..], &LLVMCompiler::new()).expect(\"WASM can't be compiled\");
|
||||
module.instantiate(&generate_imports()).expect(\"WASM can't be instantiated\")
|
||||
}}\n",
|
||||
self.last_module,
|
||||
@ -381,7 +382,7 @@ fn test_module_{}() {{
|
||||
"#[test]
|
||||
fn {}_assert_invalid() {{
|
||||
let wasm_binary = {:?};
|
||||
let module = wasmer_runtime_core::compile_with(&wasm_binary, &CraneliftCompiler::new());
|
||||
let module = wasmer_runtime_core::compile_with(&wasm_binary, &LLVMCompiler::new());
|
||||
assert!(module.is_err(), \"WASM should not compile as is invalid\");
|
||||
}}\n",
|
||||
command_name,
|
||||
@ -512,7 +513,7 @@ fn {}_assert_invalid() {{
|
||||
"#[test]
|
||||
fn {}_assert_malformed() {{
|
||||
let wasm_binary = {:?};
|
||||
let compilation = wasmer_runtime_core::compile_with(&wasm_binary, &CraneliftCompiler::new());
|
||||
let compilation = wasmer_runtime_core::compile_with(&wasm_binary, &LLVMCompiler::new());
|
||||
assert!(compilation.is_err(), \"WASM should not compile as is malformed\");
|
||||
}}\n",
|
||||
command_name,
|
||||
|
Loading…
Reference in New Issue
Block a user