Commit Graph

18 Commits

Author SHA1 Message Date
Jakub Konka
2687b01474 Refactor Region struct (#4)
* Add some basic sanity tests for Region

This commit adds some basic sanity tests for `overlap` method
of `Region`.

* Refactor overlaps method of Region struct

This commit refactors `Region::overlaps` method.

* Add some docs

* Assert Region's len is nonzero
2020-02-04 23:26:18 +01:00
Pat Hickey
67d2ce6d85 Refactor tests to use proptest (#6)
* generator: take an &mut GuestMemory

rather than pass the owned GuestMemory in, just give exclusive access
to it. Makes testing easier.

* tests: start transforming tests to check abi-level generated code as well

* finish lowering of test funcs

* tests: rename variables to more sensible names

* proptesting: reliably finds that we dont allow stuff to be right against end of memory!

* memory: fix off-by-one calc in GuestMemory::contains(&self, Region)

ty proptest!

also, refactored the Region::overlaps to be the same code but easier to
read.

* generator: better location information in GuestError

* testing: proptest generates memory areas, tests everything
2020-02-04 22:35:38 +01:00
Jakub Konka
e6cec049cb Add basic CI conf (#3)
* Add basic CI conf

* Pull in submodules in Rustfmt job

* Exclude WASI from workspace; fix name clash in memory crate

* Refactor CI conf
2020-02-03 09:59:09 +01:00
Jakub Konka
3d428b828f Add some (incomplete set) basic sanity end-to-end tests (#2)
* 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>
2020-02-03 07:38:48 +01:00
Pat Hickey
e2079c085d report which field a struct validation error occured in 2020-01-29 13:18:57 -08:00
Pat Hickey
814dd19488 structs that contain pointers work! 2020-01-28 18:17:48 -08:00
Pat Hickey
35d9373976 we now validate Copy structs 2020-01-28 16:34:34 -08:00
Pat Hickey
373560b88a and now funcs work again 2020-01-27 20:28:27 -08:00
Pat Hickey
c780421c28 i think the memory model is fixed now? at least until arrays.... 2020-01-27 20:21:53 -08:00
Pat Hickey
ec456e9e50 new memory model. not quite complete 2020-01-27 18:20:47 -08:00
Pat Hickey
a20ef36a49 multiple layers of pointers work! 2020-01-24 19:57:18 -08:00
Pat Hickey
020778b7da we can handle one layer of pointers! 2020-01-24 18:08:37 -08:00
Pat Hickey
b4f21752b0 generate a module trait and call it 2020-01-23 12:53:10 -08:00
Pat Hickey
cb24fd97c0 better error trait design 2020-01-23 11:21:04 -08:00
Pat Hickey
c05475b806 generate: now we have a way to do errors, i guess 2020-01-22 20:47:40 -08:00
Pat Hickey
aa5c5f7018 flesh out the guest type traits a bit further 2020-01-22 16:38:25 -08:00
Pat Hickey
cd686915aa clear out a bunch of old code, reorganize 2020-01-19 18:46:16 -08:00
Pat Hickey
0d47556cf7 import memory sub-crate 2020-01-17 15:41:19 -08:00