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>
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user