File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed
src/hyperlight_host/src/sandbox Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -502,6 +502,7 @@ mod tests {
502502 use std:: sync:: { Arc , Barrier } ;
503503 use std:: thread;
504504
505+ use hyperlight_common:: flatbuffer_wrappers:: guest_error:: ErrorCode ;
505506 use hyperlight_testing:: simple_guest_as_string;
506507
507508 #[ cfg( target_os = "linux" ) ]
@@ -523,10 +524,14 @@ mod tests {
523524 sandbox. register ( "HostAdd" , |a : i32 , b : i32 | a + b) . unwrap ( ) ;
524525 let mut sandbox = sandbox. evolve ( ) . unwrap ( ) ;
525526
526- // will exhaust io if leaky
527+ // will exhaust io if leaky. Tests both success and error paths
527528 for _ in 0 ..1000 {
528529 let result = sandbox. call :: < i32 > ( "Add" , ( 5i32 , 10i32 ) ) . unwrap ( ) ;
529530 assert_eq ! ( result, 15 ) ;
531+ let result = sandbox. call :: < i32 > ( "AddToStaticAndFail" , ( ) ) . unwrap_err ( ) ;
532+ assert ! (
533+ matches!( result, HyperlightError :: GuestError ( code, msg ) if code == ErrorCode :: GuestError && msg == "Crash on purpose" )
534+ ) ;
530535 }
531536 }
532537
You can’t perform that action at this time.
0 commit comments