Skip to content

Commit

Permalink
Merge pull request rustwasm#1164 from alexcrichton/fix-tests
Browse files Browse the repository at this point in the history
Fix and execute wasm-bindgen-wasm-interpreter tests
  • Loading branch information
alexcrichton authored Jan 12, 2019
2 parents 1a10ecc + 61a6fcf commit 1289318
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 23 deletions.
5 changes: 4 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,10 @@ matrix:
- 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)
- 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

# Dist linux binary
Expand Down
44 changes: 22 additions & 22 deletions crates/wasm-interpreter/tests/smoke.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ fn interpret(wat: &str, name: &str, result: Option<&[u32]>) {
assert!(status.success());
let module = parity_wasm::deserialize_file(output.path()).unwrap();
let mut i = Interpreter::new(&module);
assert_eq!(i.interpret(name, &module), result);
assert_eq!(i.interpret_descriptor(name, &module), result);
}

#[test]
Expand Down Expand Up @@ -62,8 +62,8 @@ fn locals() {
(func $foo
(local i32)
i32.const 2
set_local 0
get_local 0
local.set 0
local.get 0
call $__wbindgen_describe
)
Expand All @@ -80,16 +80,16 @@ fn globals() {
(import "__wbindgen_placeholder__" "__wbindgen_describe"
(func $__wbindgen_describe (param i32)))
(global i32 (i32.const 0))
(global (mut i32) (i32.const 0))
(func $foo
(local i32)
get_global 0
set_local 0
get_local 0
global.get 0
local.set 0
local.get 0
call $__wbindgen_describe
get_local 0
set_global 0
local.get 0
global.set 0
)
(export "foo" (func $foo))
Expand Down Expand Up @@ -149,56 +149,56 @@ fn loads_and_stores() {
(import "__wbindgen_placeholder__" "__wbindgen_describe"
(func $__wbindgen_describe (param i32)))
(global i32 (i32.const 0))
(global (mut i32) (i32.const 0))
(memory 1)
(func $foo
(local i32)
;; decrement the stack pointer, setting our local to the
;; lowest address of our stack
get_global 0
global.get 0
i32.const 16
i32.sub
set_local 0
get_local 0
set_global 0
local.set 0
local.get 0
global.set 0
;; store 1 at fp+0
get_local 0
local.get 0
i32.const 1
i32.store offset=0
;; store 2 at fp+4
get_local 0
local.get 0
i32.const 2
i32.store offset=4
;; store 3 at fp+8
get_local 0
local.get 0
i32.const 3
i32.store offset=8
;; load fp+0 and call
get_local 0
local.get 0
i32.load offset=0
call $__wbindgen_describe
;; load fp+4 and call
get_local 0
local.get 0
i32.load offset=4
call $__wbindgen_describe
;; load fp+8 and call
get_local 0
local.get 0
i32.load offset=8
call $__wbindgen_describe
;; increment our stack pointer
get_local 0
local.get 0
i32.const 16
i32.add
set_global 0
global.set 0
)
(export "foo" (func $foo))
Expand Down

0 comments on commit 1289318

Please sign in to comment.