Skip to content

Commit b99855e

Browse files
committed
fix: adjust test
Signed-off-by: Tomasz Andrzejak <andreiltd@gmail.com>
1 parent 2890b0f commit b99855e

3 files changed

Lines changed: 22 additions & 2 deletions

File tree

src/hyperlight_common/src/virtq/consumer.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1406,6 +1406,11 @@ mod tests {
14061406
// The rejected chain is returned. The earlier chain remains in flight.
14071407
assert_eq!(producer.poll().unwrap().unwrap().token(), rejected);
14081408
assert!(producer.poll().unwrap().is_none());
1409+
1410+
drop(consumer);
1411+
// SAFETY: The peer is stopped and all consumer chain handles are dropped.
1412+
unsafe { producer.reset().unwrap() };
1413+
assert_eq!(producer.pool().num_live(), 0);
14091414
}
14101415

14111416
#[test]
@@ -1428,6 +1433,11 @@ mod tests {
14281433
assert_eq!(consumer.inner.num_inflight(), 0);
14291434
assert_eq!(consumer.next_token, 0);
14301435
assert!(producer.poll().unwrap().is_none());
1436+
1437+
drop(consumer);
1438+
// SAFETY: The peer is stopped and all consumer chain handles are dropped.
1439+
unsafe { producer.reset().unwrap() };
1440+
assert_eq!(producer.pool().num_live(), 0);
14311441
}
14321442

14331443
#[test]
@@ -1452,6 +1462,11 @@ mod tests {
14521462
assert_eq!(consumer.inner.num_inflight(), 1);
14531463
assert_eq!(consumer.next_token, 1);
14541464
assert!(producer.poll().unwrap().is_none());
1465+
1466+
drop(consumer);
1467+
// SAFETY: The peer is stopped and all consumer chain handles are dropped.
1468+
unsafe { producer.reset().unwrap() };
1469+
assert_eq!(producer.pool().num_live(), 0);
14551470
}
14561471

14571472
#[test]

src/hyperlight_host/src/mem/mgr.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1027,12 +1027,14 @@ mod tests {
10271027
use crate::sandbox::SandboxConfiguration;
10281028

10291029
fn manager(case: &TestCase) -> SandboxMemoryManager<HostSharedMemory> {
1030+
let host_page_size = page_size::get();
1031+
10301032
#[cfg(not(unshared_snapshot_mem))]
10311033
let shared_mem =
1032-
ReadonlySharedMemory::from_bytes(&vec![0; vmem::PAGE_SIZE], vmem::PAGE_SIZE).unwrap();
1034+
ReadonlySharedMemory::from_bytes(&vec![0; host_page_size], host_page_size).unwrap();
10331035

10341036
#[cfg(unshared_snapshot_mem)]
1035-
let shared_mem = ExclusiveSharedMemory::new(vmem::PAGE_SIZE)
1037+
let shared_mem = ExclusiveSharedMemory::new(host_page_size)
10361038
.unwrap()
10371039
.build()
10381040
.0;

src/hyperlight_host/src/sandbox/initialized_multi_use.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4920,6 +4920,9 @@ mod tests {
49204920
let mut sbox = make_sandbox();
49214921
sbox.call::<i32>("AddToStatic", 1i32).unwrap();
49224922

4923+
// Checkpointing repairs the rings, so inject corruption afterward.
4924+
sbox.checkpoint_transport_for_snapshot().unwrap();
4925+
49234926
let layout = &sbox.mem_mgr.layout;
49244927
let scratch_base = layout::scratch_base_gpa(layout.get_scratch_size());
49254928

0 commit comments

Comments
 (0)