Skip to content

Commit

Permalink
Add some (incomplete set) basic sanity end-to-end tests (#2)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
kubkon and pchickey authored Feb 3, 2020
1 parent f321f05 commit 3d428b8
Show file tree
Hide file tree
Showing 5 changed files with 204 additions and 2,922 deletions.
4 changes: 2 additions & 2 deletions crates/memory/src/region.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ pub struct Region {
impl Region {
pub fn overlaps(&self, rhs: Region) -> bool {
let self_start = self.start as u64;
let self_end = self.start as u64 + self.len as u64;
let self_end = ((self_start + self.len as u64) as i64 - 1) as u64;

let rhs_start = rhs.start as u64;
let rhs_end = rhs.start as u64 + rhs.len as u64;
let rhs_end = ((rhs_start + rhs.len as u64) as i64 - 1) as u64;

// start of rhs inside self:
if rhs_start >= self_start && rhs_start < self_end {
Expand Down
Loading

0 comments on commit 3d428b8

Please sign in to comment.