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