* Add some (incomplete set) basic sanity end-to-end tests This commit adds some (an incomplete set of) basic sanity end-to-end tests. It uses `test.witx` to autogenerate types and module interface functions (aka the syscalls), and tests their implementation. For the host memory, it uses simplistic `&mut [u8]` where we have full control of the addressing and contents. * Add sanity test for baz interface func This commit adds a sanity test for the `Foo::baz` interface func. * Upcast start/len for Region to avoid overflow * Reenable alignment checking for memory * use an array to implement hostmemory Co-authored-by: Pat Hickey <pat@moreproductive.org>
52 lines
1.3 KiB
Plaintext
52 lines
1.3 KiB
Plaintext
(typename $errno
|
|
(enum u32
|
|
$ok
|
|
$invalid_arg
|
|
$dont_want_to
|
|
$physically_unable
|
|
$picket_line))
|
|
|
|
(typename $excuse
|
|
(enum u8
|
|
$dog_ate
|
|
$traffic
|
|
$sleeping))
|
|
|
|
(typename $pair_ints
|
|
(struct
|
|
(field $first s32)
|
|
(field $second s32)))
|
|
|
|
(typename $pair_int_ptrs
|
|
(struct
|
|
(field $first (@witx const_pointer s32))
|
|
(field $second (@witx const_pointer s32))))
|
|
|
|
(typename $named_ptr (@witx pointer f32))
|
|
(typename $named_ptr_to_ptr (@witx pointer (@witx pointer f64)))
|
|
|
|
(module $foo
|
|
(@interface func (export "bar")
|
|
(param $an_int u32)
|
|
(param $an_float f32)
|
|
(result $error $errno))
|
|
(@interface func (export "baz")
|
|
(param $an_excuse $excuse)
|
|
(param $an_excuse_by_reference (@witx pointer $excuse))
|
|
(param $a_lamer_excuse (@witx const_pointer $excuse))
|
|
(param $two_layers_of_excuses (@witx pointer (@witx const_pointer $excuse)))
|
|
(result $error $errno))
|
|
(@interface func (export "bat")
|
|
(param $an_int u32)
|
|
(result $error $errno)
|
|
(result $doubled_it f32))
|
|
(@interface func (export "sum_of_pair")
|
|
(param $an_pair $pair_ints)
|
|
(result $error $errno)
|
|
(result $doubled s64))
|
|
(@interface func (export "sum_of_pair_of_ptrs")
|
|
(param $an_pair $pair_int_ptrs)
|
|
(result $error $errno)
|
|
(result $doubled s64))
|
|
)
|