Skip to content

Commit e9f2deb

Browse files
committed
Update inprocess and local library tests to take account of inprocess feature flag
Signed-off-by: Simon Davies <simongdavies@users.noreply.github.com>
1 parent e977fc3 commit e9f2deb

File tree

1 file changed

+30
-2
lines changed

1 file changed

+30
-2
lines changed

src/hyperlight_host/src/sandbox/uninitialized.rs

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,28 @@ mod tests {
364364
None,
365365
);
366366

367-
// in process should only be enabled with the inprocess feature and on debug builds, and requires windows
367+
// debug mode should fail with an elf executable
368+
assert!(sbox.is_err());
369+
370+
let simple_guest_path = simple_guest_exe_as_string().unwrap();
371+
let sbox = UninitializedSandbox::new(
372+
GuestBinary::FilePath(simple_guest_path.clone()),
373+
None,
374+
Some(SandboxRunOptions::RunInProcess(false)),
375+
None,
376+
);
377+
378+
// in process should only be enabled with the inprocess feature and on debug builds
379+
assert_eq!(sbox.is_ok(), cfg!(all(inprocess)));
380+
381+
let sbox = UninitializedSandbox::new(
382+
GuestBinary::FilePath(simple_guest_path.clone()),
383+
None,
384+
Some(SandboxRunOptions::RunInProcess(true)),
385+
None,
386+
);
387+
388+
// debug mode should succeed with a PE executable on windows with inprocess enabled
368389
assert_eq!(sbox.is_ok(), cfg!(all(inprocess, target_os = "windows")));
369390
}
370391

@@ -592,7 +613,14 @@ mod tests {
592613
}
593614
#[cfg(target_os = "windows")]
594615
{
595-
let _ = mgr_res.unwrap();
616+
#[cfg(inprocess)]
617+
{
618+
assert!(mgr_res.is_ok())
619+
}
620+
#[cfg(not(inprocess))]
621+
{
622+
assert!(mgr_res.is_err())
623+
}
596624
}
597625
}
598626

0 commit comments

Comments
 (0)