-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add tests/misc_testsuite/component-model-async/*.wast
These only test instantiation of components which use various async options and built-ins so far. Next, I'll happy and sad path tests which actually execute code. Signed-off-by: Joel Dice <[email protected]>
- Loading branch information
Showing
12 changed files
with
324 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
tests/misc_testsuite/component-model-async/error-context.wast
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
;;! component_model_async = true | ||
|
||
;; error-context.new | ||
(component | ||
(core module $libc (memory (export "memory") 1)) | ||
(core instance $libc (instantiate $libc)) | ||
(core module $m | ||
(import "" "error-context.new" (func $error-context-new (param i32 i32) (result i32))) | ||
) | ||
(core func $error-context-new (canon error-context.new (memory $libc "memory"))) | ||
(core instance $i (instantiate $m (with "" (instance (export "error-context.new" (func $error-context-new)))))) | ||
) | ||
|
||
;; error-context.debug-message | ||
(component | ||
(core module $libc | ||
(func (export "realloc") (param i32 i32 i32 i32) (result i32) unreachable) | ||
(memory (export "memory") 1) | ||
) | ||
(core instance $libc (instantiate $libc)) | ||
(core module $m | ||
(import "" "error-context.debug-message" (func $error-context-debug-message (param i32 i32))) | ||
) | ||
(core func $error-context-debug-message (canon error-context.debug-message (memory $libc "memory") (realloc (func $libc "realloc")))) | ||
(core instance $i (instantiate $m (with "" (instance (export "error-context.debug-message" (func $error-context-debug-message)))))) | ||
) | ||
|
||
;; error-context.drop | ||
(component | ||
(core module $m | ||
(import "" "error-context.drop" (func $error-context-drop (param i32))) | ||
) | ||
(core func $error-context-drop (canon error-context.drop)) | ||
(core instance $i (instantiate $m (with "" (instance (export "error-context.drop" (func $error-context-drop)))))) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
;;! component_model_async = true | ||
|
||
;; future.new | ||
(component | ||
(core module $m | ||
(import "" "future.new" (func $future-new (result i32))) | ||
) | ||
(type $future-type (future u8)) | ||
(core func $future-new (canon future.new $future-type)) | ||
(core instance $i (instantiate $m (with "" (instance (export "future.new" (func $future-new)))))) | ||
) | ||
|
||
;; future.read | ||
(component | ||
(core module $libc (memory (export "memory") 1)) | ||
(core instance $libc (instantiate $libc)) | ||
(core module $m | ||
(import "" "future.read" (func $future-read (param i32 i32) (result i32))) | ||
) | ||
(type $future-type (future u8)) | ||
(core func $future-read (canon future.read $future-type async (memory $libc "memory"))) | ||
(core instance $i (instantiate $m (with "" (instance (export "future.read" (func $future-read)))))) | ||
) | ||
|
||
;; future.read; with realloc | ||
(component | ||
(core module $libc | ||
(func (export "realloc") (param i32 i32 i32 i32) (result i32) unreachable) | ||
(memory (export "memory") 1) | ||
) | ||
(core instance $libc (instantiate $libc)) | ||
(core module $m | ||
(import "" "future.read" (func $future-read (param i32 i32) (result i32))) | ||
) | ||
(type $future-type (future string)) | ||
(core func $future-read (canon future.read $future-type async (memory $libc "memory") (realloc (func $libc "realloc")))) | ||
(core instance $i (instantiate $m (with "" (instance (export "future.read" (func $future-read)))))) | ||
) | ||
|
||
;; future.write | ||
(component | ||
(core module $libc (memory (export "memory") 1)) | ||
(core instance $libc (instantiate $libc)) | ||
(core module $m | ||
(import "" "future.write" (func $future-write (param i32 i32) (result i32))) | ||
) | ||
(type $future-type (future u8)) | ||
(core func $future-write (canon future.write $future-type async (memory $libc "memory"))) | ||
(core instance $i (instantiate $m (with "" (instance (export "future.write" (func $future-write)))))) | ||
) | ||
|
||
;; future.cancel-read | ||
(component | ||
(core module $m | ||
(import "" "future.cancel-read" (func $future-cancel-read (param i32) (result i32))) | ||
) | ||
(type $future-type (future u8)) | ||
(core func $future-cancel-read (canon future.cancel-read $future-type async)) | ||
(core instance $i (instantiate $m (with "" (instance (export "future.cancel-read" (func $future-cancel-read)))))) | ||
) | ||
|
||
;; future.cancel-write | ||
(component | ||
(core module $m | ||
(import "" "future.cancel-write" (func $future-cancel-write (param i32) (result i32))) | ||
) | ||
(type $future-type (future u8)) | ||
(core func $future-cancel-write (canon future.cancel-write $future-type async)) | ||
(core instance $i (instantiate $m (with "" (instance (export "future.cancel-write" (func $future-cancel-write)))))) | ||
) | ||
|
||
;; future.close-readable | ||
(component | ||
(core module $m | ||
(import "" "future.close-readable" (func $future-close-readable (param i32))) | ||
) | ||
(type $future-type (future u8)) | ||
(core func $future-close-readable (canon future.close-readable $future-type)) | ||
(core instance $i (instantiate $m (with "" (instance (export "future.close-readable" (func $future-close-readable)))))) | ||
) | ||
|
||
;; future.close-writable | ||
(component | ||
(core module $m | ||
(import "" "future.close-writable" (func $future-close-writable (param i32 i32))) | ||
) | ||
(type $future-type (future u8)) | ||
(core func $future-close-writable (canon future.close-writable $future-type)) | ||
(core instance $i (instantiate $m (with "" (instance (export "future.close-writable" (func $future-close-writable)))))) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
;;! component_model_async = true | ||
|
||
;; async lift; no callback | ||
(component | ||
(core module $m | ||
(func (export "foo") (param i32) unreachable) | ||
) | ||
(core instance $i (instantiate $m)) | ||
|
||
(func (export "foo") (param "p1" u32) (result u32) | ||
(canon lift (core func $i "foo") async) | ||
) | ||
) | ||
|
||
;; async lift; with callback | ||
(component | ||
(core module $m | ||
(func (export "callback") (param i32 i32 i32 i32) (result i32) unreachable) | ||
(func (export "foo") (param i32) (result i32) unreachable) | ||
) | ||
(core instance $i (instantiate $m)) | ||
|
||
(func (export "foo") (param "p1" u32) (result u32) | ||
(canon lift (core func $i "foo") async (callback (func $i "callback"))) | ||
) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
;;! component_model_async = true | ||
|
||
;; async lower | ||
(component | ||
(import "host-echo-u32" (func $foo (param "p1" u32) (result u32))) | ||
(core module $libc (memory (export "memory") 1)) | ||
(core instance $libc (instantiate $libc)) | ||
(core func $foo (canon lower (func $foo) async (memory $libc "memory"))) | ||
(core module $m | ||
(func (import "" "foo") (param i32 i32) (result i32)) | ||
) | ||
(core instance $i (instantiate $m (with "" (instance (export "foo" (func $foo)))))) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
;;! component_model_async = true | ||
|
||
;; stream.new | ||
(component | ||
(core module $m | ||
(import "" "stream.new" (func $stream-new (result i32))) | ||
) | ||
(type $stream-type (stream u8)) | ||
(core func $stream-new (canon stream.new $stream-type)) | ||
(core instance $i (instantiate $m (with "" (instance (export "stream.new" (func $stream-new)))))) | ||
) | ||
|
||
;; stream.read | ||
(component | ||
(core module $libc (memory (export "memory") 1)) | ||
(core instance $libc (instantiate $libc)) | ||
(core module $m | ||
(import "" "stream.read" (func $stream-read (param i32 i32 i32) (result i32))) | ||
) | ||
(type $stream-type (stream u8)) | ||
(core func $stream-read (canon stream.read $stream-type async (memory $libc "memory"))) | ||
(core instance $i (instantiate $m (with "" (instance (export "stream.read" (func $stream-read)))))) | ||
) | ||
|
||
;; stream.read; with realloc | ||
(component | ||
(core module $libc | ||
(func (export "realloc") (param i32 i32 i32 i32) (result i32) unreachable) | ||
(memory (export "memory") 1) | ||
) | ||
(core instance $libc (instantiate $libc)) | ||
(core module $m | ||
(import "" "stream.read" (func $stream-read (param i32 i32 i32) (result i32))) | ||
) | ||
(type $stream-type (stream string)) | ||
(core func $stream-read (canon stream.read $stream-type async (memory $libc "memory") (realloc (func $libc "realloc")))) | ||
(core instance $i (instantiate $m (with "" (instance (export "stream.read" (func $stream-read)))))) | ||
) | ||
|
||
;; stream.write | ||
(component | ||
(core module $libc (memory (export "memory") 1)) | ||
(core instance $libc (instantiate $libc)) | ||
(core module $m | ||
(import "" "stream.write" (func $stream-write (param i32 i32 i32) (result i32))) | ||
) | ||
(type $stream-type (stream u8)) | ||
(core func $stream-write (canon stream.write $stream-type async (memory $libc "memory"))) | ||
(core instance $i (instantiate $m (with "" (instance (export "stream.write" (func $stream-write)))))) | ||
) | ||
|
||
;; stream.cancel-read | ||
(component | ||
(core module $m | ||
(import "" "stream.cancel-read" (func $stream-cancel-read (param i32) (result i32))) | ||
) | ||
(type $stream-type (stream u8)) | ||
(core func $stream-cancel-read (canon stream.cancel-read $stream-type async)) | ||
(core instance $i (instantiate $m (with "" (instance (export "stream.cancel-read" (func $stream-cancel-read)))))) | ||
) | ||
|
||
;; stream.cancel-write | ||
(component | ||
(core module $m | ||
(import "" "stream.cancel-write" (func $stream-cancel-write (param i32) (result i32))) | ||
) | ||
(type $stream-type (stream u8)) | ||
(core func $stream-cancel-write (canon stream.cancel-write $stream-type async)) | ||
(core instance $i (instantiate $m (with "" (instance (export "stream.cancel-write" (func $stream-cancel-write)))))) | ||
) | ||
|
||
;; stream.close-readable | ||
(component | ||
(core module $m | ||
(import "" "stream.close-readable" (func $stream-close-readable (param i32))) | ||
) | ||
(type $stream-type (stream u8)) | ||
(core func $stream-close-readable (canon stream.close-readable $stream-type)) | ||
(core instance $i (instantiate $m (with "" (instance (export "stream.close-readable" (func $stream-close-readable)))))) | ||
) | ||
|
||
;; stream.close-writable | ||
(component | ||
(core module $m | ||
(import "" "stream.close-writable" (func $stream-close-writable (param i32 i32))) | ||
) | ||
(type $stream-type (stream u8)) | ||
(core func $stream-close-writable (canon stream.close-writable $stream-type)) | ||
(core instance $i (instantiate $m (with "" (instance (export "stream.close-writable" (func $stream-close-writable)))))) | ||
) |
60 changes: 60 additions & 0 deletions
60
tests/misc_testsuite/component-model-async/task-builtins.wast
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
;;! component_model_async = true | ||
|
||
;; task.backpressure | ||
(component | ||
(core module $m | ||
(import "" "task.backpressure" (func $task-backpressure (param i32))) | ||
) | ||
(core func $task-backpressure (canon task.backpressure)) | ||
(core instance $i (instantiate $m (with "" (instance (export "task.backpressure" (func $task-backpressure)))))) | ||
) | ||
|
||
;; task.return | ||
(component | ||
(core module $m | ||
(import "" "task.return" (func $task-return (param i32))) | ||
) | ||
(core type $task-return-type (func (param i32))) | ||
(core func $task-return (canon task.return $task-return-type)) | ||
(core instance $i (instantiate $m (with "" (instance (export "task.return" (func $task-return)))))) | ||
) | ||
|
||
;; task.wait | ||
(component | ||
(core module $libc (memory (export "memory") 1)) | ||
(core instance $libc (instantiate $libc)) | ||
(core module $m | ||
(import "" "task.wait" (func $task-wait (param i32) (result i32))) | ||
) | ||
(core func $task-wait (canon task.wait async (memory $libc "memory"))) | ||
(core instance $i (instantiate $m (with "" (instance (export "task.wait" (func $task-wait)))))) | ||
) | ||
|
||
;; task.poll | ||
(component | ||
(core module $libc (memory (export "memory") 1)) | ||
(core instance $libc (instantiate $libc)) | ||
(core module $m | ||
(import "" "task.poll" (func $task-poll (param i32) (result i32))) | ||
) | ||
(core func $task-poll (canon task.poll async (memory $libc "memory"))) | ||
(core instance $i (instantiate $m (with "" (instance (export "task.poll" (func $task-poll)))))) | ||
) | ||
|
||
;; task.yield | ||
(component | ||
(core module $m | ||
(import "" "task.yield" (func $task-yield)) | ||
) | ||
(core func $task-yield (canon task.yield async)) | ||
(core instance $i (instantiate $m (with "" (instance (export "task.yield" (func $task-yield)))))) | ||
) | ||
|
||
;; subtask.drop | ||
(component | ||
(core module $m | ||
(import "" "subtask.drop" (func $subtask-drop (param i32))) | ||
) | ||
(core func $subtask-drop (canon subtask.drop)) | ||
(core instance $i (instantiate $m (with "" (instance (export "subtask.drop" (func $subtask-drop)))))) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters