Skip to content

Commit 323ae41

Browse files
committed
Add test that fails due memory leaking when host function error occurs
Signed-off-by: Ludvig Liljenberg <[email protected]>
1 parent 2c10e2e commit 323ae41

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/hyperlight_host/tests/sandbox_host_tests.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -351,10 +351,13 @@ fn host_function_error() -> Result<()> {
351351
// call guest function that calls host function
352352
let mut init_sandbox: MultiUseSandbox = sandbox.evolve()?;
353353
let msg = "Hello world";
354-
let res = init_sandbox
355-
.call::<i32>("GuestMethod1", msg.to_string())
356-
.unwrap_err();
357-
assert!(matches!(res, HyperlightError::Error(msg) if msg == "Host function error!"));
354+
355+
for _ in 0..1000 {
356+
let res = init_sandbox
357+
.call::<i32>("GuestMethod1", msg.to_string())
358+
.unwrap_err();
359+
assert!(matches!(res, HyperlightError::Error(msg) if msg == "Host function error!"));
360+
}
358361
}
359362
Ok(())
360363
}

0 commit comments

Comments
 (0)