summaryrefslogtreecommitdiff
path: root/test/interp
diff options
context:
space:
mode:
authorBen Smith <binjimin@gmail.com>2016-06-24 13:46:22 -0700
committerGitHub <noreply@github.com>2016-06-24 13:46:22 -0700
commit35600ece919c127db39e625be103a149746fb7b1 (patch)
tree7d981fbc79fd5a7aaf26bebcd0c393892593f9d2 /test/interp
parentbb66db55c1767cb0cded918ef530f38aa956ffe9 (diff)
downloadwabt-35600ece919c127db39e625be103a149746fb7b1.tar.gz
wabt-35600ece919c127db39e625be103a149746fb7b1.tar.bz2
wabt-35600ece919c127db39e625be103a149746fb7b1.zip
Update testsuite, and fix tests (#90)
* Modify AST parser to disallow any other order than `param`, `result`, `local`. * Allow parsing all var integers as int64 (the lookups will fail later.) * Fix interpreter logic determining whether to adjust the stack; we were correctly handling the case where `unreachable` was being used in an expression (the value stack is adjusted "up" as if a value was actually produced), but the same behavior is required for `br`, `br_table` and `return`. * Add NAT token to lexer/parser, which is an integer value without a sign.
Diffstat (limited to 'test/interp')
-rw-r--r--test/interp/spec/block.txt92
-rw-r--r--test/interp/spec/br.txt25
-rw-r--r--test/interp/spec/br_if.txt93
-rw-r--r--test/interp/spec/br_table.txt69
-rw-r--r--test/interp/spec/call.txt73
-rw-r--r--test/interp/spec/call_indirect.txt81
-rw-r--r--test/interp/spec/func-local-after-body.fail.txt10
-rw-r--r--test/interp/spec/func-local-before-param.fail.txt10
-rw-r--r--test/interp/spec/func-local-before-result.fail.txt10
-rw-r--r--test/interp/spec/func-param-after-body.fail.txt10
-rw-r--r--test/interp/spec/func-result-after-body.fail.txt10
-rw-r--r--test/interp/spec/func-result-before-param.fail.txt10
-rw-r--r--test/interp/spec/if_label_scope.fail.txt10
-rw-r--r--test/interp/spec/int_literals.txt2
-rw-r--r--test/interp/spec/loop.txt73
-rw-r--r--test/interp/spec/nop.txt20
-rw-r--r--test/interp/spec/return.txt13
-rw-r--r--test/interp/spec/set_local.txt97
-rw-r--r--test/interp/spec/unreachable.txt2
19 files changed, 680 insertions, 30 deletions
diff --git a/test/interp/spec/block.txt b/test/interp/spec/block.txt
index 27ae6a68..791b1818 100644
--- a/test/interp/spec/block.txt
+++ b/test/interp/spec/block.txt
@@ -2,36 +2,80 @@
;;; STDIN_FILE: third_party/testsuite/block.wast
(;; STDOUT ;;;
assert_invalid error:
- third_party/testsuite/block.wast:134:30: type mismatch of block. got void, expected i32
- (module (func (result i32) (block)))
- ^
+ third_party/testsuite/block.wast:153:46: type mismatch of block. got void, expected i32
+ (module (func $type-empty-i32 (result i32) (block)))
+ ^
assert_invalid error:
- third_party/testsuite/block.wast:138:37: type mismatch in nop. got void, expected i32
- (module (func (result i32) (block (nop))))
- ^
+ third_party/testsuite/block.wast:157:46: type mismatch of block. got void, expected i64
+ (module (func $type-empty-i64 (result i64) (block)))
+ ^
assert_invalid error:
- third_party/testsuite/block.wast:142:37: type mismatch of block. got f32, expected i32
- (module (func (result i32) (block (f32.const 0))))
- ^
+ third_party/testsuite/block.wast:161:46: type mismatch of block. got void, expected f32
+ (module (func $type-empty-f32 (result f32) (block)))
+ ^
assert_invalid error:
- third_party/testsuite/block.wast:146:37: type mismatch of br value. got void, expected i32
- (module (func (result i32) (block (br 0) (i32.const 1))))
- ^
+ third_party/testsuite/block.wast:165:46: type mismatch of block. got void, expected f64
+ (module (func $type-empty-f64 (result f64) (block)))
+ ^
+assert_invalid error:
+ third_party/testsuite/block.wast:171:12: type mismatch in nop. got void, expected i32
+ (block (nop))
+ ^
+assert_invalid error:
+ third_party/testsuite/block.wast:177:12: type mismatch of block. got f32, expected i32
+ (block (f32.const 0))
+ ^
+assert_invalid error:
+ third_party/testsuite/block.wast:183:33: type mismatch in nop. got void, expected i32
+ (block (br 0 (i32.const 1)) (nop))
+ ^
+assert_invalid error:
+ third_party/testsuite/block.wast:189:33: type mismatch of block. got f32, expected i32
+ (block (br 0 (i32.const 1)) (f32.const 0))
+ ^
+assert_invalid error:
+ third_party/testsuite/block.wast:196:12: type mismatch of br value. got void, expected i32
+ (block (br 0))
+ ^
assert_invalid error:
- third_party/testsuite/block.wast:150:58: type mismatch in nop. got void, expected i32
- (module (func (result i32) (block (br 0 (i32.const 1)) (nop))))
- ^
+ third_party/testsuite/block.wast:202:12: type mismatch of br value. got void, expected i32
+ (block (br 0) (i32.const 1))
+ ^
assert_invalid error:
- third_party/testsuite/block.wast:154:43: type mismatch of br value. got i64, expected i32
- (module (func (result i32) (block (br 0 (i64.const 1)) (i32.const 1))))
- ^
+ third_party/testsuite/block.wast:208:18: type mismatch of br value. got i64, expected i32
+ (block (br 0 (i64.const 1)) (i32.const 1))
+ ^
assert_invalid error:
- third_party/testsuite/block.wast:158:43: type mismatch of br value. got i64, expected i32
- (module (func (result i32) (block (br 0 (i64.const 1)) (br 0 (i32.const 1)))))
- ^
+ third_party/testsuite/block.wast:214:18: type mismatch of br value. got i64, expected i32
+ (block (br 0 (i64.const 1)) (br 0 (i32.const 1)))
+ ^
+assert_invalid error:
+ third_party/testsuite/block.wast:220:39: type mismatch of br value. got f64, expected i32
+ (block (br 0 (i32.const 1)) (br 0 (f64.const 1)))
+ ^
+assert_invalid error:
+ third_party/testsuite/block.wast:227:19: type mismatch of br value. got void, expected i32
+ (block (block (br 1)) (br 0 (i32.const 1)))
+ ^
+assert_invalid error:
+ third_party/testsuite/block.wast:233:25: type mismatch of br value. got i64, expected i32
+ (block (block (br 1 (i64.const 1))) (br 0 (i32.const 1)))
+ ^
+assert_invalid error:
+ third_party/testsuite/block.wast:239:21: type mismatch of br value. got void, expected i32
+ (i32.ctz (block (br 0)))
+ ^
+assert_invalid error:
+ third_party/testsuite/block.wast:245:5: type mismatch of function result. got i64, expected i32
+ (i64.ctz (block (br 0 (i64.const 9))))
+ ^
+assert_invalid error:
+ third_party/testsuite/block.wast:250:37: type mismatch of br value. got void, expected i32
+ (module (func (result i32) (block (br 0))))
+ ^
assert_invalid error:
- third_party/testsuite/block.wast:162:50: type mismatch of br value. got i64, expected i32
-...func (result i32) (block (block (br 1 (i64.const 1))) (br 0 (i32.const 1)))))
- ^
+ third_party/testsuite/block.wast:254:46: type mismatch of br value. got void, expected i32
+ (module (func (result i32) (i32.ctz (block (br 0)))))
+ ^
19/19 tests passed.
;;; STDOUT ;;)
diff --git a/test/interp/spec/br.txt b/test/interp/spec/br.txt
new file mode 100644
index 00000000..b1147031
--- /dev/null
+++ b/test/interp/spec/br.txt
@@ -0,0 +1,25 @@
+;;; TOOL: run-interp-spec
+;;; STDIN_FILE: third_party/testsuite/br.wast
+(;; STDOUT ;;;
+assert_invalid error:
+ third_party/testsuite/br.wast:342:12: type mismatch of br value. got void, expected i32
+ (block (br 0) (i32.const 1))
+ ^
+assert_invalid error:
+ third_party/testsuite/br.wast:348:18: type mismatch of br value. got i64, expected i32
+ (block (br 0 (i64.const 1)) (i32.const 1))
+ ^
+assert_invalid error:
+ third_party/testsuite/br.wast:354:36: label variable out of range (max 0)
+ (module (func $unbound-label (br 1)))
+ ^
+assert_invalid error:
+ third_party/testsuite/br.wast:358:57: label variable out of range (max 2)
+ (module (func $unbound-nested-label (block (block (br 5)))))
+ ^
+assert_invalid error:
+ third_party/testsuite/br.wast:362:34: label variable out of range (max 0)
+ (module (func $large-label (br 0x100000001)))
+ ^^^^^^^^^^^
+64/64 tests passed.
+;;; STDOUT ;;)
diff --git a/test/interp/spec/br_if.txt b/test/interp/spec/br_if.txt
new file mode 100644
index 00000000..70aad2c3
--- /dev/null
+++ b/test/interp/spec/br_if.txt
@@ -0,0 +1,93 @@
+;;; TOOL: run-interp-spec
+;;; STDIN_FILE: third_party/testsuite/br_if.wast
+(;; STDOUT ;;;
+assert_invalid error:
+ third_party/testsuite/br_if.wast:196:49: type mismatch of unary op. got void, expected i32
+ (module (func $type-false-i32 (block (i32.ctz (br_if 0 (i32.const 0))))))
+ ^
+assert_invalid error:
+ third_party/testsuite/br_if.wast:200:49: type mismatch of unary op. got void, expected i64
+ (module (func $type-false-i64 (block (i64.ctz (br_if 0 (i32.const 0))))))
+ ^
+assert_invalid error:
+ third_party/testsuite/br_if.wast:204:49: type mismatch of unary op. got void, expected f32
+ (module (func $type-false-f32 (block (f32.neg (br_if 0 (i32.const 0))))))
+ ^
+assert_invalid error:
+ third_party/testsuite/br_if.wast:208:49: type mismatch of unary op. got void, expected f64
+ (module (func $type-false-f64 (block (f64.neg (br_if 0 (i32.const 0))))))
+ ^
+assert_invalid error:
+ third_party/testsuite/br_if.wast:213:48: type mismatch of unary op. got void, expected i32
+ (module (func $type-true-i32 (block (i32.ctz (br_if 0 (i32.const 1))))))
+ ^
+assert_invalid error:
+ third_party/testsuite/br_if.wast:217:48: type mismatch of unary op. got void, expected i64
+ (module (func $type-true-i64 (block (i64.ctz (br_if 0 (i64.const 1))))))
+ ^
+assert_invalid error:
+ third_party/testsuite/br_if.wast:217:57: type mismatch of br_if condition. got i64, expected i32
+ (module (func $type-true-i64 (block (i64.ctz (br_if 0 (i64.const 1))))))
+ ^
+assert_invalid error:
+ third_party/testsuite/br_if.wast:221:48: type mismatch of unary op. got void, expected f32
+ (module (func $type-true-f32 (block (f32.neg (br_if 0 (f32.const 1))))))
+ ^
+assert_invalid error:
+ third_party/testsuite/br_if.wast:221:57: type mismatch of br_if condition. got f32, expected i32
+ (module (func $type-true-f32 (block (f32.neg (br_if 0 (f32.const 1))))))
+ ^
+assert_invalid error:
+ third_party/testsuite/br_if.wast:225:48: type mismatch of unary op. got void, expected f64
+ (module (func $type-true-f64 (block (f64.neg (br_if 0 (i64.const 1))))))
+ ^
+assert_invalid error:
+ third_party/testsuite/br_if.wast:225:57: type mismatch of br_if condition. got i64, expected i32
+ (module (func $type-true-f64 (block (f64.neg (br_if 0 (i64.const 1))))))
+ ^
+assert_invalid error:
+ third_party/testsuite/br_if.wast:231:12: type mismatch of br_if value. got void, expected i32
+ (block (br_if 0 (i32.const 0)) (i32.const 1))
+ ^
+assert_invalid error:
+ third_party/testsuite/br_if.wast:237:12: type mismatch of br_if value. got void, expected i32
+ (block (br_if 0 (i32.const 1)) (i32.const 1))
+ ^
+assert_invalid error:
+ third_party/testsuite/br_if.wast:243:21: type mismatch of br_if value. got i64, expected i32
+ (block (br_if 0 (i64.const 1) (i32.const 0)) (i32.const 1))
+ ^
+assert_invalid error:
+ third_party/testsuite/br_if.wast:249:21: type mismatch of br_if value. got i64, expected i32
+ (block (br_if 0 (i64.const 1) (i32.const 0)) (i32.const 1))
+ ^
+assert_invalid error:
+ third_party/testsuite/br_if.wast:256:21: type mismatch in nop. got void, expected i32
+ (block (br_if 0 (nop)))
+ ^
+assert_invalid error:
+ third_party/testsuite/br_if.wast:262:21: type mismatch of br_if condition. got i64, expected i32
+ (block (br_if 0 (i64.const 0)))
+ ^
+assert_invalid error:
+ third_party/testsuite/br_if.wast:268:35: type mismatch in nop. got void, expected i32
+ (block (br_if 0 (i32.const 0) (nop)) (i32.const 1))
+ ^
+assert_invalid error:
+ third_party/testsuite/br_if.wast:274:35: type mismatch of br_if condition. got i64, expected i32
+ (block (br_if 0 (i32.const 0) (i64.const 0)) (i32.const 1))
+ ^
+assert_invalid error:
+ third_party/testsuite/br_if.wast:280:39: label variable out of range (max 0)
+ (module (func $unbound-label (br_if 1 (i32.const 1))))
+ ^
+assert_invalid error:
+ third_party/testsuite/br_if.wast:284:60: label variable out of range (max 2)
+ (module (func $unbound-nested-label (block (block (br_if 5 (i32.const 1))))))
+ ^
+assert_invalid error:
+ third_party/testsuite/br_if.wast:288:37: label variable out of range (max 0)
+ (module (func $large-label (br_if 0x100000001 (i32.const 1))))
+ ^^^^^^^^^^^
+50/50 tests passed.
+;;; STDOUT ;;)
diff --git a/test/interp/spec/br_table.txt b/test/interp/spec/br_table.txt
new file mode 100644
index 00000000..bbb64041
--- /dev/null
+++ b/test/interp/spec/br_table.txt
@@ -0,0 +1,69 @@
+;;; TOOL: run-interp-spec
+;;; STDIN_FILE: third_party/testsuite/br_table.wast
+(;; STDOUT ;;;
+assert_invalid error:
+ third_party/testsuite/br_table.wast:1261:12: type mismatch of br_table default target. got void, expected i32
+ (block (br_table 0 (i32.const 1)) (i32.const 1))
+ ^
+assert_invalid error:
+ third_party/testsuite/br_table.wast:1267:28: type mismatch of br_table target. got i64, expected i32
+ (block (br_table 0 0 0 (i64.const 1) (i32.const 1)) (i32.const 1))
+ ^
+assert_invalid error:
+ third_party/testsuite/br_table.wast:1267:28: type mismatch of br_table target. got i64, expected i32
+ (block (br_table 0 0 0 (i64.const 1) (i32.const 1)) (i32.const 1))
+ ^
+assert_invalid error:
+ third_party/testsuite/br_table.wast:1267:28: type mismatch of br_table default target. got i64, expected i32
+ (block (br_table 0 0 0 (i64.const 1) (i32.const 1)) (i32.const 1))
+ ^
+assert_invalid error:
+ third_party/testsuite/br_table.wast:1274:28: type mismatch in nop. got void, expected i32
+ (block (br_table 0 0 0 (nop)))
+ ^
+assert_invalid error:
+ third_party/testsuite/br_table.wast:1280:24: type mismatch of key. got i64, expected i32
+ (block (br_table 0 (i64.const 0)))
+ ^
+assert_invalid error:
+ third_party/testsuite/br_table.wast:1286:40: type mismatch in nop. got void, expected i32
+ (block (br_table 0 0 (i32.const 0) (nop)) (i32.const 1))
+ ^
+assert_invalid error:
+ third_party/testsuite/br_table.wast:1292:40: type mismatch of key. got i64, expected i32
+ (block (br_table 0 0 (i32.const 0) (i64.const 0)) (i32.const 1))
+ ^
+assert_invalid error:
+ third_party/testsuite/br_table.wast:1299:22: label variable out of range (max 1)
+ (block (br_table 2 1 (i32.const 1)))
+ ^
+assert_invalid error:
+ third_party/testsuite/br_table.wast:1299:24: label variable out of range (max 1)
+ (block (br_table 2 1 (i32.const 1)))
+ ^
+assert_invalid error:
+ third_party/testsuite/br_table.wast:1305:31: label variable out of range (max 2)
+ (block (block (br_table 0 5 (i32.const 1))))
+ ^
+assert_invalid error:
+ third_party/testsuite/br_table.wast:1311:24: label variable out of range (max 1)
+ (block (br_table 0 0x100000001 0 (i32.const 1)))
+ ^^^^^^^^^^^
+assert_invalid error:
+ third_party/testsuite/br_table.wast:1318:22: label variable out of range (max 1)
+ (block (br_table 1 2 (i32.const 1)))
+ ^
+assert_invalid error:
+ third_party/testsuite/br_table.wast:1318:24: label variable out of range (max 1)
+ (block (br_table 1 2 (i32.const 1)))
+ ^
+assert_invalid error:
+ third_party/testsuite/br_table.wast:1324:31: label variable out of range (max 2)
+ (block (block (br_table 0 5 (i32.const 1))))
+ ^
+assert_invalid error:
+ third_party/testsuite/br_table.wast:1330:26: label variable out of range (max 1)
+ (block (br_table 0 0 0x100000001 (i32.const 1)))
+ ^^^^^^^^^^^
+146/146 tests passed.
+;;; STDOUT ;;)
diff --git a/test/interp/spec/call.txt b/test/interp/spec/call.txt
new file mode 100644
index 00000000..4002e211
--- /dev/null
+++ b/test/interp/spec/call.txt
@@ -0,0 +1,73 @@
+;;; TOOL: run-interp-spec
+;;; STDIN_FILE: third_party/testsuite/call.wast
+(;; STDOUT ;;;
+assert_invalid error:
+ third_party/testsuite/call.wast:152:38: type mismatch of call result. got void, expected i32
+ (func $type-void-vs-num (i32.eqz (call 1)))
+ ^
+assert_invalid error:
+ third_party/testsuite/call.wast:159:37: type mismatch of call result. got i64, expected i32
+ (func $type-num-vs-num (i32.eqz (call 1)))
+ ^
+assert_invalid error:
+ third_party/testsuite/call.wast:167:25: too few parameters to function in call. got 0, expected 1
+ (func $arity-0-vs-1 (call 1))
+ ^
+assert_invalid error:
+ third_party/testsuite/call.wast:174:25: too few parameters to function in call. got 0, expected 2
+ (func $arity-0-vs-2 (call 1))
+ ^
+assert_invalid error:
+ third_party/testsuite/call.wast:181:25: too many parameters to function in call. got 1, expected 0
+ (func $arity-1-vs-0 (call 1 (i32.const 1)))
+ ^
+assert_invalid error:
+ third_party/testsuite/call.wast:188:25: too many parameters to function in call. got 2, expected 0
+ (func $arity-2-vs-0 (call 1 (f64.const 2) (i32.const 1)))
+ ^
+assert_invalid error:
+ third_party/testsuite/call.wast:196:28: too many parameters to function in call. got 3, expected 2
+ (func $arity-nop-first (call 1 (nop) (i32.const 1) (i32.const 2)))
+ ^
+assert_invalid error:
+ third_party/testsuite/call.wast:203:26: too many parameters to function in call. got 3, expected 2
+ (func $arity-nop-mid (call 1 (i32.const 1) (nop) (i32.const 2)))
+ ^
+assert_invalid error:
+ third_party/testsuite/call.wast:210:27: too many parameters to function in call. got 3, expected 2
+ (func $arity-nop-last (call 1 (i32.const 1) (i32.const 2) (nop)))
+ ^
+assert_invalid error:
+ third_party/testsuite/call.wast:218:43: type mismatch in nop. got void, expected i32
+ (func $type-first-void-vs-num (call 1 (nop) (i32.const 1)))
+ ^
+assert_invalid error:
+ third_party/testsuite/call.wast:225:58: type mismatch in nop. got void, expected i32
+ (func $type-second-void-vs-num (call 1 (i32.const 1) (nop)))
+ ^
+assert_invalid error:
+ third_party/testsuite/call.wast:232:42: type mismatch of argument 0 of call. got f64, expected i32
+ (func $type-first-num-vs-num (call 1 (f64.const 1) (i32.const 1)))
+ ^
+assert_invalid error:
+ third_party/testsuite/call.wast:232:56: type mismatch of argument 1 of call. got i32, expected f64
+ (func $type-first-num-vs-num (call 1 (f64.const 1) (i32.const 1)))
+ ^
+assert_invalid error:
+ third_party/testsuite/call.wast:239:43: type mismatch of argument 0 of call. got i32, expected f64
+ (func $type-second-num-vs-num (call 1 (i32.const 1) (f64.const 1)))
+ ^
+assert_invalid error:
+ third_party/testsuite/call.wast:239:57: type mismatch of argument 1 of call. got f64, expected i32
+ (func $type-second-num-vs-num (call 1 (i32.const 1) (f64.const 1)))
+ ^
+assert_invalid error:
+ third_party/testsuite/call.wast:249:37: function variable out of range (max 1)
+ (module (func $unbound-func (call 1)))
+ ^
+assert_invalid error:
+ third_party/testsuite/call.wast:253:35: function variable out of range (max 1)
+ (module (func $large-func (call 10001232130000)))
+ ^^^^^^^^^^^^^^
+35/35 tests passed.
+;;; STDOUT ;;)
diff --git a/test/interp/spec/call_indirect.txt b/test/interp/spec/call_indirect.txt
new file mode 100644
index 00000000..0066086c
--- /dev/null
+++ b/test/interp/spec/call_indirect.txt
@@ -0,0 +1,81 @@
+;;; TOOL: run-interp-spec
+;;; STDIN_FILE: third_party/testsuite/call_indirect.wast
+(;; STDOUT ;;;
+assert_invalid error:
+ third_party/testsuite/call_indirect.wast:201:38: type mismatch of call_indirect result. got void, expected i32
+ (func $type-void-vs-num (i32.eqz (call_indirect 0 (i32.const 0))))
+ ^
+assert_invalid error:
+ third_party/testsuite/call_indirect.wast:208:37: type mismatch of call_indirect result. got i64, expected i32
+ (func $type-num-vs-num (i32.eqz (call_indirect 0 (i32.const 0))))
+ ^
+assert_invalid error:
+ third_party/testsuite/call_indirect.wast:216:25: too few parameters to function in call_indirect. got 0, expected 1
+ (func $arity-0-vs-1 (call_indirect 0 (i32.const 0)))
+ ^
+assert_invalid error:
+ third_party/testsuite/call_indirect.wast:223:25: too few parameters to function in call_indirect. got 0, expected 2
+ (func $arity-0-vs-2 (call_indirect 0 (i32.const 0)))
+ ^
+assert_invalid error:
+ third_party/testsuite/call_indirect.wast:230:25: too many parameters to function in call_indirect. got 1, expected 0
+ (func $arity-1-vs-0 (call_indirect 0 (i32.const 0) (i32.const 1)))
+ ^
+assert_invalid error:
+ third_party/testsuite/call_indirect.wast:238:7: too many parameters to function in call_indirect. got 2, expected 0
+ (call_indirect 0 (i32.const 0) (f64.const 2) (i32.const 1))
+ ^
+assert_invalid error:
+ third_party/testsuite/call_indirect.wast:248:7: too many parameters to function in call_indirect. got 3, expected 2
+ (call_indirect 0 (i32.const 0) (nop) (i32.const 1) (i32.const 2))
+ ^
+assert_invalid error:
+ third_party/testsuite/call_indirect.wast:257:7: too many parameters to function in call_indirect. got 3, expected 2
+ (call_indirect 0 (i32.const 0) (i32.const 1) (nop) (i32.const 2))
+ ^
+assert_invalid error:
+ third_party/testsuite/call_indirect.wast:266:7: too many parameters to function in call_indirect. got 3, expected 2
+ (call_indirect 0 (i32.const 0) (i32.const 1) (i32.const 2) (nop))
+ ^
+assert_invalid error:
+ third_party/testsuite/call_indirect.wast:275:51: type mismatch in nop. got void, expected i32
+ (func $type-func-void-vs-i32 (call_indirect 0 (nop) (i32.const 1)))
+ ^
+assert_invalid error:
+ third_party/testsuite/call_indirect.wast:282:50: type mismatch of function index. got i64, expected i32
+ (func $type-func-num-vs-i32 (call_indirect 0 (i64.const 1) (i32.const 0)))
+ ^
+assert_invalid error:
+ third_party/testsuite/call_indirect.wast:291:38: type mismatch in nop. got void, expected i32
+ (call_indirect 0 (i32.const 0) (nop) (i32.const 1))
+ ^
+assert_invalid error:
+ third_party/testsuite/call_indirect.wast:300:52: type mismatch in nop. got void, expected i32
+ (call_indirect 0 (i32.const 0) (i32.const 1) (nop))
+ ^
+assert_invalid error:
+ third_party/testsuite/call_indirect.wast:309:38: type mismatch of argument 0 of call_indirect. got f64, expected i32
+ (call_indirect 0 (i32.const 0) (f64.const 1) (i32.const 1))
+ ^
+assert_invalid error:
+ third_party/testsuite/call_indirect.wast:309:52: type mismatch of argument 1 of call_indirect. got i32, expected f64
+ (call_indirect 0 (i32.const 0) (f64.const 1) (i32.const 1))
+ ^
+assert_invalid error:
+ third_party/testsuite/call_indirect.wast:318:38: type mismatch of argument 0 of call_indirect. got i32, expected f64
+ (call_indirect 0 (i32.const 0) (i32.const 1) (f64.const 1))
+ ^
+assert_invalid error:
+ third_party/testsuite/call_indirect.wast:318:52: type mismatch of argument 1 of call_indirect. got f64, expected i32
+ (call_indirect 0 (i32.const 0) (i32.const 1) (f64.const 1))
+ ^
+assert_invalid error:
+ third_party/testsuite/call_indirect.wast:328:46: function type variable out of range (max 0)
+ (module (func $unbound-type (call_indirect 1 (i32.const 0))))
+ ^
+assert_invalid error:
+ third_party/testsuite/call_indirect.wast:332:44: function type variable out of range (max 0)
+ (module (func $large-type (call_indirect 10001232130000 (i32.const 0))))
+ ^^^^^^^^^^^^^^
+41/41 tests passed.
+;;; STDOUT ;;)
diff --git a/test/interp/spec/func-local-after-body.fail.txt b/test/interp/spec/func-local-after-body.fail.txt
new file mode 100644
index 00000000..aa2b867f
--- /dev/null
+++ b/test/interp/spec/func-local-after-body.fail.txt
@@ -0,0 +1,10 @@
+;;; ERROR: 1
+;;; TOOL: run-interp-spec
+;;; STDIN_FILE: third_party/testsuite/func-local-after-body.fail.wast
+(;; STDERR ;;;
+Error running "sexpr-wasm":
+third_party/testsuite/func-local-after-body.fail.wast:1:22: syntax error, unexpected LOCAL
+(module (func (nop) (local i32)))
+ ^^^^^
+
+;;; STDERR ;;)
diff --git a/test/interp/spec/func-local-before-param.fail.txt b/test/interp/spec/func-local-before-param.fail.txt
new file mode 100644
index 00000000..a73a9de7
--- /dev/null
+++ b/test/interp/spec/func-local-before-param.fail.txt
@@ -0,0 +1,10 @@
+;;; ERROR: 1
+;;; TOOL: run-interp-spec
+;;; STDIN_FILE: third_party/testsuite/func-local-before-param.fail.wast
+(;; STDERR ;;;
+Error running "sexpr-wasm":
+third_party/testsuite/func-local-before-param.fail.wast:1:28: syntax error, unexpected PARAM
+(module (func (local i32) (param i32)))
+ ^^^^^
+
+;;; STDERR ;;)
diff --git a/test/interp/spec/func-local-before-result.fail.txt b/test/interp/spec/func-local-before-result.fail.txt
new file mode 100644
index 00000000..308c9927
--- /dev/null
+++ b/test/interp/spec/func-local-before-result.fail.txt
@@ -0,0 +1,10 @@
+;;; ERROR: 1
+;;; TOOL: run-interp-spec
+;;; STDIN_FILE: third_party/testsuite/func-local-before-result.fail.wast
+(;; STDERR ;;;
+Error running "sexpr-wasm":
+third_party/testsuite/func-local-before-result.fail.wast:1:28: syntax error, unexpected RESULT
+(module (func (local i32) (result i32) (get_local 0)))
+ ^^^^^^
+
+;;; STDERR ;;)
diff --git a/test/interp/spec/func-param-after-body.fail.txt b/test/interp/spec/func-param-after-body.fail.txt
new file mode 100644
index 00000000..c9c98bf2
--- /dev/null
+++ b/test/interp/spec/func-param-after-body.fail.txt
@@ -0,0 +1,10 @@
+;;; ERROR: 1
+;;; TOOL: run-interp-spec
+;;; STDIN_FILE: third_party/testsuite/func-param-after-body.fail.wast
+(;; STDERR ;;;
+Error running "sexpr-wasm":
+third_party/testsuite/func-param-after-body.fail.wast:1:22: syntax error, unexpected PARAM
+(module (func (nop) (param i32)))
+ ^^^^^
+
+;;; STDERR ;;)
diff --git a/test/interp/spec/func-result-after-body.fail.txt b/test/interp/spec/func-result-after-body.fail.txt
new file mode 100644
index 00000000..d3af782f
--- /dev/null
+++ b/test/interp/spec/func-result-after-body.fail.txt
@@ -0,0 +1,10 @@
+;;; ERROR: 1
+;;; TOOL: run-interp-spec
+;;; STDIN_FILE: third_party/testsuite/func-result-after-body.fail.wast
+(;; STDERR ;;;
+Error running "sexpr-wasm":
+third_party/testsuite/func-result-after-body.fail.wast:1:22: syntax error, unexpected RESULT
+(module (func (nop) (result i32)))
+ ^^^^^^
+
+;;; STDERR ;;)
diff --git a/test/interp/spec/func-result-before-param.fail.txt b/test/interp/spec/func-result-before-param.fail.txt
new file mode 100644
index 00000000..a21d2c17
--- /dev/null
+++ b/test/interp/spec/func-result-before-param.fail.txt
@@ -0,0 +1,10 @@
+;;; ERROR: 1
+;;; TOOL: run-interp-spec
+;;; STDIN_FILE: third_party/testsuite/func-result-before-param.fail.wast
+(;; STDERR ;;;
+Error running "sexpr-wasm":
+third_party/testsuite/func-result-before-param.fail.wast:1:29: syntax error, unexpected PARAM
+(module (func (result i32) (param i32) (get_local 0)))
+ ^^^^^
+
+;;; STDERR ;;)
diff --git a/test/interp/spec/if_label_scope.fail.txt b/test/interp/spec/if_label_scope.fail.txt
new file mode 100644
index 00000000..dd8bd926
--- /dev/null
+++ b/test/interp/spec/if_label_scope.fail.txt
@@ -0,0 +1,10 @@
+;;; ERROR: 1
+;;; TOOL: run-interp-spec
+;;; STDIN_FILE: third_party/testsuite/if_label_scope.fail.wast
+(;; STDERR ;;;
+Error running "sexpr-wasm":
+third_party/testsuite/if_label_scope.fail.wast:6:19: undefined label variable "$l"
+ (else (br $l (i32.const 42)))
+ ^^
+
+;;; STDERR ;;)
diff --git a/test/interp/spec/int_literals.txt b/test/interp/spec/int_literals.txt
index e9a2e01d..49c263ad 100644
--- a/test/interp/spec/int_literals.txt
+++ b/test/interp/spec/int_literals.txt
@@ -1,5 +1,5 @@
;;; TOOL: run-interp-spec
;;; STDIN_FILE: third_party/testsuite/int_literals.wast
(;; STDOUT ;;;
-18/18 tests passed.
+22/22 tests passed.
;;; STDOUT ;;)
diff --git a/test/interp/spec/loop.txt b/test/interp/spec/loop.txt
new file mode 100644
index 00000000..31a425f0
--- /dev/null
+++ b/test/interp/spec/loop.txt
@@ -0,0 +1,73 @@
+;;; TOOL: run-interp-spec
+;;; STDIN_FILE: third_party/testsuite/loop.wast
+(;; STDOUT ;;;
+assert_invalid error:
+ third_party/testsuite/loop.wast:262:46: type mismatch of loop. got void, expected i32
+ (module (func $type-empty-i32 (result i32) (loop)))
+ ^
+assert_invalid error:
+ third_party/testsuite/loop.wast:266:46: type mismatch of loop. got void, expected i64
+ (module (func $type-empty-i64 (result i64) (loop)))
+ ^
+assert_invalid error:
+ third_party/testsuite/loop.wast:270:46: type mismatch of loop. got void, expected f32
+ (module (func $type-empty-f32 (result f32) (loop)))
+ ^
+assert_invalid error:
+ third_party/testsuite/loop.wast:274:46: type mismatch of loop. got void, expected f64
+ (module (func $type-empty-f64 (result f64) (loop)))
+ ^
+assert_invalid error:
+ third_party/testsuite/loop.wast:280:11: type mismatch in nop. got void, expected i32
+ (loop (nop))
+ ^
+assert_invalid error:
+ third_party/testsuite/loop.wast:286:11: type mismatch of loop. got f32, expected i32
+ (loop (f32.const 0))
+ ^
+assert_invalid error:
+ third_party/testsuite/loop.wast:292:32: type mismatch in nop. got void, expected i32
+ (loop (br 1 (i32.const 1)) (nop))
+ ^
+assert_invalid error:
+ third_party/testsuite/loop.wast:298:32: type mismatch of loop. got f32, expected i32
+ (loop (br 1 (i32.const 1)) (f32.const 0))
+ ^
+assert_invalid error:
+ third_party/testsuite/loop.wast:305:11: type mismatch of br value. got void, expected i32
+ (loop (br 1))
+ ^
+assert_invalid error:
+ third_party/testsuite/loop.wast:311:11: type mismatch of br value. got void, expected i32
+ (loop (br 1) (i32.const 1))
+ ^
+assert_invalid error:
+ third_party/testsuite/loop.wast:317:17: type mismatch of br value. got i64, expected i32
+ (loop (br 1 (i64.const 1)) (i32.const 1))
+ ^
+assert_invalid error:
+ third_party/testsuite/loop.wast:323:17: type mismatch of br value. got i64, expected i32
+ (loop (br 1 (i64.const 1)) (br 1 (i32.const 1)))
+ ^
+assert_invalid error:
+ third_party/testsuite/loop.wast:329:38: type mismatch of br value. got f64, expected i32
+ (loop (br 1 (i32.const 1)) (br 1 (f64.const 1)))
+ ^
+assert_invalid error:
+ third_party/testsuite/loop.wast:336:17: type mismatch of br value. got void, expected i32
+ (loop (loop (br 3)) (br 1 (i32.const 1)))
+ ^
+assert_invalid error:
+ third_party/testsuite/loop.wast:342:23: type mismatch of br value. got i64, expected i32
+ (loop (loop (br 3 (i64.const 1))) (br 1 (i32.const 1)))
+ ^
+assert_invalid error:
+ third_party/testsuite/loop.wast:348:20: type mismatch of br value. got void, expected i32
+ (i32.ctz (loop (br 1)))
+ ^
+assert_invalid error:
+ third_party/testsuite/loop.wast:354:5: type mismatch of function result. got i64, expected i32
+ (i64.ctz (loop (br 1 (i64.const 9))))
+ ^
+47/47 tests passed.
+;;; STDOUT ;;)
diff --git a/test/interp/spec/nop.txt b/test/interp/spec/nop.txt
index b2bfdd1f..8db4cebf 100644
--- a/test/interp/spec/nop.txt
+++ b/test/interp/spec/nop.txt
@@ -2,8 +2,20 @@
;;; STDIN_FILE: third_party/testsuite/nop.wast
(;; STDOUT ;;;
assert_invalid error:
- third_party/testsuite/nop.wast:18:30: type mismatch in nop. got void, expected i32
- (module (func (result i32) (nop)))
- ^
-2/2 tests passed.
+ third_party/testsuite/nop.wast:87:40: type mismatch in nop. got void, expected i32
+ (module (func $type-i32 (result i32) (nop)))
+ ^
+assert_invalid error:
+ third_party/testsuite/nop.wast:91:40: type mismatch in nop. got void, expected i64
+ (module (func $type-i64 (result i64) (nop)))
+ ^
+assert_invalid error:
+ third_party/testsuite/nop.wast:95:40: type mismatch in nop. got void, expected f32
+ (module (func $type-f32 (result f32) (nop)))
+ ^
+assert_invalid error:
+ third_party/testsuite/nop.wast:99:40: type mismatch in nop. got void, expected f64
+ (module (func $type-f64 (result f64) (nop)))
+ ^
+20/20 tests passed.
;;; STDOUT ;;)
diff --git a/test/interp/spec/return.txt b/test/interp/spec/return.txt
new file mode 100644
index 00000000..95addba0
--- /dev/null
+++ b/test/interp/spec/return.txt
@@ -0,0 +1,13 @@
+;;; TOOL: run-interp-spec
+;;; STDIN_FILE: third_party/testsuite/return.wast
+(;; STDOUT ;;;
+assert_invalid error:
+ third_party/testsuite/return.wast:274:54: type mismatch of return. got void, expected f64
+ (module (func $type-value-void-vs-num (result f64) (return)))
+ ^
+assert_invalid error:
+ third_party/testsuite/return.wast:278:61: type mismatch of return. got i64, expected f64
+ (module (func $type-value-num-vs-num (result f64) (return (i64.const 1))))
+ ^
+60/60 tests passed.
+;;; STDOUT ;;)
diff --git a/test/interp/spec/set_local.txt b/test/interp/spec/set_local.txt
new file mode 100644
index 00000000..5b201694
--- /dev/null
+++ b/test/interp/spec/set_local.txt
@@ -0,0 +1,97 @@
+;;; TOOL: run-interp-spec
+;;; STDIN_FILE: third_party/testsuite/set_local.wast
+(;; STDOUT ;;;
+assert_invalid error:
+ third_party/testsuite/set_local.wast:133:65: type mismatch of function result. got i32, expected i64
+...$type-local-num-vs-num (result i64) (local i32) (set_local 0 (i32.const 0))))
+ ^
+assert_invalid error:
+ third_party/testsuite/set_local.wast:137:61: type mismatch of convert op. got f32, expected i32
+...nc $type-local-num-vs-num (local f32) (i32.eqz (set_local 0 (f32.const 0)))))
+ ^
+assert_invalid error:
+ third_party/testsuite/set_local.wast:141:65: type mismatch of unary op. got i64, expected f64
+...type-local-num-vs-num (local f64 i64) (f64.neg (set_local 1 (i64.const 0)))))
+ ^
+assert_invalid error:
+ third_party/testsuite/set_local.wast:146:70: type mismatch in nop. got void, expected i32
+ (module (func $type-local-arg-void-vs-num (local i32) (set_local 0 (nop))))
+ ^
+assert_invalid error:
+ third_party/testsuite/set_local.wast:150:69: type mismatch of set_local. got f32, expected i32
+...le (func $type-local-arg-num-vs-num (local i32) (set_local 0 (f32.const 0))))
+ ^
+assert_invalid error:
+ third_party/testsuite/set_local.wast:154:69: type mismatch of set_local. got f64, expected f32
+...le (func $type-local-arg-num-vs-num (local f32) (set_local 0 (f64.const 0))))
+ ^
+assert_invalid error:
+ third_party/testsuite/set_local.wast:158:73: type mismatch of set_local. got f64, expected i64
+...func $type-local-arg-num-vs-num (local f64 i64) (set_local 1 (f64.const 0))))
+ ^
+assert_invalid error:
+ third_party/testsuite/set_local.wast:166:65: type mismatch of function result. got i32, expected i64
+ (module (func $type-param-num-vs-num (param i32) (result i64) (get_local 0)))
+ ^
+assert_invalid error:
+ third_party/testsuite/set_local.wast:170:61: type mismatch of convert op. got f32, expected i32
+ (module (func $type-param-num-vs-num (param f32) (i32.eqz (get_local 0))))
+ ^
+assert_invalid error:
+ third_party/testsuite/set_local.wast:174:65: type mismatch of unary op. got i64, expected f64
+ (module (func $type-param-num-vs-num (param f64 i64) (f64.neg (get_local 1))))
+ ^
+assert_invalid error:
+ third_party/testsuite/set_local.wast:179:70: type mismatch in nop. got void, expected i32
+ (module (func $type-param-arg-void-vs-num (param i32) (set_local 0 (nop))))
+ ^
+assert_invalid error:
+ third_party/testsuite/set_local.wast:183:69: type mismatch of set_local. got f32, expected i32
+...le (func $type-param-arg-num-vs-num (param i32) (set_local 0 (f32.const 0))))
+ ^
+assert_invalid error:
+ third_party/testsuite/set_local.wast:187:69: type mismatch of set_local. got f64, expected f32
+...le (func $type-param-arg-num-vs-num (param f32) (set_local 0 (f64.const 0))))
+ ^
+assert_invalid error:
+ third_party/testsuite/set_local.wast:191:73: type mismatch of set_local. got f64, expected i64
+...func $type-param-arg-num-vs-num (param f64 i64) (set_local 1 (f64.const 0))))
+ ^
+assert_invalid error:
+ third_party/testsuite/set_local.wast:199:59: local variable out of range (max 2)
+ (module (func $unbound-local (local i32 i64) (get_local 3)))
+ ^
+assert_invalid error:
+ third_party/testsuite/set_local.wast:203:57: local variable out of range (max 2)
+ (module (func $large-local (local i32 i64) (get_local 14324343)))
+ ^^^^^^^^
+assert_invalid error:
+ third_party/testsuite/set_local.wast:208:59: local variable out of range (max 2)
+ (module (func $unbound-param (param i32 i64) (get_local 2)))
+ ^
+assert_invalid error:
+ third_party/testsuite/set_local.wast:212:57: local variable out of range (max 2)
+ (module (func $large-param (local i32 i64) (get_local 714324343)))
+ ^^^^^^^^^
+assert_invalid error:
+ third_party/testsuite/set_local.wast:217:71: local variable out of range (max 3)
+ (module (func $unbound-mixed (param i32) (local i32 i64) (get_local 3)))
+ ^
+assert_invalid error:
+ third_party/testsuite/set_local.wast:221:69: local variable out of range (max 3)
+ (module (func $large-mixed (param i64) (local i32 i64) (get_local 214324343)))
+ ^^^^^^^^^
+assert_invalid error:
+ third_party/testsuite/set_local.wast:226:81: type mismatch of set_local. got f32, expected i32
+...pe-mixed-arg-num-vs-num (param f32) (local i32) (set_local 1 (f32.const 0))))
+ ^
+assert_invalid error:
+ third_party/testsuite/set_local.wast:230:85: type mismatch of set_local. got f32, expected i32
+...ixed-arg-num-vs-num (param i64 i32) (local f32) (set_local 1 (f32.const 0))))
+ ^
+assert_invalid error:
+ third_party/testsuite/set_local.wast:234:85: type mismatch of set_local. got i64, expected f64
+...ixed-arg-num-vs-num (param i64) (local f64 i64) (set_local 1 (i64.const 0))))
+ ^
+11/11 tests passed.
+;;; STDOUT ;;)
diff --git a/test/interp/spec/unreachable.txt b/test/interp/spec/unreachable.txt
index 971dba3a..2dc4f277 100644
--- a/test/interp/spec/unreachable.txt
+++ b/test/interp/spec/unreachable.txt
@@ -1,5 +1,5 @@
;;; TOOL: run-interp-spec
;;; STDIN_FILE: third_party/testsuite/unreachable.wast
(;; STDOUT ;;;
-56/56 tests passed.
+60/60 tests passed.
;;; STDOUT ;;)