wasmer/lib/llvm-backend-tests/tests/compile.rs

41 lines
1.1 KiB
Rust
Raw Normal View History

2019-11-23 00:33:16 +00:00
use wasmer_llvm_backend_tests::{get_compiler, wat2wasm};
use wasmer_runtime::imports;
use wasmer_runtime_core::compile_with;
#[test]
fn crash_return_with_float_on_stack() {
const MODULE: &str = r#"
(module
(type (;0;) (func))
(type (;1;) (func (param f64) (result f64)))
(func $_start (type 0))
(func $fmod (type 1) (param f64) (result f64)
local.get 0
f64.const 0x0p+0 (;=0;)
f64.mul
return)
)
"#;
let wasm_binary = wat2wasm(MODULE.as_bytes()).expect("WAST not valid or malformed");
let module = compile_with(&wasm_binary, &get_compiler()).unwrap();
module.instantiate(&imports! {}).unwrap();
}
#[test]
fn crash_select_with_mismatched_pending() {
const MODULE: &str = r#"
(module
(func (param f64)
f64.const 0x0p+0 (;=0;)
local.get 0
f64.add
f64.const 0x0p+0 (;=0;)
i32.const 0
select
drop))
"#;
let wasm_binary = wat2wasm(MODULE.as_bytes()).expect("WAST not valid or malformed");
let module = compile_with(&wasm_binary, &get_compiler()).unwrap();
module.instantiate(&imports! {}).unwrap();
2019-11-23 00:33:16 +00:00
}