Skip to content

Commit 77ca584

Browse files
committed
implement roundtrip tests
1 parent 8d2eded commit 77ca584

7 files changed

Lines changed: 136 additions & 1 deletion

File tree

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
error: invalid value 'unknown' for '--features <FEATURES>': unknown feature `unknown`
2-
Valid features: mutable-global, saturating-float-to-int, sign-extension, reference-types, multi-value, bulk-memory, simd, relaxed-simd, threads, shared-everything-threads, tail-call, floats, multi-memory, exceptions, memory64, extended-const, component-model, function-references, memory-control, gc, custom-page-sizes, component-model-values, component-model-nested-names, component-model-more-flags, component-model-multiple-returns, legacy-exceptions, gc-types, stack-switching, wide-arithmetic, component-model-async, mvp, wasm1, wasm2, wasm3, all
2+
Valid features: mutable-global, saturating-float-to-int, sign-extension, reference-types, multi-value, bulk-memory, simd, relaxed-simd, threads, shared-everything-threads, tail-call, floats, multi-memory, exceptions, memory64, extended-const, component-model, function-references, memory-control, gc, custom-page-sizes, component-model-values, component-model-nested-names, component-model-more-flags, component-model-multiple-returns, legacy-exceptions, gc-types, stack-switching, wide-arithmetic, component-model-async, component-model-fixed-size-list, mvp, wasm1, wasm2, wasm3, all
33

44
For more information, try '--help'.
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
(component
2+
(core module $m
3+
(memory (export "memory") 1)
4+
(func (export "ret-list") (result i32) unreachable)
5+
)
6+
(core instance $i (instantiate $m))
7+
8+
(func (export "ret-list") (result (list u32 4))
9+
(canon lift (core func $i "ret-list") (memory $i "memory"))
10+
)
11+
)
12+
13+
(component
14+
(core module $m
15+
(func (export "param-list") (param i32 i32 i32 i32) unreachable)
16+
)
17+
(core instance $i (instantiate $m))
18+
19+
(func (export "param-list") (param "l" (list u32 4))
20+
(canon lift (core func $i "param-list"))
21+
)
22+
)
23+
24+
;; no easy way to check for an invalid u32?
25+
;;(assert_invalid
26+
;; (component
27+
;; (core module $m
28+
;; (memory (export "memory") 1)
29+
;; (func (export "ret-list") (result i32) unreachable)
30+
;; )
31+
;; (core instance $i (instantiate $m))
32+
;;
33+
;; (func (export "ret-list") (result (list u32 10000000000))
34+
;; (canon lift (core func $i "ret-list") (memory $i "memory"))
35+
;; )
36+
;; )
37+
;; "invalid u32 number: constant out of range"
38+
;;)
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
(assert_invalid
2+
(component
3+
(core module $m
4+
(memory (export "memory") 1)
5+
(func (export "ret-list") (result i32) unreachable)
6+
)
7+
(core instance $i (instantiate $m))
8+
9+
(func (export "ret-list") (result (list u32 4))
10+
(canon lift (core func $i "ret-list") (memory $i "memory"))
11+
)
12+
)
13+
"Fixed size lists require the component model fixed size list feature (at offset 0x54)"
14+
)
15+
16+
(assert_invalid
17+
(component
18+
(core module $m
19+
(func (export "param-list") (param i32 i32 i32 i32) unreachable)
20+
)
21+
(core instance $i (instantiate $m))
22+
23+
(func (export "param-list") (param "l" (list u32 4))
24+
(canon lift (core func $i "param-list"))
25+
)
26+
)
27+
"Fixed size lists require the component model fixed size list feature"
28+
)
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"source_filename": "tests/local/component-model/component-model-fixed-size-list/fixed-size-list.wast",
3+
"commands": [
4+
{
5+
"type": "module",
6+
"line": 1,
7+
"filename": "fixed-size-list.0.wasm",
8+
"module_type": "binary"
9+
},
10+
{
11+
"type": "module",
12+
"line": 13,
13+
"filename": "fixed-size-list.1.wasm",
14+
"module_type": "binary"
15+
}
16+
]
17+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
(component
2+
(core module $m (;0;)
3+
(type (;0;) (func (result i32)))
4+
(memory (;0;) 1)
5+
(export "memory" (memory 0))
6+
(export "ret-list" (func 0))
7+
(func (;0;) (type 0) (result i32)
8+
unreachable
9+
)
10+
)
11+
(core instance $i (;0;) (instantiate $m))
12+
(type (;0;) (list u32 4))
13+
(type (;1;) (func (result 0)))
14+
(alias core export $i "ret-list" (core func (;0;)))
15+
(alias core export $i "memory" (core memory (;0;)))
16+
(func (;0;) (type 1) (canon lift (core func 0) (memory 0)))
17+
(export (;1;) "ret-list" (func 0))
18+
)
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
(component
2+
(core module $m (;0;)
3+
(type (;0;) (func (param i32 i32 i32 i32)))
4+
(export "param-list" (func 0))
5+
(func (;0;) (type 0) (param i32 i32 i32 i32)
6+
unreachable
7+
)
8+
)
9+
(core instance $i (;0;) (instantiate $m))
10+
(type (;0;) (list u32 4))
11+
(type (;1;) (func (param "l" 0)))
12+
(alias core export $i "param-list" (core func (;0;)))
13+
(func (;0;) (type 1) (canon lift (core func 0)))
14+
(export (;1;) "param-list" (func 0))
15+
)
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"source_filename": "tests/local/missing-features/component-model/fixed-size-list.wast",
3+
"commands": [
4+
{
5+
"type": "assert_invalid",
6+
"line": 2,
7+
"filename": "fixed-size-list.0.wasm",
8+
"module_type": "binary",
9+
"text": "Fixed size lists require the component model fixed size list feature (at offset 0x54)"
10+
},
11+
{
12+
"type": "assert_invalid",
13+
"line": 17,
14+
"filename": "fixed-size-list.1.wasm",
15+
"module_type": "binary",
16+
"text": "Fixed size lists require the component model fixed size list feature"
17+
}
18+
]
19+
}

0 commit comments

Comments
 (0)