refactor: move Wasm test files to tests/all/cli_tests
Previously the inputs to `tests/all/cli_tests.rs` were contained in `tests/wasm`. This change moves them to the more obvious `tests/all/cli_tests` directory and updates the paths that point to them.
This commit is contained in:
9
tests/all/cli_tests/exit125_wasi_snapshot0.wat
Normal file
9
tests/all/cli_tests/exit125_wasi_snapshot0.wat
Normal file
@@ -0,0 +1,9 @@
|
||||
(module
|
||||
(import "wasi_unstable" "proc_exit"
|
||||
(func $__wasi_proc_exit (param i32)))
|
||||
(memory (export "memory") 0)
|
||||
(func $_start
|
||||
(call $__wasi_proc_exit (i32.const 125))
|
||||
)
|
||||
(export "_start" (func $_start))
|
||||
)
|
||||
9
tests/all/cli_tests/exit125_wasi_snapshot1.wat
Normal file
9
tests/all/cli_tests/exit125_wasi_snapshot1.wat
Normal file
@@ -0,0 +1,9 @@
|
||||
(module
|
||||
(import "wasi_snapshot_preview1" "proc_exit"
|
||||
(func $__wasi_proc_exit (param i32)))
|
||||
(memory (export "memory") 0)
|
||||
(func $_start
|
||||
(call $__wasi_proc_exit (i32.const 125))
|
||||
)
|
||||
(export "_start" (func $_start))
|
||||
)
|
||||
9
tests/all/cli_tests/exit126_wasi_snapshot0.wat
Normal file
9
tests/all/cli_tests/exit126_wasi_snapshot0.wat
Normal file
@@ -0,0 +1,9 @@
|
||||
(module
|
||||
(import "wasi_unstable" "proc_exit"
|
||||
(func $__wasi_proc_exit (param i32)))
|
||||
(memory (export "memory") 0)
|
||||
(func $_start
|
||||
(call $__wasi_proc_exit (i32.const 126))
|
||||
)
|
||||
(export "_start" (func $_start))
|
||||
)
|
||||
9
tests/all/cli_tests/exit126_wasi_snapshot1.wat
Normal file
9
tests/all/cli_tests/exit126_wasi_snapshot1.wat
Normal file
@@ -0,0 +1,9 @@
|
||||
(module
|
||||
(import "wasi_snapshot_preview1" "proc_exit"
|
||||
(func $__wasi_proc_exit (param i32)))
|
||||
(memory (export "memory") 0)
|
||||
(func $_start
|
||||
(call $__wasi_proc_exit (i32.const 126))
|
||||
)
|
||||
(export "_start" (func $_start))
|
||||
)
|
||||
9
tests/all/cli_tests/exit2_wasi_snapshot0.wat
Normal file
9
tests/all/cli_tests/exit2_wasi_snapshot0.wat
Normal file
@@ -0,0 +1,9 @@
|
||||
(module
|
||||
(import "wasi_unstable" "proc_exit"
|
||||
(func $__wasi_proc_exit (param i32)))
|
||||
(memory (export "memory") 0)
|
||||
(func $_start
|
||||
(call $__wasi_proc_exit (i32.const 2))
|
||||
)
|
||||
(export "_start" (func $_start))
|
||||
)
|
||||
9
tests/all/cli_tests/exit2_wasi_snapshot1.wat
Normal file
9
tests/all/cli_tests/exit2_wasi_snapshot1.wat
Normal file
@@ -0,0 +1,9 @@
|
||||
(module
|
||||
(import "wasi_snapshot_preview1" "proc_exit"
|
||||
(func $__wasi_proc_exit (param i32)))
|
||||
(memory (export "memory") 0)
|
||||
(func $_start
|
||||
(call $__wasi_proc_exit (i32.const 2))
|
||||
)
|
||||
(export "_start" (func $_start))
|
||||
)
|
||||
41
tests/all/cli_tests/exit_with_saved_fprs.wat
Normal file
41
tests/all/cli_tests/exit_with_saved_fprs.wat
Normal file
@@ -0,0 +1,41 @@
|
||||
;;; This is a test case for https://github.com/bytecodealliance/wasmtime/issues/1967
|
||||
(module
|
||||
(type (func (param i32)))
|
||||
|
||||
(import "wasi_snapshot_preview1" "proc_exit" (func (type 0)))
|
||||
(memory (export "memory") 0)
|
||||
|
||||
(func $exit (param i32)
|
||||
local.get 0
|
||||
call 0
|
||||
unreachable
|
||||
)
|
||||
|
||||
(func $do_something (param f64 f64 f64 f64 f64 f64 f64 f64)
|
||||
i32.const 0
|
||||
call $exit
|
||||
unreachable
|
||||
)
|
||||
|
||||
(func $has_saved_fprs (export "_start")
|
||||
(local f64 f64 f64 f64 f64 f64 f64 f64)
|
||||
(local.set 0 (f64.const 1))
|
||||
(local.set 1 (f64.const 2))
|
||||
(local.set 2 (f64.const 3))
|
||||
(local.set 3 (f64.const 4))
|
||||
(local.set 4 (f64.const 5))
|
||||
(local.set 5 (f64.const 6))
|
||||
(local.set 6 (f64.const 7))
|
||||
(local.set 7 (f64.const 8))
|
||||
local.get 0
|
||||
local.get 1
|
||||
local.get 2
|
||||
local.get 3
|
||||
local.get 4
|
||||
local.get 5
|
||||
local.get 6
|
||||
local.get 7
|
||||
call $do_something
|
||||
unreachable
|
||||
)
|
||||
)
|
||||
23
tests/all/cli_tests/greeter_callable_command.wat
Normal file
23
tests/all/cli_tests/greeter_callable_command.wat
Normal file
@@ -0,0 +1,23 @@
|
||||
;; Like greeter_reactor, but exports "_start" instead of "_initialize".
|
||||
(module
|
||||
(import "wasi_snapshot_preview1" "fd_write"
|
||||
(func $__wasi_fd_write (param i32 i32 i32 i32) (result i32)))
|
||||
(func (export "_start")
|
||||
(call $print (i32.const 32) (i32.const 22))
|
||||
)
|
||||
(func (export "greet")
|
||||
(call $print (i32.const 64) (i32.const 21))
|
||||
)
|
||||
(func $print (param $ptr i32) (param $len i32)
|
||||
(i32.store (i32.const 8) (local.get $len))
|
||||
(i32.store (i32.const 4) (local.get $ptr))
|
||||
(drop (call $__wasi_fd_write
|
||||
(i32.const 1)
|
||||
(i32.const 4)
|
||||
(i32.const 1)
|
||||
(i32.const 0)))
|
||||
)
|
||||
(memory (export "memory") 1)
|
||||
(data (i32.const 32) "Hello callable _start\0a")
|
||||
(data (i32.const 64) "Hello callable greet\0a")
|
||||
)
|
||||
22
tests/all/cli_tests/greeter_command.wat
Normal file
22
tests/all/cli_tests/greeter_command.wat
Normal file
@@ -0,0 +1,22 @@
|
||||
(module
|
||||
(import "wasi_snapshot_preview1" "fd_write"
|
||||
(func $__wasi_fd_write (param i32 i32 i32 i32) (result i32)))
|
||||
(import "reactor" "greet" (func $greet))
|
||||
(func (export "_start")
|
||||
(call $print (i32.const 32) (i32.const 13))
|
||||
(call $greet)
|
||||
(call $print (i32.const 64) (i32.const 11))
|
||||
)
|
||||
(func $print (param $ptr i32) (param $len i32)
|
||||
(i32.store (i32.const 8) (local.get $len))
|
||||
(i32.store (i32.const 4) (local.get $ptr))
|
||||
(drop (call $__wasi_fd_write
|
||||
(i32.const 1)
|
||||
(i32.const 4)
|
||||
(i32.const 1)
|
||||
(i32.const 0)))
|
||||
)
|
||||
(memory (export "memory") 1)
|
||||
(data (i32.const 32) "Hello _start\0a")
|
||||
(data (i32.const 64) "Hello done\0a")
|
||||
)
|
||||
22
tests/all/cli_tests/greeter_reactor.wat
Normal file
22
tests/all/cli_tests/greeter_reactor.wat
Normal file
@@ -0,0 +1,22 @@
|
||||
(module
|
||||
(import "wasi_snapshot_preview1" "fd_write"
|
||||
(func $__wasi_fd_write (param i32 i32 i32 i32) (result i32)))
|
||||
(func (export "_initialize")
|
||||
(call $print (i32.const 32) (i32.const 18))
|
||||
)
|
||||
(func (export "greet")
|
||||
(call $print (i32.const 64) (i32.const 12))
|
||||
)
|
||||
(func $print (param $ptr i32) (param $len i32)
|
||||
(i32.store (i32.const 8) (local.get $len))
|
||||
(i32.store (i32.const 4) (local.get $ptr))
|
||||
(drop (call $__wasi_fd_write
|
||||
(i32.const 1)
|
||||
(i32.const 4)
|
||||
(i32.const 1)
|
||||
(i32.const 0)))
|
||||
)
|
||||
(memory (export "memory") 1)
|
||||
(data (i32.const 32) "Hello _initialize\0a")
|
||||
(data (i32.const 64) "Hello greet\0a")
|
||||
)
|
||||
25
tests/all/cli_tests/hello_wasi_snapshot0.wat
Normal file
25
tests/all/cli_tests/hello_wasi_snapshot0.wat
Normal file
@@ -0,0 +1,25 @@
|
||||
(module
|
||||
(import "wasi_unstable" "proc_exit"
|
||||
(func $__wasi_proc_exit (param i32)))
|
||||
(import "wasi_unstable" "fd_write"
|
||||
(func $__wasi_fd_write (param i32 i32 i32 i32) (result i32)))
|
||||
(func $_start
|
||||
(i32.store (i32.const 24) (i32.const 14))
|
||||
(i32.store (i32.const 20) (i32.const 0))
|
||||
(block
|
||||
(br_if 0
|
||||
(call $__wasi_fd_write
|
||||
(i32.const 1)
|
||||
(i32.const 20)
|
||||
(i32.const 1)
|
||||
(i32.const 16)))
|
||||
(br_if 0 (i32.ne (i32.load (i32.const 16)) (i32.const 14)))
|
||||
(br 1)
|
||||
)
|
||||
(call $__wasi_proc_exit (i32.const 1))
|
||||
)
|
||||
(memory 1)
|
||||
(export "memory" (memory 0))
|
||||
(export "_start" (func $_start))
|
||||
(data (i32.const 0) "Hello, world!\0a")
|
||||
)
|
||||
25
tests/all/cli_tests/hello_wasi_snapshot1.wat
Normal file
25
tests/all/cli_tests/hello_wasi_snapshot1.wat
Normal file
@@ -0,0 +1,25 @@
|
||||
(module
|
||||
(import "wasi_snapshot_preview1" "proc_exit"
|
||||
(func $__wasi_proc_exit (param i32)))
|
||||
(import "wasi_snapshot_preview1" "fd_write"
|
||||
(func $__wasi_fd_write (param i32 i32 i32 i32) (result i32)))
|
||||
(func $_start
|
||||
(i32.store (i32.const 24) (i32.const 14))
|
||||
(i32.store (i32.const 20) (i32.const 0))
|
||||
(block
|
||||
(br_if 0
|
||||
(call $__wasi_fd_write
|
||||
(i32.const 1)
|
||||
(i32.const 20)
|
||||
(i32.const 1)
|
||||
(i32.const 16)))
|
||||
(br_if 0 (i32.ne (i32.load (i32.const 16)) (i32.const 14)))
|
||||
(br 1)
|
||||
)
|
||||
(call $__wasi_proc_exit (i32.const 1))
|
||||
)
|
||||
(memory 1)
|
||||
(export "memory" (memory 0))
|
||||
(export "_start" (func $_start))
|
||||
(data (i32.const 0) "Hello, world!\0a")
|
||||
)
|
||||
2
tests/all/cli_tests/iloop-invoke.wat
Normal file
2
tests/all/cli_tests/iloop-invoke.wat
Normal file
@@ -0,0 +1,2 @@
|
||||
(module
|
||||
(func (export "_start") (loop br 0)))
|
||||
3
tests/all/cli_tests/iloop-start.wat
Normal file
3
tests/all/cli_tests/iloop-start.wat
Normal file
@@ -0,0 +1,3 @@
|
||||
(module
|
||||
(start 0)
|
||||
(func (loop br 0)))
|
||||
13
tests/all/cli_tests/loop-params.wat
Normal file
13
tests/all/cli_tests/loop-params.wat
Normal file
@@ -0,0 +1,13 @@
|
||||
(module
|
||||
(func (export "run") (result i32)
|
||||
(local $i i32)
|
||||
(i32.const 0) ;; sum
|
||||
(i32.const 10) ;; i
|
||||
(loop $loop (param i32 i32) (result i32)
|
||||
(local.tee $i)
|
||||
(i32.add) ;; sum = i + sum
|
||||
(i32.sub (local.get $i) (i32.const 1))
|
||||
(i32.eqz (local.tee $i))
|
||||
(if (param i32) (result i32)
|
||||
(then)
|
||||
(else (local.get $i) (br $loop))))))
|
||||
3
tests/all/cli_tests/minimal-command.wat
Normal file
3
tests/all/cli_tests/minimal-command.wat
Normal file
@@ -0,0 +1,3 @@
|
||||
(module
|
||||
(func (export "_start"))
|
||||
)
|
||||
3
tests/all/cli_tests/minimal-reactor.wat
Normal file
3
tests/all/cli_tests/minimal-reactor.wat
Normal file
@@ -0,0 +1,3 @@
|
||||
(module
|
||||
(func (export "_initialize"))
|
||||
)
|
||||
20
tests/all/cli_tests/rs2wasm-add-func.wat
Normal file
20
tests/all/cli_tests/rs2wasm-add-func.wat
Normal file
@@ -0,0 +1,20 @@
|
||||
(module
|
||||
(type (;0;) (func))
|
||||
(type (;1;) (func (param i32 i32) (result i32)))
|
||||
(func $add (type 1) (param i32 i32) (result i32)
|
||||
get_local 1
|
||||
get_local 0
|
||||
i32.add)
|
||||
(func $start (type 0))
|
||||
(table (;0;) 1 1 anyfunc)
|
||||
(memory (;0;) 17)
|
||||
(global (;0;) i32 (i32.const 1049114))
|
||||
(global (;1;) i32 (i32.const 1049114))
|
||||
(export "memory" (memory 0))
|
||||
(export "__indirect_function_table" (table 0))
|
||||
(export "__heap_base" (global 0))
|
||||
(export "__data_end" (global 1))
|
||||
(export "add" (func $add))
|
||||
(export "start" (func $start))
|
||||
(data (i32.const 1048576) "\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00")
|
||||
(data (i32.const 1049092) "invalid malloc request"))
|
||||
7
tests/all/cli_tests/simple.wat
Normal file
7
tests/all/cli_tests/simple.wat
Normal file
@@ -0,0 +1,7 @@
|
||||
(module
|
||||
(func (export "simple") (param i32) (result i32)
|
||||
local.get 0
|
||||
)
|
||||
(func (export "get_f32") (result f32) f32.const 100)
|
||||
(func (export "get_f64") (result f64) f64.const 100)
|
||||
)
|
||||
5
tests/all/cli_tests/unreachable.wat
Normal file
5
tests/all/cli_tests/unreachable.wat
Normal file
@@ -0,0 +1,5 @@
|
||||
(module
|
||||
(func (export "_start")
|
||||
unreachable
|
||||
)
|
||||
)
|
||||
Reference in New Issue
Block a user