Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix and execute wasm-bindgen-wasm-interpreter tests #1164

Merged
merged 1 commit into from
Jan 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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