diff --git a/test/spec/exception-handling/legacy/rethrow.txt b/test/spec/exception-handling/legacy/rethrow.txt new file mode 100644 index 000000000..9004fd3d0 --- /dev/null +++ b/test/spec/exception-handling/legacy/rethrow.txt @@ -0,0 +1,22 @@ +;;; TOOL: run-interp-spec +;;; STDIN_FILE: third_party/testsuite/proposals/exception-handling/legacy/rethrow.wast +;;; ARGS*: --enable-exceptions +(;; STDOUT ;;; +out/test/spec/exception-handling/legacy/rethrow.wast:75: assert_exception passed +out/test/spec/exception-handling/legacy/rethrow.wast:77: assert_exception passed +out/test/spec/exception-handling/legacy/rethrow.wast:80: assert_exception passed +out/test/spec/exception-handling/legacy/rethrow.wast:82: assert_exception passed +out/test/spec/exception-handling/legacy/rethrow.wast:84: assert_exception passed +out/test/spec/exception-handling/legacy/rethrow.wast:85: assert_exception passed +out/test/spec/exception-handling/legacy/rethrow.wast:91: assert_exception passed +out/test/spec/exception-handling/legacy/rethrow.wast:93: assert_invalid passed: + out/test/spec/exception-handling/legacy/rethrow/rethrow.1.wasm:0000019: error: rethrow not in try catch block + 0000019: error: OnRethrowExpr callback failed +out/test/spec/exception-handling/legacy/rethrow.wast:94: assert_invalid passed: + out/test/spec/exception-handling/legacy/rethrow/rethrow.2.wasm:000001b: error: rethrow not in try catch block + 000001b: error: OnRethrowExpr callback failed +out/test/spec/exception-handling/legacy/rethrow.wast:95: assert_invalid passed: + out/test/spec/exception-handling/legacy/rethrow/rethrow.3.wasm:000001b: error: rethrow not in try catch block + 000001b: error: OnRethrowExpr callback failed +16/16 tests passed. +;;; STDOUT ;;) diff --git a/test/spec/exception-handling/legacy/throw.txt b/test/spec/exception-handling/legacy/throw.txt new file mode 100644 index 000000000..e7d56b2b6 --- /dev/null +++ b/test/spec/exception-handling/legacy/throw.txt @@ -0,0 +1,20 @@ +;;; TOOL: run-interp-spec +;;; STDIN_FILE: third_party/testsuite/proposals/exception-handling/legacy/throw.wast +;;; ARGS*: --enable-exceptions +(;; STDOUT ;;; +out/test/spec/exception-handling/legacy/throw.wast:38: assert_exception passed +out/test/spec/exception-handling/legacy/throw.wast:39: assert_exception passed +out/test/spec/exception-handling/legacy/throw.wast:41: assert_exception passed +out/test/spec/exception-handling/legacy/throw.wast:42: assert_exception passed +out/test/spec/exception-handling/legacy/throw.wast:43: assert_exception passed +out/test/spec/exception-handling/legacy/throw.wast:47: assert_invalid passed: + out/test/spec/exception-handling/legacy/throw/throw.1.wasm:0000019: error: tag variable out of range: 0 (max 0) + 0000019: error: OnThrowExpr callback failed +out/test/spec/exception-handling/legacy/throw.wast:48: assert_invalid passed: + out/test/spec/exception-handling/legacy/throw/throw.2.wasm:0000022: error: type mismatch in throw, expected [i32] but got [] + 0000022: error: OnThrowExpr callback failed +out/test/spec/exception-handling/legacy/throw.wast:50: assert_invalid passed: + out/test/spec/exception-handling/legacy/throw/throw.3.wasm:0000024: error: type mismatch in throw, expected [i32] but got [i64] + 0000024: error: OnThrowExpr callback failed +11/11 tests passed. +;;; STDOUT ;;) diff --git a/test/spec/exception-handling/legacy/try_catch.txt b/test/spec/exception-handling/legacy/try_catch.txt new file mode 100644 index 000000000..a1221108e --- /dev/null +++ b/test/spec/exception-handling/legacy/try_catch.txt @@ -0,0 +1,39 @@ +;;; TOOL: run-interp-spec +;;; STDIN_FILE: third_party/testsuite/proposals/exception-handling/legacy/try_catch.wast +;;; ARGS*: --enable-exceptions --enable-tail-call +(;; STDOUT ;;; +out/test/spec/exception-handling/legacy/try_catch.wast:185: assert_trap passed: unreachable executed +out/test/spec/exception-handling/legacy/try_catch.wast:188: assert_trap passed: integer divide by zero +out/test/spec/exception-handling/legacy/try_catch.wast:192: assert_exception passed +out/test/spec/exception-handling/legacy/try_catch.wast:196: assert_exception passed +out/test/spec/exception-handling/legacy/try_catch.wast:219: assert_exception passed +out/test/spec/exception-handling/legacy/try_catch.wast:220: assert_exception passed +out/test/spec/exception-handling/legacy/try_catch.wast:248: assert_malformed passed: + out/test/spec/exception-handling/legacy/try_catch/try_catch.3.wat:1:16: error: unexpected token "catch_all", expected an instr. + (module (func (catch_all))) + ^^^^^^^^^ +out/test/spec/exception-handling/legacy/try_catch.wast:253: assert_malformed passed: + out/test/spec/exception-handling/legacy/try_catch/try_catch.4.wat:1:25: error: unexpected token "catch", expected an instr. + (module (tag $e) (func (catch $e))) + ^^^^^ +out/test/spec/exception-handling/legacy/try_catch.wast:258: assert_malformed passed: + out/test/spec/exception-handling/legacy/try_catch/try_catch.5.wat:1:38: error: multiple catch_all clauses not allowed + (module (func (try (do) (catch_all) (catch_all)))) + ^^^^^^^^^ +out/test/spec/exception-handling/legacy/try_catch.wast:264: assert_invalid passed: + out/test/spec/exception-handling/legacy/try_catch/try_catch.6.wasm:000001b: error: type mismatch in try, expected [i32] but got [] + 000001b: error: OnEndExpr callback failed +out/test/spec/exception-handling/legacy/try_catch.wast:266: assert_invalid passed: + out/test/spec/exception-handling/legacy/try_catch/try_catch.7.wasm:000001d: error: type mismatch in try, expected [i32] but got [i64] + 000001d: error: OnEndExpr callback failed +out/test/spec/exception-handling/legacy/try_catch.wast:268: assert_invalid passed: + out/test/spec/exception-handling/legacy/try_catch/try_catch.8.wasm:0000023: error: type mismatch at end of try catch, expected [] but got [i32] + 0000023: error: OnEndExpr callback failed +out/test/spec/exception-handling/legacy/try_catch.wast:270: assert_invalid passed: + out/test/spec/exception-handling/legacy/try_catch/try_catch.9.wasm:0000028: error: type mismatch in try catch, expected [i32] but got [i64] + 0000028: error: OnEndExpr callback failed +out/test/spec/exception-handling/legacy/try_catch.wast:275: assert_invalid passed: + out/test/spec/exception-handling/legacy/try_catch/try_catch.10.wasm:000001d: error: type mismatch at end of try catch, expected [] but got [i32] + 000001d: error: OnEndExpr callback failed +42/42 tests passed. +;;; STDOUT ;;) diff --git a/test/spec/exception-handling/legacy/try_delegate.txt b/test/spec/exception-handling/legacy/try_delegate.txt new file mode 100644 index 000000000..c871f2758 --- /dev/null +++ b/test/spec/exception-handling/legacy/try_delegate.txt @@ -0,0 +1,32 @@ +;;; TOOL: run-interp-spec +;;; STDIN_FILE: third_party/testsuite/proposals/exception-handling/legacy/try_delegate.wast +;;; ARGS*: --enable-exceptions --enable-tail-call +(;; STDOUT ;;; +out/test/spec/exception-handling/legacy/try_delegate.wast:195: assert_exception passed +out/test/spec/exception-handling/legacy/try_delegate.wast:198: assert_exception passed +out/test/spec/exception-handling/legacy/try_delegate.wast:200: assert_exception passed +out/test/spec/exception-handling/legacy/try_delegate.wast:208: assert_exception passed +out/test/spec/exception-handling/legacy/try_delegate.wast:209: assert_exception passed +out/test/spec/exception-handling/legacy/try_delegate.wast:213: assert_exception passed +out/test/spec/exception-handling/legacy/try_delegate.wast:214: assert_exception passed +out/test/spec/exception-handling/legacy/try_delegate.wast:222: assert_malformed passed: + out/test/spec/exception-handling/legacy/try_delegate/try_delegate.1.wat:1:16: error: unexpected token "delegate", expected an instr. + (module (func (delegate 0))) + ^^^^^^^^ +out/test/spec/exception-handling/legacy/try_delegate.wast:227: assert_malformed passed: + out/test/spec/exception-handling/legacy/try_delegate/try_delegate.2.wat:1:46: error: unexpected token delegate, expected ). + (module (tag $e) (func (try (do) (catch $e) (delegate 0)))) + ^^^^^^^^ +out/test/spec/exception-handling/legacy/try_delegate.wast:232: assert_malformed passed: + out/test/spec/exception-handling/legacy/try_delegate/try_delegate.3.wat:1:38: error: unexpected token delegate, expected ). + (module (func (try (do) (catch_all) (delegate 0)))) + ^^^^^^^^ +out/test/spec/exception-handling/legacy/try_delegate.wast:237: assert_malformed passed: + out/test/spec/exception-handling/legacy/try_delegate/try_delegate.4.wat:1:34: error: unexpected token ")", expected a numeric index or a name (e.g. 12 or $foo). + (module (func (try (do) (delegate) (delegate 0)))) + ^ +out/test/spec/exception-handling/legacy/try_delegate.wast:242: assert_invalid passed: + out/test/spec/exception-handling/legacy/try_delegate/try_delegate.5.wasm:000001b: error: invalid depth: 2 (max 1) + 000001b: error: OnDelegateExpr callback failed +26/26 tests passed. +;;; STDOUT ;;) diff --git a/test/spec/exception-handling/rethrow.txt b/test/spec/exception-handling/rethrow.txt deleted file mode 100644 index c633c4286..000000000 --- a/test/spec/exception-handling/rethrow.txt +++ /dev/null @@ -1,22 +0,0 @@ -;;; TOOL: run-interp-spec -;;; STDIN_FILE: third_party/testsuite_legacy/rethrow.wast -;;; ARGS*: --enable-exceptions -(;; STDOUT ;;; -out/test/spec/exception-handling/rethrow.wast:75: assert_exception passed -out/test/spec/exception-handling/rethrow.wast:77: assert_exception passed -out/test/spec/exception-handling/rethrow.wast:80: assert_exception passed -out/test/spec/exception-handling/rethrow.wast:82: assert_exception passed -out/test/spec/exception-handling/rethrow.wast:84: assert_exception passed -out/test/spec/exception-handling/rethrow.wast:85: assert_exception passed -out/test/spec/exception-handling/rethrow.wast:91: assert_exception passed -out/test/spec/exception-handling/rethrow.wast:93: assert_invalid passed: - out/test/spec/exception-handling/rethrow/rethrow.1.wasm:0000019: error: rethrow not in try catch block - 0000019: error: OnRethrowExpr callback failed -out/test/spec/exception-handling/rethrow.wast:94: assert_invalid passed: - out/test/spec/exception-handling/rethrow/rethrow.2.wasm:000001b: error: rethrow not in try catch block - 000001b: error: OnRethrowExpr callback failed -out/test/spec/exception-handling/rethrow.wast:95: assert_invalid passed: - out/test/spec/exception-handling/rethrow/rethrow.3.wasm:000001b: error: rethrow not in try catch block - 000001b: error: OnRethrowExpr callback failed -16/16 tests passed. -;;; STDOUT ;;) diff --git a/test/spec/exception-handling/throw.txt b/test/spec/exception-handling/throw.txt deleted file mode 100644 index 2f258e1f9..000000000 --- a/test/spec/exception-handling/throw.txt +++ /dev/null @@ -1,20 +0,0 @@ -;;; TOOL: run-interp-spec -;;; STDIN_FILE: third_party/testsuite_legacy/throw.wast -;;; ARGS*: --enable-exceptions -(;; STDOUT ;;; -out/test/spec/exception-handling/throw.wast:38: assert_exception passed -out/test/spec/exception-handling/throw.wast:39: assert_exception passed -out/test/spec/exception-handling/throw.wast:41: assert_exception passed -out/test/spec/exception-handling/throw.wast:42: assert_exception passed -out/test/spec/exception-handling/throw.wast:43: assert_exception passed -out/test/spec/exception-handling/throw.wast:47: assert_invalid passed: - out/test/spec/exception-handling/throw/throw.1.wasm:0000019: error: tag variable out of range: 0 (max 0) - 0000019: error: OnThrowExpr callback failed -out/test/spec/exception-handling/throw.wast:48: assert_invalid passed: - out/test/spec/exception-handling/throw/throw.2.wasm:0000022: error: type mismatch in throw, expected [i32] but got [] - 0000022: error: OnThrowExpr callback failed -out/test/spec/exception-handling/throw.wast:50: assert_invalid passed: - out/test/spec/exception-handling/throw/throw.3.wasm:0000024: error: type mismatch in throw, expected [i32] but got [i64] - 0000024: error: OnThrowExpr callback failed -11/11 tests passed. -;;; STDOUT ;;) diff --git a/test/spec/exception-handling/try_catch.txt b/test/spec/exception-handling/try_catch.txt deleted file mode 100644 index 11ee0c1aa..000000000 --- a/test/spec/exception-handling/try_catch.txt +++ /dev/null @@ -1,39 +0,0 @@ -;;; TOOL: run-interp-spec -;;; STDIN_FILE: third_party/testsuite_legacy/try_catch.wast -;;; ARGS*: --enable-exceptions --enable-tail-call -(;; STDOUT ;;; -out/test/spec/exception-handling/try_catch.wast:177: assert_trap passed: unreachable executed -out/test/spec/exception-handling/try_catch.wast:180: assert_trap passed: integer divide by zero -out/test/spec/exception-handling/try_catch.wast:184: assert_exception passed -out/test/spec/exception-handling/try_catch.wast:188: assert_exception passed -out/test/spec/exception-handling/try_catch.wast:211: assert_exception passed -out/test/spec/exception-handling/try_catch.wast:212: assert_exception passed -out/test/spec/exception-handling/try_catch.wast:237: assert_malformed passed: - out/test/spec/exception-handling/try_catch/try_catch.3.wat:1:16: error: unexpected token "catch_all", expected an instr. - (module (func (catch_all))) - ^^^^^^^^^ -out/test/spec/exception-handling/try_catch.wast:242: assert_malformed passed: - out/test/spec/exception-handling/try_catch/try_catch.4.wat:1:25: error: unexpected token "catch", expected an instr. - (module (tag $e) (func (catch $e))) - ^^^^^ -out/test/spec/exception-handling/try_catch.wast:247: assert_malformed passed: - out/test/spec/exception-handling/try_catch/try_catch.5.wat:1:38: error: multiple catch_all clauses not allowed - (module (func (try (do) (catch_all) (catch_all)))) - ^^^^^^^^^ -out/test/spec/exception-handling/try_catch.wast:253: assert_invalid passed: - out/test/spec/exception-handling/try_catch/try_catch.6.wasm:000001b: error: type mismatch in try, expected [i32] but got [] - 000001b: error: OnEndExpr callback failed -out/test/spec/exception-handling/try_catch.wast:255: assert_invalid passed: - out/test/spec/exception-handling/try_catch/try_catch.7.wasm:000001d: error: type mismatch in try, expected [i32] but got [i64] - 000001d: error: OnEndExpr callback failed -out/test/spec/exception-handling/try_catch.wast:257: assert_invalid passed: - out/test/spec/exception-handling/try_catch/try_catch.8.wasm:0000023: error: type mismatch at end of try catch, expected [] but got [i32] - 0000023: error: OnEndExpr callback failed -out/test/spec/exception-handling/try_catch.wast:259: assert_invalid passed: - out/test/spec/exception-handling/try_catch/try_catch.9.wasm:0000028: error: type mismatch in try catch, expected [i32] but got [i64] - 0000028: error: OnEndExpr callback failed -out/test/spec/exception-handling/try_catch.wast:264: assert_invalid passed: - out/test/spec/exception-handling/try_catch/try_catch.10.wasm:000001d: error: type mismatch at end of try catch, expected [] but got [i32] - 000001d: error: OnEndExpr callback failed -40/40 tests passed. -;;; STDOUT ;;) diff --git a/test/spec/exception-handling/try_delegate.txt b/test/spec/exception-handling/try_delegate.txt deleted file mode 100644 index 998c61589..000000000 --- a/test/spec/exception-handling/try_delegate.txt +++ /dev/null @@ -1,32 +0,0 @@ -;;; TOOL: run-interp-spec -;;; STDIN_FILE: third_party/testsuite_legacy/try_delegate.wast -;;; ARGS*: --enable-exceptions --enable-tail-call -(;; STDOUT ;;; -out/test/spec/exception-handling/try_delegate.wast:155: assert_exception passed -out/test/spec/exception-handling/try_delegate.wast:158: assert_exception passed -out/test/spec/exception-handling/try_delegate.wast:160: assert_exception passed -out/test/spec/exception-handling/try_delegate.wast:168: assert_exception passed -out/test/spec/exception-handling/try_delegate.wast:169: assert_exception passed -out/test/spec/exception-handling/try_delegate.wast:173: assert_exception passed -out/test/spec/exception-handling/try_delegate.wast:174: assert_exception passed -out/test/spec/exception-handling/try_delegate.wast:177: assert_malformed passed: - out/test/spec/exception-handling/try_delegate/try_delegate.1.wat:1:16: error: unexpected token "delegate", expected an instr. - (module (func (delegate 0))) - ^^^^^^^^ -out/test/spec/exception-handling/try_delegate.wast:182: assert_malformed passed: - out/test/spec/exception-handling/try_delegate/try_delegate.2.wat:1:46: error: unexpected token delegate, expected ). - (module (tag $e) (func (try (do) (catch $e) (delegate 0)))) - ^^^^^^^^ -out/test/spec/exception-handling/try_delegate.wast:187: assert_malformed passed: - out/test/spec/exception-handling/try_delegate/try_delegate.3.wat:1:38: error: unexpected token delegate, expected ). - (module (func (try (do) (catch_all) (delegate 0)))) - ^^^^^^^^ -out/test/spec/exception-handling/try_delegate.wast:192: assert_malformed passed: - out/test/spec/exception-handling/try_delegate/try_delegate.4.wat:1:34: error: unexpected token ")", expected a numeric index or a name (e.g. 12 or $foo). - (module (func (try (do) (delegate) (delegate 0)))) - ^ -out/test/spec/exception-handling/try_delegate.wast:197: assert_invalid passed: - out/test/spec/exception-handling/try_delegate/try_delegate.5.wasm:000001b: error: invalid depth: 2 (max 1) - 000001b: error: OnDelegateExpr callback failed -23/23 tests passed. -;;; STDOUT ;;) diff --git a/test/wasm2c/spec/exception-handling/rethrow.txt b/test/wasm2c/spec/exception-handling/rethrow.txt index 47d127328..909d6d20f 100644 --- a/test/wasm2c/spec/exception-handling/rethrow.txt +++ b/test/wasm2c/spec/exception-handling/rethrow.txt @@ -1,5 +1,5 @@ ;;; TOOL: run-spec-wasm2c -;;; STDIN_FILE: third_party/testsuite_legacy/rethrow.wast +;;; STDIN_FILE: third_party/testsuite/proposals/exception-handling/legacy/rethrow.wast ;;; ARGS*: --enable-exceptions (;; STDOUT ;;; 12/12 tests passed. diff --git a/test/wasm2c/spec/exception-handling/throw.txt b/test/wasm2c/spec/exception-handling/throw.txt index d624caa83..f4816ec4b 100644 --- a/test/wasm2c/spec/exception-handling/throw.txt +++ b/test/wasm2c/spec/exception-handling/throw.txt @@ -1,5 +1,5 @@ ;;; TOOL: run-spec-wasm2c -;;; STDIN_FILE: third_party/testsuite_legacy/throw.wast +;;; STDIN_FILE: third_party/testsuite/proposals/exception-handling/legacy/throw.wast ;;; ARGS*: --enable-exceptions (;; STDOUT ;;; 7/7 tests passed. diff --git a/test/wasm2c/spec/exception-handling/try_catch.txt b/test/wasm2c/spec/exception-handling/try_catch.txt index dde1ae077..18fbe4c25 100644 --- a/test/wasm2c/spec/exception-handling/try_catch.txt +++ b/test/wasm2c/spec/exception-handling/try_catch.txt @@ -1,6 +1,6 @@ ;;; TOOL: run-spec-wasm2c -;;; STDIN_FILE: third_party/testsuite_legacy/try_catch.wast +;;; STDIN_FILE: third_party/testsuite/proposals/exception-handling/legacy/try_catch.wast ;;; ARGS*: --enable-exceptions --enable-tail-call (;; STDOUT ;;; -29/29 tests passed. +31/31 tests passed. ;;; STDOUT ;;) diff --git a/test/wasm2c/spec/exception-handling/try_delegate.txt b/test/wasm2c/spec/exception-handling/try_delegate.txt index d5bc3ba37..d9f0f8dc2 100644 --- a/test/wasm2c/spec/exception-handling/try_delegate.txt +++ b/test/wasm2c/spec/exception-handling/try_delegate.txt @@ -1,6 +1,6 @@ ;;; TOOL: run-spec-wasm2c -;;; STDIN_FILE: third_party/testsuite_legacy/try_delegate.wast +;;; STDIN_FILE: third_party/testsuite/proposals/exception-handling/legacy/try_delegate.wast ;;; ARGS*: --enable-exceptions --enable-tail-call (;; STDOUT ;;; -17/17 tests passed. +20/20 tests passed. ;;; STDOUT ;;) diff --git a/third_party/testsuite_legacy/README.md b/third_party/testsuite_legacy/README.md deleted file mode 100644 index 765b9a83f..000000000 --- a/third_party/testsuite_legacy/README.md +++ /dev/null @@ -1,4 +0,0 @@ -The files in this directory are for the legacy exception handling proposal. - -They only need to exist for an interm period until the upstream testsuite -include: https://github.com/WebAssembly/testsuite/pull/81 diff --git a/third_party/testsuite_legacy/rethrow.wast b/third_party/testsuite_legacy/rethrow.wast deleted file mode 100644 index e41d94b2b..000000000 --- a/third_party/testsuite_legacy/rethrow.wast +++ /dev/null @@ -1,96 +0,0 @@ -;; Test rethrow instruction. - -(module - (tag $e0) - (tag $e1) - - (func (export "catch-rethrow-0") - (try - (do (throw $e0)) - (catch $e0 (rethrow 0)) - ) - ) - - (func (export "catch-rethrow-1") (param i32) (result i32) - (try (result i32) - (do (throw $e0)) - (catch $e0 - (if (i32.eqz (local.get 0)) (then (rethrow 1))) (i32.const 23) - ) - ) - ) - - (func (export "catchall-rethrow-0") - (try - (do (throw $e0)) - (catch_all (rethrow 0)) - ) - ) - - (func (export "catchall-rethrow-1") (param i32) (result i32) - (try (result i32) - (do (throw $e0)) - (catch_all - (if (i32.eqz (local.get 0)) (then (rethrow 1))) (i32.const 23) - ) - ) - ) - - (func (export "rethrow-nested") (param i32) (result i32) - (try (result i32) - (do (throw $e1)) - (catch $e1 - (try (result i32) - (do (throw $e0)) - (catch $e0 - (if (i32.eq (local.get 0) (i32.const 0)) (then (rethrow 1))) - (if (i32.eq (local.get 0) (i32.const 1)) (then (rethrow 2))) - (i32.const 23) - ) - ) - ) - ) - ) - - (func (export "rethrow-recatch") (param i32) (result i32) - (try (result i32) - (do (throw $e0)) - (catch $e0 - (try (result i32) - (do (if (i32.eqz (local.get 0)) (then (rethrow 2))) (i32.const 42)) - (catch $e0 (i32.const 23)) - ) - ) - ) - ) - - (func (export "rethrow-stack-polymorphism") - (try - (do (throw $e0)) - (catch $e0 (i32.const 1) (rethrow 0)) - ) - ) -) - -(assert_exception (invoke "catch-rethrow-0")) - -(assert_exception (invoke "catch-rethrow-1" (i32.const 0))) -(assert_return (invoke "catch-rethrow-1" (i32.const 1)) (i32.const 23)) - -(assert_exception (invoke "catchall-rethrow-0")) - -(assert_exception (invoke "catchall-rethrow-1" (i32.const 0))) -(assert_return (invoke "catchall-rethrow-1" (i32.const 1)) (i32.const 23)) -(assert_exception (invoke "rethrow-nested" (i32.const 0))) -(assert_exception (invoke "rethrow-nested" (i32.const 1))) -(assert_return (invoke "rethrow-nested" (i32.const 2)) (i32.const 23)) - -(assert_return (invoke "rethrow-recatch" (i32.const 0)) (i32.const 23)) -(assert_return (invoke "rethrow-recatch" (i32.const 1)) (i32.const 42)) - -(assert_exception (invoke "rethrow-stack-polymorphism")) - -(assert_invalid (module (func (rethrow 0))) "invalid rethrow label") -(assert_invalid (module (func (block (rethrow 0)))) "invalid rethrow label") -(assert_invalid (module (func (try (do (rethrow 0)) (delegate 0)))) - "invalid rethrow label") diff --git a/third_party/testsuite_legacy/throw.wast b/third_party/testsuite_legacy/throw.wast deleted file mode 100644 index d53b5b550..000000000 --- a/third_party/testsuite_legacy/throw.wast +++ /dev/null @@ -1,51 +0,0 @@ -;; Test throw instruction. - -(module - (tag $e0) - (tag $e-i32 (param i32)) - (tag $e-f32 (param f32)) - (tag $e-i64 (param i64)) - (tag $e-f64 (param f64)) - (tag $e-i32-i32 (param i32 i32)) - - (func $throw-if (export "throw-if") (param i32) (result i32) - (local.get 0) - (i32.const 0) (if (i32.ne) (then (throw $e0))) - (i32.const 0) - ) - - (func (export "throw-param-f32") (param f32) (local.get 0) (throw $e-f32)) - - (func (export "throw-param-i64") (param i64) (local.get 0) (throw $e-i64)) - - (func (export "throw-param-f64") (param f64) (local.get 0) (throw $e-f64)) - - (func $throw-1-2 (i32.const 1) (i32.const 2) (throw $e-i32-i32)) - (func (export "test-throw-1-2") - (try - (do (call $throw-1-2)) - (catch $e-i32-i32 - (i32.const 2) - (if (i32.ne) (then (unreachable))) - (i32.const 1) - (if (i32.ne) (then (unreachable))) - ) - ) - ) -) - -(assert_return (invoke "throw-if" (i32.const 0)) (i32.const 0)) -(assert_exception (invoke "throw-if" (i32.const 10))) -(assert_exception (invoke "throw-if" (i32.const -1))) - -(assert_exception (invoke "throw-param-f32" (f32.const 5.0))) -(assert_exception (invoke "throw-param-i64" (i64.const 5))) -(assert_exception (invoke "throw-param-f64" (f64.const 5.0))) - -(assert_return (invoke "test-throw-1-2")) - -(assert_invalid (module (func (throw 0))) "unknown tag 0") -(assert_invalid (module (tag (param i32)) (func (throw 0))) - "type mismatch: instruction requires [i32] but stack has []") -(assert_invalid (module (tag (param i32)) (func (i64.const 5) (throw 0))) - "type mismatch: instruction requires [i32] but stack has [i64]") diff --git a/third_party/testsuite_legacy/try_catch.wast b/third_party/testsuite_legacy/try_catch.wast deleted file mode 100644 index 2a0e9ff62..000000000 --- a/third_party/testsuite_legacy/try_catch.wast +++ /dev/null @@ -1,265 +0,0 @@ -;; Test try-catch blocks. - -(module - (tag $e0 (export "e0")) - (func (export "throw") (throw $e0)) -) - -(register "test") - -(module - (tag $imported-e0 (import "test" "e0")) - (func $imported-throw (import "test" "throw")) - (tag $e0) - (tag $e1) - (tag $e2) - (tag $e-i32 (param i32)) - (tag $e-f32 (param f32)) - (tag $e-i64 (param i64)) - (tag $e-f64 (param f64)) - - (func $throw-if (param i32) (result i32) - (local.get 0) - (i32.const 0) (if (i32.ne) (then (throw $e0))) - (i32.const 0) - ) - - (func (export "empty-catch") (try (do) (catch $e0))) - - (func (export "simple-throw-catch") (param i32) (result i32) - (try (result i32) - (do (local.get 0) (i32.eqz) (if (then (throw $e0)) (else)) (i32.const 42)) - (catch $e0 (i32.const 23)) - ) - ) - - (func (export "unreachable-not-caught") (try (do (unreachable)) (catch_all))) - - (func $div (param i32 i32) (result i32) - (local.get 0) (local.get 1) (i32.div_u) - ) - (func (export "trap-in-callee") (param i32 i32) (result i32) - (try (result i32) - (do (local.get 0) (local.get 1) (call $div)) - (catch_all (i32.const 11)) - ) - ) - - (func (export "catch-complex-1") (param i32) (result i32) - (try (result i32) - (do - (try (result i32) - (do - (local.get 0) - (i32.eqz) - (if - (then (throw $e0)) - (else - (local.get 0) - (i32.const 1) - (i32.eq) - (if (then (throw $e1)) (else (throw $e2))) - ) - ) - (i32.const 2) - ) - (catch $e0 (i32.const 3)) - ) - ) - (catch $e1 (i32.const 4)) - ) - ) - - (func (export "catch-complex-2") (param i32) (result i32) - (try (result i32) - (do - (local.get 0) - (i32.eqz) - (if - (then (throw $e0)) - (else - (local.get 0) - (i32.const 1) - (i32.eq) - (if (then (throw $e1)) (else (throw $e2))) - ) - ) - (i32.const 2) - ) - (catch $e0 (i32.const 3)) - (catch $e1 (i32.const 4)) - ) - ) - - (func (export "throw-catch-param-i32") (param i32) (result i32) - (try (result i32) - (do (local.get 0) (throw $e-i32) (i32.const 2)) - (catch $e-i32 (return)) - ) - ) - - (func (export "throw-catch-param-f32") (param f32) (result f32) - (try (result f32) - (do (local.get 0) (throw $e-f32) (f32.const 0)) - (catch $e-f32 (return)) - ) - ) - - (func (export "throw-catch-param-i64") (param i64) (result i64) - (try (result i64) - (do (local.get 0) (throw $e-i64) (i64.const 2)) - (catch $e-i64 (return)) - ) - ) - - (func (export "throw-catch-param-f64") (param f64) (result f64) - (try (result f64) - (do (local.get 0) (throw $e-f64) (f64.const 0)) - (catch $e-f64 (return)) - ) - ) - - (func $throw-param-i32 (param i32) (local.get 0) (throw $e-i32)) - (func (export "catch-param-i32") (param i32) (result i32) - (try (result i32) - (do (i32.const 0) (local.get 0) (call $throw-param-i32)) - (catch $e-i32) - ) - ) - - (func (export "catch-imported") (result i32) - (try (result i32) - (do - (i32.const 1) - (call $imported-throw) - ) - (catch $imported-e0 (i32.const 2)) - ) - ) - - (func (export "catchless-try") (param i32) (result i32) - (try (result i32) - (do - (try (result i32) - (do (local.get 0) (call $throw-if)) - ) - ) - (catch $e0 (i32.const 1)) - ) - ) - - (func $throw-void (throw $e0)) - (func (export "return-call-in-try-catch") - (try - (do - (return_call $throw-void) - ) - (catch $e0) - ) - ) - - (table funcref (elem $throw-void)) - (func (export "return-call-indirect-in-try-catch") - (try - (do - (return_call_indirect (param) (i32.const 0)) - ) - (catch $e0) - ) - ) -) - -(assert_return (invoke "empty-catch")) - -(assert_return (invoke "simple-throw-catch" (i32.const 0)) (i32.const 23)) -(assert_return (invoke "simple-throw-catch" (i32.const 1)) (i32.const 42)) - -(assert_trap (invoke "unreachable-not-caught") "unreachable") - -(assert_return (invoke "trap-in-callee" (i32.const 7) (i32.const 2)) (i32.const 3)) -(assert_trap (invoke "trap-in-callee" (i32.const 1) (i32.const 0)) "integer divide by zero") - -(assert_return (invoke "catch-complex-1" (i32.const 0)) (i32.const 3)) -(assert_return (invoke "catch-complex-1" (i32.const 1)) (i32.const 4)) -(assert_exception (invoke "catch-complex-1" (i32.const 2))) - -(assert_return (invoke "catch-complex-2" (i32.const 0)) (i32.const 3)) -(assert_return (invoke "catch-complex-2" (i32.const 1)) (i32.const 4)) -(assert_exception (invoke "catch-complex-2" (i32.const 2))) - -(assert_return (invoke "throw-catch-param-i32" (i32.const 0)) (i32.const 0)) -(assert_return (invoke "throw-catch-param-i32" (i32.const 1)) (i32.const 1)) -(assert_return (invoke "throw-catch-param-i32" (i32.const 10)) (i32.const 10)) - -(assert_return (invoke "throw-catch-param-f32" (f32.const 5.0)) (f32.const 5.0)) -(assert_return (invoke "throw-catch-param-f32" (f32.const 10.5)) (f32.const 10.5)) - -(assert_return (invoke "throw-catch-param-i64" (i64.const 5)) (i64.const 5)) -(assert_return (invoke "throw-catch-param-i64" (i64.const 0)) (i64.const 0)) -(assert_return (invoke "throw-catch-param-i64" (i64.const -1)) (i64.const -1)) - -(assert_return (invoke "throw-catch-param-f64" (f64.const 5.0)) (f64.const 5.0)) -(assert_return (invoke "throw-catch-param-f64" (f64.const 10.5)) (f64.const 10.5)) - -(assert_return (invoke "catch-param-i32" (i32.const 5)) (i32.const 5)) - -(assert_return (invoke "catch-imported") (i32.const 2)) - -(assert_return (invoke "catchless-try" (i32.const 0)) (i32.const 0)) -(assert_return (invoke "catchless-try" (i32.const 1)) (i32.const 1)) - -(assert_exception (invoke "return-call-in-try-catch")) -(assert_exception (invoke "return-call-indirect-in-try-catch")) - -(module - (func $imported-throw (import "test" "throw")) - (tag $e0) - - (func (export "imported-mismatch") (result i32) - (try (result i32) - (do - (try (result i32) - (do - (i32.const 1) - (call $imported-throw) - ) - (catch $e0 (i32.const 2)) - ) - ) - (catch_all (i32.const 3)) - ) - ) -) - -(assert_return (invoke "imported-mismatch") (i32.const 3)) - -(assert_malformed - (module quote "(module (func (catch_all)))") - "unexpected token" -) - -(assert_malformed - (module quote "(module (tag $e) (func (catch $e)))") - "unexpected token" -) - -(assert_malformed - (module quote - "(module (func (try (do) (catch_all) (catch_all))))" - ) - "unexpected token" -) - -(assert_invalid (module (func (result i32) (try (result i32) (do)))) - "type mismatch: instruction requires [i32] but stack has []") -(assert_invalid (module (func (result i32) (try (result i32) (do (i64.const 42))))) - "type mismatch: instruction requires [i32] but stack has [i64]") -(assert_invalid (module (tag) (func (try (do) (catch 0 (i32.const 42))))) - "type mismatch: block requires [] but stack has [i32]") -(assert_invalid (module - (tag (param i64)) - (func (result i32) - (try (result i32) (do (i32.const 42)) (catch 0)))) - "type mismatch: instruction requires [i32] but stack has [i64]") -(assert_invalid (module (func (try (do) (catch_all (i32.const 42))))) - "type mismatch: block requires [] but stack has [i32]") diff --git a/third_party/testsuite_legacy/try_delegate.wast b/third_party/testsuite_legacy/try_delegate.wast deleted file mode 100644 index aae3a301b..000000000 --- a/third_party/testsuite_legacy/try_delegate.wast +++ /dev/null @@ -1,199 +0,0 @@ -;; Test try-delegate blocks. - -(module - (tag $e0) - (tag $e1) - - (func (export "delegate-no-throw") (result i32) - (try $t (result i32) - (do (try (result i32) (do (i32.const 1)) (delegate $t))) - (catch $e0 (i32.const 2)) - ) - ) - - (func $throw-if (param i32) - (local.get 0) - (if (then (throw $e0)) (else)) - ) - - (func (export "delegate-throw") (param i32) (result i32) - (try $t (result i32) - (do - (try (result i32) - (do (local.get 0) (call $throw-if) (i32.const 1)) - (delegate $t) - ) - ) - (catch $e0 (i32.const 2)) - ) - ) - - (func (export "delegate-skip") (result i32) - (try $t (result i32) - (do - (try (result i32) - (do - (try (result i32) - (do (throw $e0) (i32.const 1)) - (delegate $t) - ) - ) - (catch $e0 (i32.const 2)) - ) - ) - (catch $e0 (i32.const 3)) - ) - ) - - (func (export "delegate-to-block") (result i32) - (try (result i32) - (do (block (try (do (throw $e0)) (delegate 0))) - (i32.const 0)) - (catch_all (i32.const 1))) - ) - - (func (export "delegate-to-catch") (result i32) - (try (result i32) - (do (try - (do (throw $e0)) - (catch $e0 - (try (do (rethrow 1)) (delegate 0)))) - (i32.const 0)) - (catch_all (i32.const 1))) - ) - - (func (export "delegate-to-caller-trivial") - (try - (do (throw $e0)) - (delegate 0))) - - (func (export "delegate-to-caller-skipping") - (try (do (try (do (throw $e0)) (delegate 1))) (catch_all)) - ) - - (func $select-tag (param i32) - (block (block (block (local.get 0) (br_table 0 1 2)) (return)) (throw $e0)) - (throw $e1) - ) - - (func (export "delegate-merge") (param i32 i32) (result i32) - (try $t (result i32) - (do - (local.get 0) - (call $select-tag) - (try - (result i32) - (do (local.get 1) (call $select-tag) (i32.const 1)) - (delegate $t) - ) - ) - (catch $e0 (i32.const 2)) - ) - ) - - (func (export "delegate-throw-no-catch") (result i32) - (try (result i32) - (do (try (result i32) (do (throw $e0) (i32.const 1)) (delegate 0))) - (catch $e1 (i32.const 2)) - ) - ) - - (func (export "delegate-correct-targets") (result i32) - (try (result i32) - (do (try $l3 - (do (try $l2 - (do (try $l1 - (do (try $l0 - (do (try - (do (throw $e0)) - (delegate $l1))) - (catch_all unreachable))) - (delegate $l3))) - (catch_all unreachable))) - (catch_all (try - (do (throw $e0)) - (delegate $l3)))) - unreachable) - (catch_all (i32.const 1)))) - - (func $throw-void (throw $e0)) - (func (export "return-call-in-try-delegate") - (try $l - (do - (try - (do - (return_call $throw-void) - ) - (delegate $l) - ) - ) - (catch $e0) - ) - ) - - (table funcref (elem $throw-void)) - (func (export "return-call-indirect-in-try-delegate") - (try $l - (do - (try - (do - (return_call_indirect (param) (i32.const 0)) - ) - (delegate $l) - ) - ) - (catch $e0) - ) - ) -) - -(assert_return (invoke "delegate-no-throw") (i32.const 1)) - -(assert_return (invoke "delegate-throw" (i32.const 0)) (i32.const 1)) -(assert_return (invoke "delegate-throw" (i32.const 1)) (i32.const 2)) - -(assert_exception (invoke "delegate-throw-no-catch")) - -(assert_return (invoke "delegate-merge" (i32.const 1) (i32.const 0)) (i32.const 2)) -(assert_exception (invoke "delegate-merge" (i32.const 2) (i32.const 0))) -(assert_return (invoke "delegate-merge" (i32.const 0) (i32.const 1)) (i32.const 2)) -(assert_exception (invoke "delegate-merge" (i32.const 0) (i32.const 2))) -(assert_return (invoke "delegate-merge" (i32.const 0) (i32.const 0)) (i32.const 1)) - -(assert_return (invoke "delegate-skip") (i32.const 3)) - -(assert_return (invoke "delegate-to-block") (i32.const 1)) -(assert_return (invoke "delegate-to-catch") (i32.const 1)) - -(assert_exception (invoke "delegate-to-caller-trivial")) -(assert_exception (invoke "delegate-to-caller-skipping")) - -(assert_return (invoke "delegate-correct-targets") (i32.const 1)) - -(assert_exception (invoke "return-call-in-try-delegate")) -(assert_exception (invoke "return-call-indirect-in-try-delegate")) - -(assert_malformed - (module quote "(module (func (delegate 0)))") - "unexpected token" -) - -(assert_malformed - (module quote "(module (tag $e) (func (try (do) (catch $e) (delegate 0))))") - "unexpected token" -) - -(assert_malformed - (module quote "(module (func (try (do) (catch_all) (delegate 0))))") - "unexpected token" -) - -(assert_malformed - (module quote "(module (func (try (do) (delegate) (delegate 0))))") - "unexpected token" -) - -(assert_invalid - (module (func (try (do) (delegate 1)))) - "unknown label" -)