Skip to content

Commit 3d428b8

Browse files
kubkonpchickey
andauthored
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 <[email protected]>
1 parent f321f05 commit 3d428b8

File tree

5 files changed

+204
-2922
lines changed

5 files changed

+204
-2922
lines changed

crates/memory/src/region.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ pub struct Region {
77
impl Region {
88
pub fn overlaps(&self, rhs: Region) -> bool {
99
let self_start = self.start as u64;
10-
let self_end = self.start as u64 + self.len as u64;
10+
let self_end = ((self_start + self.len as u64) as i64 - 1) as u64;
1111

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

1515
// start of rhs inside self:
1616
if rhs_start >= self_start && rhs_start < self_end {

0 commit comments

Comments
 (0)