@@ -70,9 +70,7 @@ fn interrupt_host_call() {
7070 }
7171 } ) ;
7272
73- let result = sandbox
74- . run :: < i32 > ( "CallHostSpin" , ( ) )
75- . unwrap_err ( ) ;
73+ let result = sandbox. run :: < i32 > ( "CallHostSpin" , ( ) ) . unwrap_err ( ) ;
7674 assert ! ( matches!( result, HyperlightError :: ExecutionCanceledByHost ( ) ) ) ;
7775
7876 thread. join ( ) . unwrap ( ) ;
@@ -96,16 +94,12 @@ fn interrupt_in_progress_guest_call() {
9694 assert ! ( interrupt_handle. dropped( ) ) ;
9795 } ) ;
9896
99- let res = sbox1
100- . run :: < i32 > ( "Spin" , ( ) )
101- . unwrap_err ( ) ;
97+ let res = sbox1. run :: < i32 > ( "Spin" , ( ) ) . unwrap_err ( ) ;
10298 assert ! ( matches!( res, HyperlightError :: ExecutionCanceledByHost ( ) ) ) ;
10399
104100 barrier. wait ( ) ;
105101 // Make sure we can still call guest functions after the VM was interrupted
106- sbox1
107- . run :: < String > ( "Echo" , "hello" . to_string ( ) )
108- . unwrap ( ) ;
102+ sbox1. run :: < String > ( "Echo" , "hello" . to_string ( ) ) . unwrap ( ) ;
109103
110104 // drop vm to make sure other thread can detect it
111105 drop ( sbox1) ;
@@ -131,15 +125,11 @@ fn interrupt_guest_call_in_advance() {
131125 } ) ;
132126
133127 barrier. wait ( ) ; // wait until `kill()` is called before starting the guest call
134- let res = sbox1
135- . run :: < i32 > ( "Spin" , ( ) )
136- . unwrap_err ( ) ;
128+ let res = sbox1. run :: < i32 > ( "Spin" , ( ) ) . unwrap_err ( ) ;
137129 assert ! ( matches!( res, HyperlightError :: ExecutionCanceledByHost ( ) ) ) ;
138130
139131 // Make sure we can still call guest functions after the VM was interrupted
140- sbox1
141- . run :: < String > ( "Echo" , "hello" . to_string ( ) )
142- . unwrap ( ) ;
132+ sbox1. run :: < String > ( "Echo" , "hello" . to_string ( ) ) . unwrap ( ) ;
143133
144134 // drop vm to make sure other thread can detect it
145135 drop ( sbox1) ;
@@ -257,9 +247,7 @@ fn interrupt_moved_sandbox() {
257247
258248 let thread = thread:: spawn ( move || {
259249 barrier2. wait ( ) ;
260- let res = sbox1
261- . run :: < i32 > ( "Spin" , ( ) )
262- . unwrap_err ( ) ;
250+ let res = sbox1. run :: < i32 > ( "Spin" , ( ) ) . unwrap_err ( ) ;
263251 assert ! ( matches!( res, HyperlightError :: ExecutionCanceledByHost ( ) ) ) ;
264252 } ) ;
265253
@@ -272,9 +260,7 @@ fn interrupt_moved_sandbox() {
272260 assert ! ( interrupt_handle2. kill( ) ) ;
273261 } ) ;
274262
275- let res = sbox2
276- . run :: < i32 > ( "Spin" , ( ) )
277- . unwrap_err ( ) ;
263+ let res = sbox2. run :: < i32 > ( "Spin" , ( ) ) . unwrap_err ( ) ;
278264 assert ! ( matches!( res, HyperlightError :: ExecutionCanceledByHost ( ) ) ) ;
279265
280266 thread. join ( ) . expect ( "Thread should finish" ) ;
@@ -315,9 +301,7 @@ fn interrupt_custom_signal_no_and_retry_delay() {
315301 } ) ;
316302
317303 for _ in 0 ..NUM_ITERS {
318- let res = sbox1
319- . run :: < i32 > ( "Spin" , ( ) )
320- . unwrap_err ( ) ;
304+ let res = sbox1. run :: < i32 > ( "Spin" , ( ) ) . unwrap_err ( ) ;
321305 assert ! ( matches!( res, HyperlightError :: ExecutionCanceledByHost ( ) ) ) ;
322306 // immediately reenter another guest function call after having being cancelled,
323307 // so that the vcpu is running again before the interruptor-thread has a chance to see that the vcpu is not running
@@ -441,10 +425,7 @@ fn guest_abort_with_context2() {
441425 Proin sagittis nisl rhoncus mattis rhoncus urna. Magna eget est lorem ipsum.";
442426
443427 let res = sbox1
444- . run :: < ( ) > (
445- "GuestAbortWithMessage" ,
446- ( 60_i32 , abort_message. to_string ( ) ) ,
447- )
428+ . run :: < ( ) > ( "GuestAbortWithMessage" , ( 60_i32 , abort_message. to_string ( ) ) )
448429 . unwrap_err ( ) ;
449430 println ! ( "{:?}" , res) ;
450431 assert ! (
@@ -494,9 +475,7 @@ fn guest_malloc() {
494475 let mut sbox1 = new_uninit_rust ( ) . unwrap ( ) . evolve ( ) . unwrap ( ) ;
495476
496477 let size_to_allocate = 2000_i32 ;
497- sbox1
498- . run :: < i32 > ( "TestMalloc" , size_to_allocate)
499- . unwrap ( ) ;
478+ sbox1. run :: < i32 > ( "TestMalloc" , size_to_allocate) . unwrap ( ) ;
500479}
501480
502481#[ test]
@@ -522,9 +501,7 @@ fn guest_malloc_abort() {
522501
523502 let size = 20000000_i32 ; // some big number that should fail when allocated
524503
525- let res = sbox1
526- . run :: < i32 > ( "TestMalloc" , size)
527- . unwrap_err ( ) ;
504+ let res = sbox1. run :: < i32 > ( "TestMalloc" , size) . unwrap_err ( ) ;
528505 println ! ( "{:?}" , res) ;
529506 assert ! (
530507 matches!( res, HyperlightError :: GuestAborted ( code, _) if code == ErrorCode :: MallocFailed as u8 )
@@ -564,9 +541,7 @@ fn dynamic_stack_allocate_c_guest() {
564541 let uninit = UninitializedSandbox :: new ( guest_path, None ) ;
565542 let mut sbox1: MultiUseSandbox = uninit. unwrap ( ) . evolve ( ) . unwrap ( ) ;
566543
567- let res: i32 = sbox1
568- . run ( "StackAllocate" , 100_i32 )
569- . unwrap ( ) ;
544+ let res: i32 = sbox1. run ( "StackAllocate" , 100_i32 ) . unwrap ( ) ;
570545 assert_eq ! ( res, 100 ) ;
571546
572547 let res = sbox1
@@ -588,9 +563,7 @@ fn static_stack_allocate() {
588563#[ test]
589564fn static_stack_allocate_overflow ( ) {
590565 let mut sbox1 = new_uninit ( ) . unwrap ( ) . evolve ( ) . unwrap ( ) ;
591- let res = sbox1
592- . run :: < i32 > ( "LargeVar" , ( ) )
593- . unwrap_err ( ) ;
566+ let res = sbox1. run :: < i32 > ( "LargeVar" , ( ) ) . unwrap_err ( ) ;
594567 assert ! ( matches!( res, HyperlightError :: StackOverflow ( ) ) ) ;
595568}
596569
@@ -601,9 +574,7 @@ fn recursive_stack_allocate() {
601574
602575 let iterations = 1_i32 ;
603576
604- sbox1
605- . run :: < i32 > ( "StackOverflow" , iterations)
606- . unwrap ( ) ;
577+ sbox1. run :: < i32 > ( "StackOverflow" , iterations) . unwrap ( ) ;
607578}
608579
609580// checks stack guard page (between guest stack and heap)
@@ -646,19 +617,15 @@ fn guard_page_check_2() {
646617 // this test is rust-guest only
647618 let mut sbox1 = new_uninit_rust ( ) . unwrap ( ) . evolve ( ) . unwrap ( ) ;
648619
649- let result = sbox1
650- . run :: < ( ) > ( "InfiniteRecursion" , ( ) )
651- . unwrap_err ( ) ;
620+ let result = sbox1. run :: < ( ) > ( "InfiniteRecursion" , ( ) ) . unwrap_err ( ) ;
652621 assert ! ( matches!( result, HyperlightError :: StackOverflow ( ) ) ) ;
653622}
654623
655624#[ test]
656625fn execute_on_stack ( ) {
657626 let mut sbox1 = new_uninit ( ) . unwrap ( ) . evolve ( ) . unwrap ( ) ;
658627
659- let result = sbox1
660- . run :: < String > ( "ExecuteOnStack" , ( ) )
661- . unwrap_err ( ) ;
628+ let result = sbox1. run :: < String > ( "ExecuteOnStack" , ( ) ) . unwrap_err ( ) ;
662629
663630 let err = result. to_string ( ) ;
664631 assert ! (
@@ -693,9 +660,7 @@ fn recursive_stack_allocate_overflow() {
693660
694661 let iterations = 10_i32 ;
695662
696- let res = sbox1
697- . run :: < ( ) > ( "StackOverflow" , iterations)
698- . unwrap_err ( ) ;
663+ let res = sbox1. run :: < ( ) > ( "StackOverflow" , iterations) . unwrap_err ( ) ;
699664 println ! ( "{:?}" , res) ;
700665 assert ! ( matches!( res, HyperlightError :: StackOverflow ( ) ) ) ;
701666}
0 commit comments