@@ -547,10 +547,10 @@ impl<'a> TestRunnerInner<'a> {
547
547
config,
548
548
} ;
549
549
550
- let ( status, env_map ) = self
550
+ let status = self
551
551
. run_setup_script ( packet, & this_resp_tx, & mut req_rx)
552
552
. await ;
553
- let status = status. into_external ( ) ;
553
+ let ( status, env_map ) = status. into_external ( ) ;
554
554
555
555
let _ = this_resp_tx. send ( InternalTestEvent :: SetupScriptFinished {
556
556
script_id,
@@ -762,24 +762,21 @@ impl<'a> TestRunnerInner<'a> {
762
762
script : SetupScriptPacket < ' a > ,
763
763
resp_tx : & UnboundedSender < InternalTestEvent < ' a > > ,
764
764
req_rx : & mut UnboundedReceiver < RunUnitRequest > ,
765
- ) -> ( InternalSetupScriptExecuteStatus , Option < SetupScriptEnvMap > ) {
765
+ ) -> InternalSetupScriptExecuteStatus {
766
766
let mut stopwatch = crate :: time:: stopwatch ( ) ;
767
767
768
768
match self
769
769
. run_setup_script_inner ( script, & mut stopwatch, resp_tx, req_rx)
770
770
. await
771
771
{
772
- Ok ( ( status, env_map) ) => ( status, env_map) ,
773
- Err ( error) => (
774
- InternalSetupScriptExecuteStatus {
775
- output : ChildExecutionResult :: StartError ( error) ,
776
- result : ExecutionResult :: ExecFail ,
777
- stopwatch_end : stopwatch. snapshot ( ) ,
778
- is_slow : false ,
779
- env_count : 0 ,
780
- } ,
781
- None ,
782
- ) ,
772
+ Ok ( status) => status,
773
+ Err ( error) => InternalSetupScriptExecuteStatus {
774
+ output : ChildExecutionResult :: StartError ( error) ,
775
+ result : ExecutionResult :: ExecFail ,
776
+ stopwatch_end : stopwatch. snapshot ( ) ,
777
+ is_slow : false ,
778
+ env_map : None ,
779
+ } ,
783
780
}
784
781
}
785
782
@@ -789,8 +786,7 @@ impl<'a> TestRunnerInner<'a> {
789
786
stopwatch : & mut StopwatchStart ,
790
787
resp_tx : & UnboundedSender < InternalTestEvent < ' a > > ,
791
788
req_rx : & mut UnboundedReceiver < RunUnitRequest > ,
792
- ) -> Result < ( InternalSetupScriptExecuteStatus , Option < SetupScriptEnvMap > ) , ChildStartError >
793
- {
789
+ ) -> Result < InternalSetupScriptExecuteStatus , ChildStartError > {
794
790
let mut cmd = script. make_command ( & self . double_spawn , self . test_list ) ?;
795
791
let command_mut = cmd. command_mut ( ) ;
796
792
@@ -964,22 +960,19 @@ impl<'a> TestRunnerInner<'a> {
964
960
None
965
961
} ;
966
962
967
- Ok ( (
968
- InternalSetupScriptExecuteStatus {
969
- output : ChildExecutionResult :: Output {
970
- output : child_acc. output . freeze ( ) ,
971
- errors : ErrorList :: new (
972
- ChildExecutionResult :: WAITING_ON_SETUP_SCRIPT_MESSAGE ,
973
- errors,
974
- ) ,
975
- } ,
976
- result : status,
977
- stopwatch_end : stopwatch. snapshot ( ) ,
978
- is_slow,
979
- env_count : env_map. as_ref ( ) . map ( |map| map. len ( ) ) . unwrap_or ( 0 ) ,
963
+ Ok ( InternalSetupScriptExecuteStatus {
964
+ output : ChildExecutionResult :: Output {
965
+ output : child_acc. output . freeze ( ) ,
966
+ errors : ErrorList :: new (
967
+ ChildExecutionResult :: WAITING_ON_SETUP_SCRIPT_MESSAGE ,
968
+ errors,
969
+ ) ,
980
970
} ,
971
+ result : status,
972
+ stopwatch_end : stopwatch. snapshot ( ) ,
973
+ is_slow,
981
974
env_map,
982
- ) )
975
+ } )
983
976
}
984
977
985
978
/// Run an individual test in its own process.
@@ -1524,27 +1517,34 @@ pub struct SetupScriptExecuteStatus {
1524
1517
/// Whether this script counts as slow.
1525
1518
pub is_slow : bool ,
1526
1519
/// The number of environment variables that were set by this script.
1527
- pub env_count : usize ,
1520
+ ///
1521
+ /// `None` if an error occurred while running the script or reading the
1522
+ /// environment map.
1523
+ pub env_count : Option < usize > ,
1528
1524
}
1529
1525
1530
1526
struct InternalSetupScriptExecuteStatus {
1531
1527
output : ChildExecutionResult ,
1532
1528
result : ExecutionResult ,
1533
1529
stopwatch_end : StopwatchSnapshot ,
1534
1530
is_slow : bool ,
1535
- env_count : usize ,
1531
+ env_map : Option < SetupScriptEnvMap > ,
1536
1532
}
1537
1533
1538
1534
impl InternalSetupScriptExecuteStatus {
1539
- fn into_external ( self ) -> SetupScriptExecuteStatus {
1540
- SetupScriptExecuteStatus {
1541
- output : self . output ,
1542
- result : self . result ,
1543
- start_time : self . stopwatch_end . start_time . fixed_offset ( ) ,
1544
- time_taken : self . stopwatch_end . active ,
1545
- is_slow : self . is_slow ,
1546
- env_count : self . env_count ,
1547
- }
1535
+ fn into_external ( self ) -> ( SetupScriptExecuteStatus , Option < SetupScriptEnvMap > ) {
1536
+ let env_count = self . env_map . as_ref ( ) . map ( |map| map. len ( ) ) ;
1537
+ (
1538
+ SetupScriptExecuteStatus {
1539
+ output : self . output ,
1540
+ result : self . result ,
1541
+ start_time : self . stopwatch_end . start_time . fixed_offset ( ) ,
1542
+ time_taken : self . stopwatch_end . active ,
1543
+ is_slow : self . is_slow ,
1544
+ env_count,
1545
+ } ,
1546
+ self . env_map ,
1547
+ )
1548
1548
}
1549
1549
}
1550
1550
0 commit comments