Skip to content

Commit

Permalink
Import tests
Browse files Browse the repository at this point in the history
  • Loading branch information
virgil-serbanuta committed Jan 16, 2025
1 parent 48c1c90 commit 89e69ef
Show file tree
Hide file tree
Showing 14 changed files with 479 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tests/binary-parsing/import-func.wast
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
(module $mymodule
(type (;0;) (func))
(import "env" "managedSignalError" (func $managedSignalError (type 0)))
)
65 changes: 65 additions & 0 deletions tests/binary-parsing/import-func.wast.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<generatedTop>
<k>
#module (... types: #type (... type: [ .ValTypes ] -> [ .ValTypes ] , metadata: ) .EmptyStmts , funcs: .EmptyStmts , tables: .EmptyStmts , mems: .EmptyStmts , globals: .EmptyStmts , elem: .EmptyStmts , data: .EmptyStmts , start: .EmptyStmts , importDefns: #import ( "env" , "managedSignalError" , #funcDesc (... id: , type: 0 ) ) .EmptyStmts , exports: .EmptyStmts , metadata: #meta (... id: , funcIds: .Map , filename: .String ) ) ~> .K
</k>
<wasm>
<instrs>
.K
</instrs>
<valstack>
.ValStack
</valstack>
<curFrame>
<locals>
.List
</locals>
<curModIdx>
.Int
</curModIdx>
</curFrame>
<moduleRegistry>
.Map
</moduleRegistry>
<moduleIds>
.Map
</moduleIds>
<moduleInstances>
.ModuleInstCellMap
</moduleInstances>
<nextModuleIdx>
0
</nextModuleIdx>
<mainStore>
<funcs>
.FuncDefCellMap
</funcs>
<nextFuncAddr>
0
</nextFuncAddr>
<tabs>
.TabInstCellMap
</tabs>
<nextTabAddr>
0
</nextTabAddr>
<mems>
.List
</mems>
<globals>
.GlobalInstCellMap
</globals>
<nextGlobAddr>
0
</nextGlobAddr>
<elems>
.ElemInstCellMap
</elems>
<nextElemAddr>
0
</nextElemAddr>
</mainStore>
<deterministicMemoryGrowth>
true
</deterministicMemoryGrowth>
</wasm>
</generatedTop>
3 changes: 3 additions & 0 deletions tests/binary-parsing/import-global-const.wast
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
(module $mymodule
(import "env" "myGlobal" (global $myGlobal i32))
)
65 changes: 65 additions & 0 deletions tests/binary-parsing/import-global-const.wast.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<generatedTop>
<k>
#module (... types: .EmptyStmts , funcs: .EmptyStmts , tables: .EmptyStmts , mems: .EmptyStmts , globals: .EmptyStmts , elem: .EmptyStmts , data: .EmptyStmts , start: .EmptyStmts , importDefns: #import ( "env" , "myGlobal" , #globalDesc (... id: , type: const i32 ) ) .EmptyStmts , exports: .EmptyStmts , metadata: #meta (... id: , funcIds: .Map , filename: .String ) ) ~> .K
</k>
<wasm>
<instrs>
.K
</instrs>
<valstack>
.ValStack
</valstack>
<curFrame>
<locals>
.List
</locals>
<curModIdx>
.Int
</curModIdx>
</curFrame>
<moduleRegistry>
.Map
</moduleRegistry>
<moduleIds>
.Map
</moduleIds>
<moduleInstances>
.ModuleInstCellMap
</moduleInstances>
<nextModuleIdx>
0
</nextModuleIdx>
<mainStore>
<funcs>
.FuncDefCellMap
</funcs>
<nextFuncAddr>
0
</nextFuncAddr>
<tabs>
.TabInstCellMap
</tabs>
<nextTabAddr>
0
</nextTabAddr>
<mems>
.List
</mems>
<globals>
.GlobalInstCellMap
</globals>
<nextGlobAddr>
0
</nextGlobAddr>
<elems>
.ElemInstCellMap
</elems>
<nextElemAddr>
0
</nextElemAddr>
</mainStore>
<deterministicMemoryGrowth>
true
</deterministicMemoryGrowth>
</wasm>
</generatedTop>
3 changes: 3 additions & 0 deletions tests/binary-parsing/import-global-var.wast
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
(module $mymodule
(import "env" "myGlobal" (global $myGlobal (mut i32)))
)
65 changes: 65 additions & 0 deletions tests/binary-parsing/import-global-var.wast.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<generatedTop>
<k>
#module (... types: .EmptyStmts , funcs: .EmptyStmts , tables: .EmptyStmts , mems: .EmptyStmts , globals: .EmptyStmts , elem: .EmptyStmts , data: .EmptyStmts , start: .EmptyStmts , importDefns: #import ( "env" , "myGlobal" , #globalDesc (... id: , type: var i32 ) ) .EmptyStmts , exports: .EmptyStmts , metadata: #meta (... id: , funcIds: .Map , filename: .String ) ) ~> .K
</k>
<wasm>
<instrs>
.K
</instrs>
<valstack>
.ValStack
</valstack>
<curFrame>
<locals>
.List
</locals>
<curModIdx>
.Int
</curModIdx>
</curFrame>
<moduleRegistry>
.Map
</moduleRegistry>
<moduleIds>
.Map
</moduleIds>
<moduleInstances>
.ModuleInstCellMap
</moduleInstances>
<nextModuleIdx>
0
</nextModuleIdx>
<mainStore>
<funcs>
.FuncDefCellMap
</funcs>
<nextFuncAddr>
0
</nextFuncAddr>
<tabs>
.TabInstCellMap
</tabs>
<nextTabAddr>
0
</nextTabAddr>
<mems>
.List
</mems>
<globals>
.GlobalInstCellMap
</globals>
<nextGlobAddr>
0
</nextGlobAddr>
<elems>
.ElemInstCellMap
</elems>
<nextElemAddr>
0
</nextElemAddr>
</mainStore>
<deterministicMemoryGrowth>
true
</deterministicMemoryGrowth>
</wasm>
</generatedTop>
3 changes: 3 additions & 0 deletions tests/binary-parsing/import-memory.wast
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
(module $mymodule
(import "env" "myMem" (memory $myMem 10 20))
)
65 changes: 65 additions & 0 deletions tests/binary-parsing/import-memory.wast.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<generatedTop>
<k>
#module (... types: .EmptyStmts , funcs: .EmptyStmts , tables: .EmptyStmts , mems: .EmptyStmts , globals: .EmptyStmts , elem: .EmptyStmts , data: .EmptyStmts , start: .EmptyStmts , importDefns: #import ( "env" , "myMem" , #memoryDesc (... id: , type: #limits ( 10 , 20 ) ) ) .EmptyStmts , exports: .EmptyStmts , metadata: #meta (... id: , funcIds: .Map , filename: .String ) ) ~> .K
</k>
<wasm>
<instrs>
.K
</instrs>
<valstack>
.ValStack
</valstack>
<curFrame>
<locals>
.List
</locals>
<curModIdx>
.Int
</curModIdx>
</curFrame>
<moduleRegistry>
.Map
</moduleRegistry>
<moduleIds>
.Map
</moduleIds>
<moduleInstances>
.ModuleInstCellMap
</moduleInstances>
<nextModuleIdx>
0
</nextModuleIdx>
<mainStore>
<funcs>
.FuncDefCellMap
</funcs>
<nextFuncAddr>
0
</nextFuncAddr>
<tabs>
.TabInstCellMap
</tabs>
<nextTabAddr>
0
</nextTabAddr>
<mems>
.List
</mems>
<globals>
.GlobalInstCellMap
</globals>
<nextGlobAddr>
0
</nextGlobAddr>
<elems>
.ElemInstCellMap
</elems>
<nextElemAddr>
0
</nextElemAddr>
</mainStore>
<deterministicMemoryGrowth>
true
</deterministicMemoryGrowth>
</wasm>
</generatedTop>
3 changes: 3 additions & 0 deletions tests/binary-parsing/import-table-lim.wast
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
(module $mymodule
(import "env" "myTable" (table $myTable 10 20 funcref))
)
65 changes: 65 additions & 0 deletions tests/binary-parsing/import-table-lim.wast.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<generatedTop>
<k>
#module (... types: .EmptyStmts , funcs: .EmptyStmts , tables: .EmptyStmts , mems: .EmptyStmts , globals: .EmptyStmts , elem: .EmptyStmts , data: .EmptyStmts , start: .EmptyStmts , importDefns: #import ( "env" , "myTable" , #tableDesc (... id: , type: #limits ( 10 , 20 ) ) ) .EmptyStmts , exports: .EmptyStmts , metadata: #meta (... id: , funcIds: .Map , filename: .String ) ) ~> .K
</k>
<wasm>
<instrs>
.K
</instrs>
<valstack>
.ValStack
</valstack>
<curFrame>
<locals>
.List
</locals>
<curModIdx>
.Int
</curModIdx>
</curFrame>
<moduleRegistry>
.Map
</moduleRegistry>
<moduleIds>
.Map
</moduleIds>
<moduleInstances>
.ModuleInstCellMap
</moduleInstances>
<nextModuleIdx>
0
</nextModuleIdx>
<mainStore>
<funcs>
.FuncDefCellMap
</funcs>
<nextFuncAddr>
0
</nextFuncAddr>
<tabs>
.TabInstCellMap
</tabs>
<nextTabAddr>
0
</nextTabAddr>
<mems>
.List
</mems>
<globals>
.GlobalInstCellMap
</globals>
<nextGlobAddr>
0
</nextGlobAddr>
<elems>
.ElemInstCellMap
</elems>
<nextElemAddr>
0
</nextElemAddr>
</mainStore>
<deterministicMemoryGrowth>
true
</deterministicMemoryGrowth>
</wasm>
</generatedTop>
3 changes: 3 additions & 0 deletions tests/binary-parsing/import-table-minlim.wast
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
(module $mymodule
(import "env" "myTable" (table $myTable 10 funcref))
)
Loading

0 comments on commit 89e69ef

Please sign in to comment.