diff options
Diffstat (limited to 'test/unit/input')
-rw-r--r-- | test/unit/input/bysyncify-pure.txt | 17 | ||||
-rw-r--r-- | test/unit/input/bysyncify-pure.wast | 59 |
2 files changed, 76 insertions, 0 deletions
diff --git a/test/unit/input/bysyncify-pure.txt b/test/unit/input/bysyncify-pure.txt new file mode 100644 index 000000000..1f85db1f1 --- /dev/null +++ b/test/unit/input/bysyncify-pure.txt @@ -0,0 +1,17 @@ +(i32.const 100) +(i32.const 10) +(i32.const 1) +(i32.const 20) +(i32.const 1000) +(i32.const 2000) +(i32.const 4000) +(i32.const 200) +(i32.const 300) +(i32.const 400) +(i32.const 1000) +(i32.const 3000) +(i32.const 4000) +(i32.const 30) +(i32.const 2) +(i32.const 40) +(i32.const 500) diff --git a/test/unit/input/bysyncify-pure.wast b/test/unit/input/bysyncify-pure.wast new file mode 100644 index 000000000..b79bfe2b0 --- /dev/null +++ b/test/unit/input/bysyncify-pure.wast @@ -0,0 +1,59 @@ +(module + (memory 1 1) + (import "spectest" "print" (func $print (param i32))) + (import "bysyncify" "start_unwind" (func $bysyncify_start_unwind (param i32))) + (import "bysyncify" "stop_unwind" (func $bysyncify_stop_unwind)) + (import "bysyncify" "start_rewind" (func $bysyncify_start_rewind (param i32))) + (import "bysyncify" "stop_rewind" (func $bysyncify_stop_rewind)) + (global $sleeping (mut i32) (i32.const 0)) + (start $runtime) + (func $main + (call $print (i32.const 10)) + (call $before) + (call $print (i32.const 20)) + (call $sleep) + (call $print (i32.const 30)) + (call $after) + (call $print (i32.const 40)) + ) + (func $before + (call $print (i32.const 1)) + ) + (func $sleep + (call $print (i32.const 1000)) + (if + (i32.eqz (global.get $sleeping)) + (block + (call $print (i32.const 2000)) + (global.set $sleeping (i32.const 1)) + (i32.store (i32.const 16) (i32.const 24)) + (i32.store (i32.const 20) (i32.const 1024)) + (call $bysyncify_start_unwind (i32.const 16)) + ) + (block + (call $print (i32.const 3000)) + (call $bysyncify_stop_rewind) + (global.set $sleeping (i32.const 0)) + ) + ) + (call $print (i32.const 4000)) + ) + (func $after + (call $print (i32.const 2)) + ) + (func $runtime + (call $print (i32.const 100)) + ;; call main the first time, let the stack unwind + (call $main) + (call $print (i32.const 200)) + (call $bysyncify_stop_unwind) + (call $print (i32.const 300)) + ;; ...can do some async stuff around here... + ;; set the rewind in motion + (call $bysyncify_start_rewind (i32.const 16)) + (call $print (i32.const 400)) + (call $main) + (call $print (i32.const 500)) + ) +) + |