Merge pull request #1164 from alexcrichton/fix-tests

Fix and execute wasm-bindgen-wasm-interpreter tests
This commit is contained in:
Alex Crichton 2019-01-11 18:45:47 -08:00 committed by GitHub
commit 12893183b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 26 additions and 23 deletions

View File

@ -179,7 +179,10 @@ matrix:
- mkdir -p wabt/build - mkdir -p wabt/build
- (cd wabt/build && cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER=sccache -DCMAKE_CXX_COMPILER_ARG1=c++ -DBUILD_TESTS=OFF && cmake --build . -- -j4) - (cd wabt/build && cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER=sccache -DCMAKE_CXX_COMPILER_ARG1=c++ -DBUILD_TESTS=OFF && cmake --build . -- -j4)
- export PATH=$PATH:`pwd`/wabt/build - export PATH=$PATH:`pwd`/wabt/build
script: cargo test -p wasm-bindgen-gc script:
- cargo test -p wasm-bindgen-gc
# Interpreter tests should quickly pass
- cargo test -p wasm-bindgen-wasm-interpreter
if: branch = master if: branch = master
# Dist linux binary # Dist linux binary

View File

@ -21,7 +21,7 @@ fn interpret(wat: &str, name: &str, result: Option<&[u32]>) {
assert!(status.success()); assert!(status.success());
let module = parity_wasm::deserialize_file(output.path()).unwrap(); let module = parity_wasm::deserialize_file(output.path()).unwrap();
let mut i = Interpreter::new(&module); let mut i = Interpreter::new(&module);
assert_eq!(i.interpret(name, &module), result); assert_eq!(i.interpret_descriptor(name, &module), result);
} }
#[test] #[test]
@ -62,8 +62,8 @@ fn locals() {
(func $foo (func $foo
(local i32) (local i32)
i32.const 2 i32.const 2
set_local 0 local.set 0
get_local 0 local.get 0
call $__wbindgen_describe call $__wbindgen_describe
) )
@ -80,16 +80,16 @@ fn globals() {
(import "__wbindgen_placeholder__" "__wbindgen_describe" (import "__wbindgen_placeholder__" "__wbindgen_describe"
(func $__wbindgen_describe (param i32))) (func $__wbindgen_describe (param i32)))
(global i32 (i32.const 0)) (global (mut i32) (i32.const 0))
(func $foo (func $foo
(local i32) (local i32)
get_global 0 global.get 0
set_local 0 local.set 0
get_local 0 local.get 0
call $__wbindgen_describe call $__wbindgen_describe
get_local 0 local.get 0
set_global 0 global.set 0
) )
(export "foo" (func $foo)) (export "foo" (func $foo))
@ -149,7 +149,7 @@ fn loads_and_stores() {
(import "__wbindgen_placeholder__" "__wbindgen_describe" (import "__wbindgen_placeholder__" "__wbindgen_describe"
(func $__wbindgen_describe (param i32))) (func $__wbindgen_describe (param i32)))
(global i32 (i32.const 0)) (global (mut i32) (i32.const 0))
(memory 1) (memory 1)
(func $foo (func $foo
@ -157,48 +157,48 @@ fn loads_and_stores() {
;; decrement the stack pointer, setting our local to the ;; decrement the stack pointer, setting our local to the
;; lowest address of our stack ;; lowest address of our stack
get_global 0 global.get 0
i32.const 16 i32.const 16
i32.sub i32.sub
set_local 0 local.set 0
get_local 0 local.get 0
set_global 0 global.set 0
;; store 1 at fp+0 ;; store 1 at fp+0
get_local 0 local.get 0
i32.const 1 i32.const 1
i32.store offset=0 i32.store offset=0
;; store 2 at fp+4 ;; store 2 at fp+4
get_local 0 local.get 0
i32.const 2 i32.const 2
i32.store offset=4 i32.store offset=4
;; store 3 at fp+8 ;; store 3 at fp+8
get_local 0 local.get 0
i32.const 3 i32.const 3
i32.store offset=8 i32.store offset=8
;; load fp+0 and call ;; load fp+0 and call
get_local 0 local.get 0
i32.load offset=0 i32.load offset=0
call $__wbindgen_describe call $__wbindgen_describe
;; load fp+4 and call ;; load fp+4 and call
get_local 0 local.get 0
i32.load offset=4 i32.load offset=4
call $__wbindgen_describe call $__wbindgen_describe
;; load fp+8 and call ;; load fp+8 and call
get_local 0 local.get 0
i32.load offset=8 i32.load offset=8
call $__wbindgen_describe call $__wbindgen_describe
;; increment our stack pointer ;; increment our stack pointer
get_local 0 local.get 0
i32.const 16 i32.const 16
i32.add i32.add
set_global 0 global.set 0
) )
(export "foo" (func $foo)) (export "foo" (func $foo))