@@ -594,7 +594,7 @@ fn parse_progress(output: &str) -> Option<HardeningProgress> {
594594 . unwrap_or ( "dependency" ) ;
595595 return Some ( HardeningProgress {
596596 stage : "init" . to_string ( ) ,
597- substage : None ,
597+ substage : Some ( "toolchain.download" . to_string ( ) ) ,
598598 progress : 3 ,
599599 message : format ! ( "Downloading dependency: {file_name}" ) ,
600600 } ) ;
@@ -614,7 +614,7 @@ fn parse_progress(output: &str) -> Option<HardeningProgress> {
614614 }
615615 return Some ( HardeningProgress {
616616 stage : "init" . to_string ( ) ,
617- substage : None ,
617+ substage : Some ( "toolchain.download" . to_string ( ) ) ,
618618 progress,
619619 message : format ! ( "Downloading {file_name} ({progress}%)" ) ,
620620 } ) ;
@@ -623,7 +623,7 @@ fn parse_progress(output: &str) -> Option<HardeningProgress> {
623623 if output. contains ( "[toolchain] download-retry" ) {
624624 return Some ( HardeningProgress {
625625 stage : "init" . to_string ( ) ,
626- substage : None ,
626+ substage : Some ( "toolchain.download" . to_string ( ) ) ,
627627 progress : 6 ,
628628 message : "Network unstable, retrying dependency download..." . to_string ( ) ,
629629 } ) ;
@@ -636,7 +636,7 @@ fn parse_progress(output: &str) -> Option<HardeningProgress> {
636636 . unwrap_or ( "dependency" ) ;
637637 return Some ( HardeningProgress {
638638 stage : "init" . to_string ( ) ,
639- substage : None ,
639+ substage : Some ( "toolchain.download" . to_string ( ) ) ,
640640 progress : 30 ,
641641 message : format ! ( "Dependency ready: {file_name}" ) ,
642642 } ) ;
@@ -785,4 +785,33 @@ mod tests {
785785 assert_eq ! ( progress. progress, 90 ) ;
786786 assert_eq ! ( progress. message, "Signing package" ) ;
787787 }
788+
789+ #[ test]
790+ fn parse_progress_maps_toolchain_download_start_to_substage ( ) {
791+ let line = "[toolchain] download-start commandlinetools.zip 12345" ;
792+ let progress = super :: parse_progress ( line) . expect ( "progress should parse" ) ;
793+ assert_eq ! ( progress. stage, "init" ) ;
794+ assert_eq ! ( progress. substage. as_deref( ) , Some ( "toolchain.download" ) ) ;
795+ }
796+
797+ #[ test]
798+ fn parse_progress_maps_toolchain_download_progress_to_substage ( ) {
799+ let line = "[toolchain] download-progress commandlinetools.zip 37%" ;
800+ let progress = super :: parse_progress ( line) . expect ( "progress should parse" ) ;
801+ assert_eq ! ( progress. stage, "init" ) ;
802+ assert_eq ! ( progress. substage. as_deref( ) , Some ( "toolchain.download" ) ) ;
803+ }
804+
805+ #[ test]
806+ fn parse_progress_maps_toolchain_download_retry_and_done_to_substage ( ) {
807+ let retry = "[toolchain] download-retry commandlinetools.zip" ;
808+ let retry_progress = super :: parse_progress ( retry) . expect ( "retry should parse" ) ;
809+ assert_eq ! ( retry_progress. stage, "init" ) ;
810+ assert_eq ! ( retry_progress. substage. as_deref( ) , Some ( "toolchain.download" ) ) ;
811+
812+ let done = "[toolchain] download-done commandlinetools.zip" ;
813+ let done_progress = super :: parse_progress ( done) . expect ( "done should parse" ) ;
814+ assert_eq ! ( done_progress. stage, "init" ) ;
815+ assert_eq ! ( done_progress. substage. as_deref( ) , Some ( "toolchain.download" ) ) ;
816+ }
788817}
0 commit comments