Skip to content

Commit

Permalink
[Test] Add the threads tests.
Browse files Browse the repository at this point in the history
Please refer to this issue:
WebAssembly/threads#195

Signed-off-by: YiYing He <[email protected]>
  • Loading branch information
q82419 committed May 26, 2023
1 parent 1138067 commit 1bd4cd7
Show file tree
Hide file tree
Showing 340 changed files with 2,536 additions and 0 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@

* `core/select/select.wast` line 325: `invalid result arity` -> `type mismatch`
* This error message is for the WAT format, WASM format cannot detect this error by the bytecode.
* `threads/atomic/atomic.wast`: divergence behavior
* Please check [this issue](https://github.com/WebAssembly/threads/issues/195).
* Modified the `wast` file for fitting the `compare_exchange_strong` behavior in C++.

## Branches And Tags

Expand Down
Binary file added threads/atomic/atomic.0.wasm
Binary file not shown.
Binary file added threads/atomic/atomic.1.wasm
Binary file not shown.
Binary file added threads/atomic/atomic.10.wasm
Binary file not shown.
Binary file added threads/atomic/atomic.11.wasm
Binary file not shown.
Binary file added threads/atomic/atomic.12.wasm
Binary file not shown.
Binary file added threads/atomic/atomic.13.wasm
Binary file not shown.
Binary file added threads/atomic/atomic.14.wasm
Binary file not shown.
Binary file added threads/atomic/atomic.15.wasm
Binary file not shown.
Binary file added threads/atomic/atomic.16.wasm
Binary file not shown.
Binary file added threads/atomic/atomic.17.wasm
Binary file not shown.
Binary file added threads/atomic/atomic.18.wasm
Binary file not shown.
Binary file added threads/atomic/atomic.19.wasm
Binary file not shown.
Binary file added threads/atomic/atomic.2.wasm
Binary file not shown.
Binary file added threads/atomic/atomic.20.wasm
Binary file not shown.
Binary file added threads/atomic/atomic.21.wasm
Binary file not shown.
Binary file added threads/atomic/atomic.22.wasm
Binary file not shown.
Binary file added threads/atomic/atomic.23.wasm
Binary file not shown.
Binary file added threads/atomic/atomic.24.wasm
Binary file not shown.
Binary file added threads/atomic/atomic.25.wasm
Binary file not shown.
Binary file added threads/atomic/atomic.26.wasm
Binary file not shown.
Binary file added threads/atomic/atomic.27.wasm
Binary file not shown.
Binary file added threads/atomic/atomic.28.wasm
Binary file not shown.
Binary file added threads/atomic/atomic.29.wasm
Binary file not shown.
Binary file added threads/atomic/atomic.3.wasm
Binary file not shown.
Binary file added threads/atomic/atomic.30.wasm
Binary file not shown.
Binary file added threads/atomic/atomic.31.wasm
Binary file not shown.
Binary file added threads/atomic/atomic.32.wasm
Binary file not shown.
Binary file added threads/atomic/atomic.33.wasm
Binary file not shown.
Binary file added threads/atomic/atomic.34.wasm
Binary file not shown.
Binary file added threads/atomic/atomic.35.wasm
Binary file not shown.
Binary file added threads/atomic/atomic.36.wasm
Binary file not shown.
Binary file added threads/atomic/atomic.37.wasm
Binary file not shown.
Binary file added threads/atomic/atomic.38.wasm
Binary file not shown.
Binary file added threads/atomic/atomic.39.wasm
Binary file not shown.
Binary file added threads/atomic/atomic.4.wasm
Binary file not shown.
Binary file added threads/atomic/atomic.40.wasm
Binary file not shown.
Binary file added threads/atomic/atomic.41.wasm
Binary file not shown.
Binary file added threads/atomic/atomic.42.wasm
Binary file not shown.
Binary file added threads/atomic/atomic.43.wasm
Binary file not shown.
Binary file added threads/atomic/atomic.44.wasm
Binary file not shown.
Binary file added threads/atomic/atomic.45.wasm
Binary file not shown.
Binary file added threads/atomic/atomic.46.wasm
Binary file not shown.
Binary file added threads/atomic/atomic.47.wasm
Binary file not shown.
Binary file added threads/atomic/atomic.48.wasm
Binary file not shown.
Binary file added threads/atomic/atomic.49.wasm
Binary file not shown.
Binary file added threads/atomic/atomic.5.wasm
Binary file not shown.
Binary file added threads/atomic/atomic.50.wasm
Binary file not shown.
Binary file added threads/atomic/atomic.51.wasm
Binary file not shown.
Binary file added threads/atomic/atomic.52.wasm
Binary file not shown.
Binary file added threads/atomic/atomic.6.wasm
Binary file not shown.
Binary file added threads/atomic/atomic.7.wasm
Binary file not shown.
Binary file added threads/atomic/atomic.8.wasm
Binary file not shown.
Binary file added threads/atomic/atomic.9.wasm
Binary file not shown.
329 changes: 329 additions & 0 deletions threads/atomic/atomic.json

Large diffs are not rendered by default.

611 changes: 611 additions & 0 deletions threads/atomic/atomic.wast

Large diffs are not rendered by default.

Binary file added threads/exports/exports.0.wasm
Binary file not shown.
Binary file added threads/exports/exports.1.wasm
Binary file not shown.
Binary file added threads/exports/exports.10.wasm
Binary file not shown.
Binary file added threads/exports/exports.11.wasm
Binary file not shown.
Binary file added threads/exports/exports.12.wasm
Binary file not shown.
Binary file added threads/exports/exports.13.wasm
Binary file not shown.
Binary file added threads/exports/exports.14.wasm
Binary file not shown.
Binary file added threads/exports/exports.15.wasm
Binary file not shown.
Binary file added threads/exports/exports.16.wasm
Binary file not shown.
Binary file added threads/exports/exports.17.wasm
Binary file not shown.
Binary file added threads/exports/exports.18.wasm
Binary file not shown.
Binary file added threads/exports/exports.19.wasm
Binary file not shown.
Binary file added threads/exports/exports.2.wasm
Binary file not shown.
Binary file added threads/exports/exports.20.wasm
Binary file not shown.
Binary file added threads/exports/exports.21.wasm
Binary file not shown.
Binary file added threads/exports/exports.22.wasm
Binary file not shown.
Binary file added threads/exports/exports.23.wasm
Binary file not shown.
Binary file added threads/exports/exports.24.wasm
Binary file not shown.
Binary file added threads/exports/exports.25.wasm
Binary file not shown.
Binary file added threads/exports/exports.26.wasm
Binary file not shown.
Binary file added threads/exports/exports.27.wasm
Binary file not shown.
Binary file added threads/exports/exports.28.wasm
Binary file not shown.
Binary file added threads/exports/exports.29.wasm
Binary file not shown.
Binary file added threads/exports/exports.3.wasm
Binary file not shown.
Binary file added threads/exports/exports.30.wasm
Binary file not shown.
Binary file added threads/exports/exports.31.wasm
Binary file not shown.
Binary file added threads/exports/exports.32.wasm
Binary file not shown.
Binary file added threads/exports/exports.33.wasm
Binary file not shown.
Binary file added threads/exports/exports.34.wasm
Binary file not shown.
Binary file added threads/exports/exports.35.wasm
Binary file not shown.
Binary file added threads/exports/exports.36.wasm
Binary file not shown.
Binary file added threads/exports/exports.37.wasm
Binary file not shown.
Binary file added threads/exports/exports.38.wasm
Binary file not shown.
Binary file added threads/exports/exports.39.wasm
Binary file not shown.
Binary file added threads/exports/exports.4.wasm
Binary file not shown.
Binary file added threads/exports/exports.40.wasm
Binary file not shown.
Binary file added threads/exports/exports.41.wasm
Binary file not shown.
Binary file added threads/exports/exports.42.wasm
Binary file not shown.
Binary file added threads/exports/exports.43.wasm
Binary file not shown.
Binary file added threads/exports/exports.44.wasm
Binary file not shown.
Binary file added threads/exports/exports.45.wasm
Binary file not shown.
Binary file added threads/exports/exports.46.wasm
Binary file not shown.
Binary file added threads/exports/exports.47.wasm
Binary file not shown.
Binary file added threads/exports/exports.48.wasm
Binary file not shown.
Binary file added threads/exports/exports.49.wasm
Binary file not shown.
Binary file added threads/exports/exports.5.wasm
Binary file not shown.
Binary file added threads/exports/exports.50.wasm
Binary file not shown.
Binary file added threads/exports/exports.51.wasm
Binary file not shown.
Binary file added threads/exports/exports.52.wasm
Binary file not shown.
Binary file added threads/exports/exports.53.wasm
Binary file not shown.
Binary file added threads/exports/exports.54.wasm
Binary file not shown.
Binary file added threads/exports/exports.55.wasm
Binary file not shown.
Binary file added threads/exports/exports.56.wasm
Binary file not shown.
Binary file added threads/exports/exports.57.wasm
Binary file not shown.
Binary file added threads/exports/exports.58.wasm
Binary file not shown.
Binary file added threads/exports/exports.59.wasm
Binary file not shown.
Binary file added threads/exports/exports.6.wasm
Binary file not shown.
Binary file added threads/exports/exports.60.wasm
Binary file not shown.
Binary file added threads/exports/exports.61.wasm
Binary file not shown.
Binary file added threads/exports/exports.62.wasm
Binary file not shown.
Binary file added threads/exports/exports.63.wasm
Binary file not shown.
Binary file added threads/exports/exports.64.wasm
Binary file not shown.
Binary file added threads/exports/exports.65.wasm
Binary file not shown.
Binary file added threads/exports/exports.66.wasm
Binary file not shown.
Binary file added threads/exports/exports.67.wasm
Binary file not shown.
Binary file added threads/exports/exports.68.wasm
Binary file not shown.
Binary file added threads/exports/exports.69.wasm
Binary file not shown.
Binary file added threads/exports/exports.7.wasm
Binary file not shown.
Binary file added threads/exports/exports.70.wasm
Binary file not shown.
Binary file added threads/exports/exports.71.wasm
Binary file not shown.
Binary file added threads/exports/exports.72.wasm
Binary file not shown.
Binary file added threads/exports/exports.73.wasm
Binary file not shown.
Binary file added threads/exports/exports.74.wasm
Binary file not shown.
Binary file added threads/exports/exports.75.wasm
Binary file not shown.
Binary file added threads/exports/exports.76.wasm
Binary file not shown.
Binary file added threads/exports/exports.77.wasm
Binary file not shown.
Binary file added threads/exports/exports.78.wasm
Binary file not shown.
Binary file added threads/exports/exports.79.wasm
Binary file not shown.
Binary file added threads/exports/exports.8.wasm
Binary file not shown.
Binary file added threads/exports/exports.80.wasm
Binary file not shown.
Binary file added threads/exports/exports.81.wasm
Binary file not shown.
Binary file added threads/exports/exports.82.wasm
Binary file not shown.
Binary file added threads/exports/exports.83.wasm
Binary file not shown.
Binary file added threads/exports/exports.84.wasm
Binary file not shown.
Binary file added threads/exports/exports.85.wasm
Binary file not shown.
Binary file added threads/exports/exports.86.wasm
Binary file not shown.
Binary file added threads/exports/exports.87.wasm
Binary file not shown.
Binary file added threads/exports/exports.88.wasm
Binary file not shown.
Binary file added threads/exports/exports.89.wasm
Binary file not shown.
Binary file added threads/exports/exports.9.wasm
Binary file not shown.
Binary file added threads/exports/exports.90.wasm
Binary file not shown.
Binary file added threads/exports/exports.91.wasm
Binary file not shown.
Binary file added threads/exports/exports.92.wasm
Binary file not shown.
104 changes: 104 additions & 0 deletions threads/exports/exports.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
{"source_filename": "exports.wast",
"commands": [
{"type": "module", "line": 3, "filename": "exports.0.wasm"},
{"type": "module", "line": 4, "filename": "exports.1.wasm"},
{"type": "module", "line": 5, "filename": "exports.2.wasm"},
{"type": "module", "line": 7, "filename": "exports.3.wasm"},
{"type": "module", "line": 8, "filename": "exports.4.wasm"},
{"type": "module", "line": 9, "filename": "exports.5.wasm"},
{"type": "module", "line": 10, "filename": "exports.6.wasm"},
{"type": "module", "line": 11, "filename": "exports.7.wasm"},
{"type": "module", "line": 12, "filename": "exports.8.wasm"},
{"type": "module", "line": 13, "filename": "exports.9.wasm"},
{"type": "module", "line": 14, "filename": "exports.10.wasm"},
{"type": "module", "line": 16, "name": "$Func", "filename": "exports.11.wasm"},
{"type": "assert_return", "line": 22, "action": {"type": "invoke", "field": "e", "args": [{"type": "i32", "value": "42"}]}, "expected": [{"type": "i32", "value": "43"}]},
{"type": "assert_return", "line": 23, "action": {"type": "invoke", "module": "$Func", "field": "e", "args": [{"type": "i32", "value": "42"}]}, "expected": [{"type": "i32", "value": "43"}]},
{"type": "module", "line": 24, "filename": "exports.12.wasm"},
{"type": "module", "line": 25, "name": "$Other1", "filename": "exports.13.wasm"},
{"type": "assert_return", "line": 26, "action": {"type": "invoke", "module": "$Func", "field": "e", "args": [{"type": "i32", "value": "42"}]}, "expected": [{"type": "i32", "value": "43"}]},
{"type": "module", "line": 28, "filename": "exports.14.wasm"},
{"type": "assert_return", "line": 34, "action": {"type": "invoke", "field": "a", "args": []}, "expected": [{"type": "i32", "value": "42"}]},
{"type": "assert_return", "line": 35, "action": {"type": "invoke", "field": "b", "args": []}, "expected": [{"type": "i32", "value": "42"}]},
{"type": "assert_return", "line": 36, "action": {"type": "invoke", "field": "c", "args": []}, "expected": [{"type": "i32", "value": "42"}]},
{"type": "assert_invalid", "line": 39, "filename": "exports.15.wasm", "text": "unknown function", "module_type": "binary"},
{"type": "assert_invalid", "line": 43, "filename": "exports.16.wasm", "text": "unknown function", "module_type": "binary"},
{"type": "assert_invalid", "line": 47, "filename": "exports.17.wasm", "text": "unknown function", "module_type": "binary"},
{"type": "assert_invalid", "line": 51, "filename": "exports.18.wasm", "text": "duplicate export name", "module_type": "binary"},
{"type": "assert_invalid", "line": 55, "filename": "exports.19.wasm", "text": "duplicate export name", "module_type": "binary"},
{"type": "assert_invalid", "line": 59, "filename": "exports.20.wasm", "text": "duplicate export name", "module_type": "binary"},
{"type": "assert_invalid", "line": 63, "filename": "exports.21.wasm", "text": "duplicate export name", "module_type": "binary"},
{"type": "assert_invalid", "line": 67, "filename": "exports.22.wasm", "text": "duplicate export name", "module_type": "binary"},
{"type": "module", "line": 74, "filename": "exports.23.wasm"},
{"type": "module", "line": 75, "filename": "exports.24.wasm"},
{"type": "module", "line": 76, "filename": "exports.25.wasm"},
{"type": "module", "line": 78, "filename": "exports.26.wasm"},
{"type": "module", "line": 79, "filename": "exports.27.wasm"},
{"type": "module", "line": 80, "filename": "exports.28.wasm"},
{"type": "module", "line": 81, "filename": "exports.29.wasm"},
{"type": "module", "line": 82, "filename": "exports.30.wasm"},
{"type": "module", "line": 83, "filename": "exports.31.wasm"},
{"type": "module", "line": 85, "name": "$Global", "filename": "exports.32.wasm"},
{"type": "assert_return", "line": 89, "action": {"type": "get", "field": "e"}, "expected": [{"type": "i32", "value": "42"}]},
{"type": "assert_return", "line": 90, "action": {"type": "get", "module": "$Global", "field": "e"}, "expected": [{"type": "i32", "value": "42"}]},
{"type": "module", "line": 91, "filename": "exports.33.wasm"},
{"type": "module", "line": 92, "name": "$Other2", "filename": "exports.34.wasm"},
{"type": "assert_return", "line": 93, "action": {"type": "get", "module": "$Global", "field": "e"}, "expected": [{"type": "i32", "value": "42"}]},
{"type": "assert_invalid", "line": 96, "filename": "exports.35.wasm", "text": "unknown global", "module_type": "binary"},
{"type": "assert_invalid", "line": 100, "filename": "exports.36.wasm", "text": "unknown global", "module_type": "binary"},
{"type": "assert_invalid", "line": 104, "filename": "exports.37.wasm", "text": "unknown global", "module_type": "binary"},
{"type": "assert_invalid", "line": 108, "filename": "exports.38.wasm", "text": "duplicate export name", "module_type": "binary"},
{"type": "assert_invalid", "line": 112, "filename": "exports.39.wasm", "text": "duplicate export name", "module_type": "binary"},
{"type": "assert_invalid", "line": 116, "filename": "exports.40.wasm", "text": "duplicate export name", "module_type": "binary"},
{"type": "assert_invalid", "line": 120, "filename": "exports.41.wasm", "text": "duplicate export name", "module_type": "binary"},
{"type": "assert_invalid", "line": 124, "filename": "exports.42.wasm", "text": "duplicate export name", "module_type": "binary"},
{"type": "module", "line": 131, "filename": "exports.43.wasm"},
{"type": "module", "line": 132, "filename": "exports.44.wasm"},
{"type": "module", "line": 133, "filename": "exports.45.wasm"},
{"type": "module", "line": 135, "filename": "exports.46.wasm"},
{"type": "module", "line": 136, "filename": "exports.47.wasm"},
{"type": "module", "line": 137, "filename": "exports.48.wasm"},
{"type": "module", "line": 138, "filename": "exports.49.wasm"},
{"type": "module", "line": 139, "filename": "exports.50.wasm"},
{"type": "module", "line": 140, "filename": "exports.51.wasm"},
{"type": "module", "line": 141, "filename": "exports.52.wasm"},
{"type": "module", "line": 142, "filename": "exports.53.wasm"},
{"type": "module", "line": 143, "filename": "exports.54.wasm"},
{"type": "module", "line": 144, "filename": "exports.55.wasm"},
{"type": "module", "line": 145, "filename": "exports.56.wasm"},
{"type": "module", "line": 146, "filename": "exports.57.wasm"},
{"type": "assert_invalid", "line": 151, "filename": "exports.58.wasm", "text": "unknown table", "module_type": "binary"},
{"type": "assert_invalid", "line": 155, "filename": "exports.59.wasm", "text": "unknown table", "module_type": "binary"},
{"type": "assert_invalid", "line": 159, "filename": "exports.60.wasm", "text": "unknown table", "module_type": "binary"},
{"type": "assert_invalid", "line": 163, "filename": "exports.61.wasm", "text": "duplicate export name", "module_type": "binary"},
{"type": "assert_invalid", "line": 167, "filename": "exports.62.wasm", "text": "duplicate export name", "module_type": "binary"},
{"type": "assert_invalid", "line": 171, "filename": "exports.63.wasm", "text": "duplicate export name", "module_type": "binary"},
{"type": "assert_invalid", "line": 175, "filename": "exports.64.wasm", "text": "duplicate export name", "module_type": "binary"},
{"type": "assert_invalid", "line": 179, "filename": "exports.65.wasm", "text": "duplicate export name", "module_type": "binary"},
{"type": "module", "line": 186, "filename": "exports.66.wasm"},
{"type": "module", "line": 187, "filename": "exports.67.wasm"},
{"type": "module", "line": 191, "filename": "exports.68.wasm"},
{"type": "module", "line": 192, "filename": "exports.69.wasm"},
{"type": "module", "line": 193, "filename": "exports.70.wasm"},
{"type": "module", "line": 194, "filename": "exports.71.wasm"},
{"type": "module", "line": 195, "filename": "exports.72.wasm"},
{"type": "module", "line": 196, "filename": "exports.73.wasm"},
{"type": "module", "line": 197, "filename": "exports.74.wasm"},
{"type": "module", "line": 198, "filename": "exports.75.wasm"},
{"type": "module", "line": 199, "filename": "exports.76.wasm"},
{"type": "module", "line": 200, "filename": "exports.77.wasm"},
{"type": "module", "line": 201, "filename": "exports.78.wasm"},
{"type": "module", "line": 202, "filename": "exports.79.wasm"},
{"type": "module", "line": 204, "filename": "exports.80.wasm"},
{"type": "module", "line": 205, "filename": "exports.81.wasm"},
{"type": "module", "line": 206, "filename": "exports.82.wasm"},
{"type": "module", "line": 207, "filename": "exports.83.wasm"},
{"type": "module", "line": 208, "filename": "exports.84.wasm"},
{"type": "module", "line": 209, "filename": "exports.85.wasm"},
{"type": "assert_invalid", "line": 214, "filename": "exports.86.wasm", "text": "unknown memory", "module_type": "binary"},
{"type": "assert_invalid", "line": 218, "filename": "exports.87.wasm", "text": "unknown memory", "module_type": "binary"},
{"type": "assert_invalid", "line": 222, "filename": "exports.88.wasm", "text": "unknown memory", "module_type": "binary"},
{"type": "assert_invalid", "line": 226, "filename": "exports.89.wasm", "text": "duplicate export name", "module_type": "binary"},
{"type": "assert_invalid", "line": 235, "filename": "exports.90.wasm", "text": "duplicate export name", "module_type": "binary"},
{"type": "assert_invalid", "line": 239, "filename": "exports.91.wasm", "text": "duplicate export name", "module_type": "binary"},
{"type": "assert_invalid", "line": 243, "filename": "exports.92.wasm", "text": "duplicate export name", "module_type": "binary"}]}
245 changes: 245 additions & 0 deletions threads/exports/exports.wast
Original file line number Diff line number Diff line change
@@ -0,0 +1,245 @@
;; Functions

(module (func) (export "a" (func 0)))
(module (func) (export "a" (func 0)) (export "b" (func 0)))
(module (func) (func) (export "a" (func 0)) (export "b" (func 1)))

(module (func (export "a")))
(module (func (export "a") (export "b") (export "c")))
(module (func (export "a") (export "b") (param i32)))
(module (func) (export "a" (func 0)))
(module (func $a (export "a")))
(module (func $a) (export "a" (func $a)))
(module (export "a" (func 0)) (func))
(module (export "a" (func $a)) (func $a))

(module $Func
(export "e" (func $f))
(func $f (param $n i32) (result i32)
(return (i32.add (local.get $n) (i32.const 1)))
)
)
(assert_return (invoke "e" (i32.const 42)) (i32.const 43))
(assert_return (invoke $Func "e" (i32.const 42)) (i32.const 43))
(module)
(module $Other1)
(assert_return (invoke $Func "e" (i32.const 42)) (i32.const 43))

(module
(type (;0;) (func (result i32)))
(func (;0;) (type 0) (result i32) i32.const 42)
(export "a" (func 0))
(export "b" (func 0))
(export "c" (func 0)))
(assert_return (invoke "a") (i32.const 42))
(assert_return (invoke "b") (i32.const 42))
(assert_return (invoke "c") (i32.const 42))

(assert_invalid
(module (export "a" (func 0)))
"unknown function"
)
(assert_invalid
(module (func) (export "a" (func 1)))
"unknown function"
)
(assert_invalid
(module (import "spectest" "print_i32" (func (param i32))) (export "a" (func 1)))
"unknown function"
)
(assert_invalid
(module (func) (export "a" (func 0)) (export "a" (func 0)))
"duplicate export name"
)
(assert_invalid
(module (func) (func) (export "a" (func 0)) (export "a" (func 1)))
"duplicate export name"
)
(assert_invalid
(module (func) (global i32 (i32.const 0)) (export "a" (func 0)) (export "a" (global 0)))
"duplicate export name"
)
(assert_invalid
(module (func) (table 0 funcref) (export "a" (func 0)) (export "a" (table 0)))
"duplicate export name"
)
(assert_invalid
(module (func) (memory 0) (export "a" (func 0)) (export "a" (memory 0)))
"duplicate export name"
)


;; Globals

(module (global i32 (i32.const 0)) (export "a" (global 0)))
(module (global i32 (i32.const 0)) (export "a" (global 0)) (export "b" (global 0)))
(module (global i32 (i32.const 0)) (global i32 (i32.const 0)) (export "a" (global 0)) (export "b" (global 1)))

(module (global (export "a") i32 (i32.const 0)))
(module (global i32 (i32.const 0)) (export "a" (global 0)))
(module (global $a (export "a") i32 (i32.const 0)))
(module (global $a i32 (i32.const 0)) (export "a" (global $a)))
(module (export "a" (global 0)) (global i32 (i32.const 0)))
(module (export "a" (global $a)) (global $a i32 (i32.const 0)))

(module $Global
(export "e" (global $g))
(global $g i32 (i32.const 42))
)
(assert_return (get "e") (i32.const 42))
(assert_return (get $Global "e") (i32.const 42))
(module)
(module $Other2)
(assert_return (get $Global "e") (i32.const 42))

(assert_invalid
(module (export "a" (global 0)))
"unknown global"
)
(assert_invalid
(module (global i32 (i32.const 0)) (export "a" (global 1)))
"unknown global"
)
(assert_invalid
(module (import "spectest" "global_i32" (global i32)) (export "a" (global 1)))
"unknown global"
)
(assert_invalid
(module (global i32 (i32.const 0)) (export "a" (global 0)) (export "a" (global 0)))
"duplicate export name"
)
(assert_invalid
(module (global i32 (i32.const 0)) (global i32 (i32.const 0)) (export "a" (global 0)) (export "a" (global 1)))
"duplicate export name"
)
(assert_invalid
(module (global i32 (i32.const 0)) (func) (export "a" (global 0)) (export "a" (func 0)))
"duplicate export name"
)
(assert_invalid
(module (global i32 (i32.const 0)) (table 0 funcref) (export "a" (global 0)) (export "a" (table 0)))
"duplicate export name"
)
(assert_invalid
(module (global i32 (i32.const 0)) (memory 0) (export "a" (global 0)) (export "a" (memory 0)))
"duplicate export name"
)


;; Tables

(module (table 0 funcref) (export "a" (table 0)))
(module (table 0 funcref) (export "a" (table 0)) (export "b" (table 0)))
(module (table 0 funcref) (table 0 funcref) (export "a" (table 0)) (export "b" (table 1)))

(module (table (export "a") 0 funcref))
(module (table (export "a") 0 1 funcref))
(module (table 0 funcref) (export "a" (table 0)))
(module (table 0 1 funcref) (export "a" (table 0)))
(module (table $a (export "a") 0 funcref))
(module (table $a (export "a") 0 1 funcref))
(module (table $a 0 funcref) (export "a" (table $a)))
(module (table $a 0 1 funcref) (export "a" (table $a)))
(module (export "a" (table 0)) (table 0 funcref))
(module (export "a" (table 0)) (table 0 1 funcref))
(module (export "a" (table $a)) (table $a 0 funcref))
(module (export "a" (table $a)) (table $a 0 1 funcref))

(; TODO: access table ;)

(assert_invalid
(module (export "a" (table 0)))
"unknown table"
)
(assert_invalid
(module (table 0 funcref) (export "a" (table 1)))
"unknown table"
)
(assert_invalid
(module (import "spectest" "table" (table 10 20 funcref)) (export "a" (table 1)))
"unknown table"
)
(assert_invalid
(module (table 0 funcref) (export "a" (table 0)) (export "a" (table 0)))
"duplicate export name"
)
(assert_invalid
(module (table 0 funcref) (table 0 funcref) (export "a" (table 0)) (export "a" (table 1)))
"duplicate export name"
)
(assert_invalid
(module (table 0 funcref) (func) (export "a" (table 0)) (export "a" (func 0)))
"duplicate export name"
)
(assert_invalid
(module (table 0 funcref) (global i32 (i32.const 0)) (export "a" (table 0)) (export "a" (global 0)))
"duplicate export name"
)
(assert_invalid
(module (table 0 funcref) (memory 0) (export "a" (table 0)) (export "a" (memory 0)))
"duplicate export name"
)


;; Memories

(module (memory 0) (export "a" (memory 0)))
(module (memory 0) (export "a" (memory 0)) (export "b" (memory 0)))
;; No multiple memories yet.
;; (module (memory 0) (memory 0) (export "a" (memory 0)) (export "b" (memory 1)))

(module (memory (export "a") 0))
(module (memory (export "a") 0 1))
(module (memory 0) (export "a" (memory 0)))
(module (memory 0 1) (export "a" (memory 0)))
(module (memory $a (export "a") 0))
(module (memory $a (export "a") 0 1))
(module (memory $a 0) (export "a" (memory $a)))
(module (memory $a 0 1) (export "a" (memory $a)))
(module (export "a" (memory 0)) (memory 0))
(module (export "a" (memory 0)) (memory 0 1))
(module (export "a" (memory $a)) (memory $a 0))
(module (export "a" (memory $a)) (memory $a 0 1))

(module (memory (export "a") 0 1 shared))
(module (memory 0 1 shared) (export "a" (memory 0)))
(module (memory $a (export "a") 0 1 shared))
(module (memory $a 0 1 shared) (export "a" (memory $a)))
(module (export "a" (memory 0)) (memory 0 1 shared))
(module (export "a" (memory $a)) (memory $a 0 1 shared))

(; TODO: access memory ;)

(assert_invalid
(module (export "a" (memory 0)))
"unknown memory"
)
(assert_invalid
(module (memory 0) (export "a" (memory 1)))
"unknown memory"
)
(assert_invalid
(module (import "spectest" "memory" (memory 1 2)) (export "a" (memory 1)))
"unknown memory"
)
(assert_invalid
(module (memory 0) (export "a" (memory 0)) (export "a" (memory 0)))
"duplicate export name"
)
;; No multiple memories yet.
;; (assert_invalid
;; (module (memory 0) (memory 0) (export "a" (memory 0)) (export "a" (memory 1)))
;; "duplicate export name"
;; )
(assert_invalid
(module (memory 0) (func) (export "a" (memory 0)) (export "a" (func 0)))
"duplicate export name"
)
(assert_invalid
(module (memory 0) (global i32 (i32.const 0)) (export "a" (memory 0)) (export "a" (global 0)))
"duplicate export name"
)
(assert_invalid
(module (memory 0) (table 0 funcref) (export "a" (memory 0)) (export "a" (table 0)))
"duplicate export name"
)
Binary file added threads/imports/imports.0.wasm
Binary file not shown.
Binary file added threads/imports/imports.1.wasm
Binary file not shown.
Binary file added threads/imports/imports.10.wasm
Binary file not shown.
Binary file added threads/imports/imports.100.wasm
Binary file not shown.
Binary file added threads/imports/imports.101.wasm
Binary file not shown.
Binary file added threads/imports/imports.102.wasm
Binary file not shown.
Binary file added threads/imports/imports.103.wasm
Binary file not shown.
Binary file added threads/imports/imports.104.wasm
Binary file not shown.
Binary file added threads/imports/imports.105.wasm
Binary file not shown.
Binary file added threads/imports/imports.106.wasm
Binary file not shown.
Binary file added threads/imports/imports.107.wasm
Binary file not shown.
Binary file added threads/imports/imports.108.wasm
Binary file not shown.
Binary file added threads/imports/imports.109.wasm
Binary file not shown.
Binary file added threads/imports/imports.11.wasm
Binary file not shown.
Binary file added threads/imports/imports.110.wasm
Binary file not shown.
Binary file added threads/imports/imports.111.wasm
Binary file not shown.
Binary file added threads/imports/imports.112.wasm
Binary file not shown.
Binary file added threads/imports/imports.113.wasm
Binary file not shown.
Binary file added threads/imports/imports.114.wasm
Binary file not shown.
Binary file added threads/imports/imports.115.wasm
Binary file not shown.
Binary file added threads/imports/imports.116.wasm
Binary file not shown.
Binary file added threads/imports/imports.117.wasm
Binary file not shown.
Binary file added threads/imports/imports.118.wasm
Binary file not shown.
Binary file added threads/imports/imports.119.wasm
Binary file not shown.
Binary file added threads/imports/imports.12.wasm
Binary file not shown.
Binary file added threads/imports/imports.120.wasm
Binary file not shown.
Binary file added threads/imports/imports.121.wasm
Binary file not shown.
Binary file added threads/imports/imports.122.wasm
Binary file not shown.
Binary file added threads/imports/imports.123.wasm
Binary file not shown.
Binary file added threads/imports/imports.124.wasm
Binary file not shown.
Binary file added threads/imports/imports.125.wasm
Binary file not shown.
Binary file added threads/imports/imports.126.wasm
Binary file not shown.
Binary file added threads/imports/imports.127.wasm
Binary file not shown.
Binary file added threads/imports/imports.128.wasm
Binary file not shown.
Binary file added threads/imports/imports.129.wasm
Binary file not shown.
Binary file added threads/imports/imports.13.wasm
Binary file not shown.
1 change: 1 addition & 0 deletions threads/imports/imports.130.wat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(func) (import "" "" (func))
1 change: 1 addition & 0 deletions threads/imports/imports.131.wat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(func) (import "" "" (global i64))
1 change: 1 addition & 0 deletions threads/imports/imports.132.wat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(func) (import "" "" (table 0 funcref))
1 change: 1 addition & 0 deletions threads/imports/imports.133.wat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(func) (import "" "" (memory 0))
1 change: 1 addition & 0 deletions threads/imports/imports.134.wat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(global i64 (i64.const 0)) (import "" "" (func))
1 change: 1 addition & 0 deletions threads/imports/imports.135.wat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(global i64 (i64.const 0)) (import "" "" (global f32))
1 change: 1 addition & 0 deletions threads/imports/imports.136.wat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(global i64 (i64.const 0)) (import "" "" (table 0 funcref))
1 change: 1 addition & 0 deletions threads/imports/imports.137.wat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(global i64 (i64.const 0)) (import "" "" (memory 0))
1 change: 1 addition & 0 deletions threads/imports/imports.138.wat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(table 0 funcref) (import "" "" (func))
1 change: 1 addition & 0 deletions threads/imports/imports.139.wat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(table 0 funcref) (import "" "" (global i32))
Binary file added threads/imports/imports.14.wasm
Binary file not shown.
1 change: 1 addition & 0 deletions threads/imports/imports.140.wat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(table 0 funcref) (import "" "" (table 0 funcref))
1 change: 1 addition & 0 deletions threads/imports/imports.141.wat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(table 0 funcref) (import "" "" (memory 0))
1 change: 1 addition & 0 deletions threads/imports/imports.142.wat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(memory 0) (import "" "" (func))
Loading

0 comments on commit 1bd4cd7

Please sign in to comment.