Skip to content

Commit ce8e4fc

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

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
@@ -366,10 +366,13 @@ fn host_function_error() -> Result<()> {
366366
// call guest function that calls host function
367367
let mut init_sandbox: MultiUseSandbox = sandbox.evolve()?;
368368
let msg = "Hello world";
369-
let res = init_sandbox
370-
.call::<i32>("GuestMethod1", msg.to_string())
371-
.unwrap_err();
372-
assert!(matches!(res, HyperlightError::Error(msg) if msg == "Host function error!"));
369+
370+
for _ in 0..1000 {
371+
let res = init_sandbox
372+
.call::<i32>("GuestMethod1", msg.to_string())
373+
.unwrap_err();
374+
assert!(matches!(res, HyperlightError::Error(msg) if msg == "Host function error!"));
375+
}
373376
}
374377
Ok(())
375378
}

0 commit comments

Comments
 (0)