Reorganize tests.
- Move spec_testsuite and misc_testsuite under the tests directory. - Remove some redundant tests from filetests. - Move wat tests to wat/tests.
This commit is contained in:
@@ -8,7 +8,7 @@ use std::collections::HashMap;
|
||||
use std::path::PathBuf;
|
||||
use wasmtime_jit::{instantiate, CompilationStrategy, Compiler, NullResolver};
|
||||
|
||||
const PATH_MODULE_RS2WASM_ADD_FUNC: &str = r"filetests/rs2wasm-add-func.wat";
|
||||
const PATH_MODULE_RS2WASM_ADD_FUNC: &str = r"tests/wat/rs2wasm-add-func.wat";
|
||||
|
||||
/// Simple test reading a wasm-file and translating to binary representation.
|
||||
#[test]
|
||||
|
||||
67
tests/misc_testsuite/misc_traps.wast
Normal file
67
tests/misc_testsuite/misc_traps.wast
Normal file
@@ -0,0 +1,67 @@
|
||||
(module
|
||||
(memory 1 1)
|
||||
(func (export "load_oob")
|
||||
i32.const 65536
|
||||
i32.load
|
||||
drop
|
||||
)
|
||||
)
|
||||
|
||||
(assert_trap (invoke "load_oob") "out of bounds memory access")
|
||||
(assert_trap (invoke "load_oob") "out of bounds memory access")
|
||||
|
||||
(module
|
||||
(memory 1 1)
|
||||
(func (export "store_oob")
|
||||
i32.const 65536
|
||||
i32.const 65536
|
||||
i32.store
|
||||
)
|
||||
)
|
||||
|
||||
(assert_trap (invoke "store_oob") "out of bounds memory access")
|
||||
(assert_trap (invoke "store_oob") "out of bounds memory access")
|
||||
|
||||
(module
|
||||
(memory 0 0)
|
||||
(func (export "load_oob_0")
|
||||
i32.const 0
|
||||
i32.load
|
||||
drop
|
||||
)
|
||||
)
|
||||
|
||||
(assert_trap (invoke "load_oob_0") "out of bounds memory access")
|
||||
(assert_trap (invoke "load_oob_0") "out of bounds memory access")
|
||||
|
||||
(module
|
||||
(memory 0 0)
|
||||
(func (export "store_oob_0")
|
||||
i32.const 0
|
||||
i32.const 0
|
||||
i32.store
|
||||
)
|
||||
)
|
||||
|
||||
(assert_trap (invoke "store_oob_0") "out of bounds memory access")
|
||||
(assert_trap (invoke "store_oob_0") "out of bounds memory access")
|
||||
|
||||
(module
|
||||
(func (export "divbyzero") (result i32)
|
||||
i32.const 1
|
||||
i32.const 0
|
||||
i32.div_s
|
||||
)
|
||||
)
|
||||
|
||||
(assert_trap (invoke "divbyzero") "integer divide by zero")
|
||||
(assert_trap (invoke "divbyzero") "integer divide by zero")
|
||||
|
||||
(module
|
||||
(func (export "unreachable")
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
|
||||
(assert_trap (invoke "unreachable") "unreachable")
|
||||
(assert_trap (invoke "unreachable") "unreachable")
|
||||
26
tests/misc_testsuite/stack_overflow.wast
Normal file
26
tests/misc_testsuite/stack_overflow.wast
Normal file
@@ -0,0 +1,26 @@
|
||||
(module
|
||||
(func $foo
|
||||
(call $foo)
|
||||
)
|
||||
(func (export "stack_overflow")
|
||||
(call $foo)
|
||||
)
|
||||
)
|
||||
|
||||
(assert_exhaustion (invoke "stack_overflow") "call stack exhausted")
|
||||
(assert_exhaustion (invoke "stack_overflow") "call stack exhausted")
|
||||
|
||||
(module
|
||||
(func $foo
|
||||
(call $bar)
|
||||
)
|
||||
(func $bar
|
||||
(call $foo)
|
||||
)
|
||||
(func (export "stack_overflow")
|
||||
(call $foo)
|
||||
)
|
||||
)
|
||||
|
||||
(assert_exhaustion (invoke "stack_overflow") "call stack exhausted")
|
||||
(assert_exhaustion (invoke "stack_overflow") "call stack exhausted")
|
||||
1
tests/spec_testsuite
Submodule
1
tests/spec_testsuite
Submodule
Submodule tests/spec_testsuite added at 78d896f088
20
tests/wat/rs2wasm-add-func.wat
Normal file
20
tests/wat/rs2wasm-add-func.wat
Normal file
@@ -0,0 +1,20 @@
|
||||
(module
|
||||
(type (;0;) (func))
|
||||
(type (;1;) (func (param i32 i32) (result i32)))
|
||||
(func $add (type 1) (param i32 i32) (result i32)
|
||||
get_local 1
|
||||
get_local 0
|
||||
i32.add)
|
||||
(func $start (type 0))
|
||||
(table (;0;) 1 1 anyfunc)
|
||||
(memory (;0;) 17)
|
||||
(global (;0;) i32 (i32.const 1049114))
|
||||
(global (;1;) i32 (i32.const 1049114))
|
||||
(export "memory" (memory 0))
|
||||
(export "__indirect_function_table" (table 0))
|
||||
(export "__heap_base" (global 0))
|
||||
(export "__data_end" (global 1))
|
||||
(export "add" (func $add))
|
||||
(export "start" (func $start))
|
||||
(data (i32.const 1048576) "\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00")
|
||||
(data (i32.const 1049092) "invalid malloc request"))
|
||||
Reference in New Issue
Block a user