@@ -575,37 +575,62 @@ fn bisect(cfg: &Config, client: &Client) -> Result<(), Error> {
575
575
if let ToolchainSpec :: Nightly { date } = nightly_regression. spec {
576
576
let previous_date = date - chrono:: Duration :: days ( 1 ) ;
577
577
578
- let bad_commit = Bound :: Date ( date) . sha ( ) ?;
579
578
let working_commit = Bound :: Date ( previous_date) . sha ( ) ?;
579
+ let bad_commit = Bound :: Date ( date) . sha ( ) ?;
580
580
eprintln ! (
581
581
"looking for regression commit between {} and {}" ,
582
- date. format( YYYY_MM_DD ) ,
583
582
previous_date. format( YYYY_MM_DD ) ,
583
+ date. format( YYYY_MM_DD ) ,
584
584
) ;
585
585
586
586
let ci_bisection_result =
587
587
bisect_ci_via ( cfg, client, & * cfg. repo_access , & working_commit, & bad_commit) ?;
588
588
589
589
print_results ( cfg, client, & ci_bisection_result) ;
590
- print_final_report ( & nightly_bisection_result, & ci_bisection_result) ;
590
+ print_final_report ( cfg , & nightly_bisection_result, & ci_bisection_result) ;
591
591
}
592
592
}
593
593
594
594
Ok ( ( ) )
595
595
}
596
596
597
+ fn searched_range (
598
+ cfg : & Config ,
599
+ searched_toolchains : & Vec < Toolchain > ,
600
+ ) -> ( ToolchainSpec , ToolchainSpec ) {
601
+ let first_toolchain = searched_toolchains. first ( ) . unwrap ( ) . spec . clone ( ) ;
602
+ let last_toolchain = searched_toolchains. last ( ) . unwrap ( ) . spec . clone ( ) ;
603
+
604
+ match ( & first_toolchain, & last_toolchain) {
605
+ ( ToolchainSpec :: Ci { .. } , ToolchainSpec :: Ci { .. } ) => ( first_toolchain, last_toolchain) ,
606
+
607
+ _ => {
608
+ let start_toolchain = if let Some ( Bound :: Date ( date) ) = cfg. args . start {
609
+ ToolchainSpec :: Nightly { date }
610
+ } else {
611
+ first_toolchain
612
+ } ;
613
+
614
+ (
615
+ start_toolchain,
616
+ ToolchainSpec :: Nightly {
617
+ date : get_end_date ( cfg) ,
618
+ } ,
619
+ )
620
+ }
621
+ }
622
+ }
623
+
597
624
fn print_results ( cfg : & Config , client : & Client , bisection_result : & BisectionResult ) {
598
625
let BisectionResult {
599
626
searched : toolchains,
600
627
dl_spec,
601
628
found,
602
629
} = bisection_result;
603
630
604
- eprintln ! (
605
- "searched toolchains {} through {}" ,
606
- toolchains. first( ) . unwrap( ) ,
607
- toolchains. last( ) . unwrap( ) ,
608
- ) ;
631
+ let ( start, end) = searched_range ( cfg, toolchains) ;
632
+
633
+ eprintln ! ( "searched toolchains {} through {}" , start, end) ;
609
634
610
635
if toolchains[ * found] == * toolchains. last ( ) . unwrap ( ) {
611
636
let t = & toolchains[ * found] ;
@@ -645,6 +670,7 @@ fn print_results(cfg: &Config, client: &Client, bisection_result: &BisectionResu
645
670
}
646
671
647
672
fn print_final_report (
673
+ cfg : & Config ,
648
674
nightly_bisection_result : & BisectionResult ,
649
675
ci_bisection_result : & BisectionResult ,
650
676
) {
@@ -676,11 +702,9 @@ fn print_final_report(
676
702
eprintln ! ( "# Regression found in the compiler" ) ;
677
703
eprintln ! ( "" ) ;
678
704
679
- eprintln ! (
680
- "searched nightlies: from {} to {}" ,
681
- nightly_toolchains. first( ) . unwrap( ) ,
682
- nightly_toolchains. last( ) . unwrap( ) ,
683
- ) ;
705
+ let ( start, end) = searched_range ( cfg, nightly_toolchains) ;
706
+
707
+ eprintln ! ( "searched nightlies: from {} to {}" , start, end) ;
684
708
685
709
eprintln ! ( "regressed nightly: {}" , nightly_toolchains[ * nightly_found] , ) ;
686
710
@@ -843,6 +867,26 @@ fn bisect_to_regression(
843
867
Ok ( found)
844
868
}
845
869
870
+ fn get_start_date ( cfg : & Config ) -> chrono:: Date < Utc > {
871
+ if let Some ( Bound :: Date ( date) ) = cfg. args . start {
872
+ date
873
+ } else {
874
+ get_end_date ( cfg)
875
+ }
876
+ }
877
+
878
+ fn get_end_date ( cfg : & Config ) -> chrono:: Date < Utc > {
879
+ if let Some ( Bound :: Date ( date) ) = cfg. args . end {
880
+ date
881
+ } else {
882
+ if let Some ( date) = Toolchain :: default_nightly ( ) {
883
+ date
884
+ } else {
885
+ chrono:: Utc :: now ( ) . date ( )
886
+ }
887
+ }
888
+ }
889
+
846
890
// nightlies branch of bisect execution
847
891
fn bisect_nightlies ( cfg : & Config , client : & Client ) -> Result < BisectionResult , Error > {
848
892
if cfg. args . alt {
@@ -858,21 +902,9 @@ fn bisect_nightlies(cfg: &Config, client: &Client) -> Result<BisectionResult, Er
858
902
) ;
859
903
let mut first_success = None ;
860
904
861
- let mut last_failure = if let Some ( Bound :: Date ( date) ) = cfg. args . end {
862
- date
863
- } else {
864
- if let Some ( date) = Toolchain :: default_nightly ( ) {
865
- date
866
- } else {
867
- chrono:: Utc :: now ( ) . date ( )
868
- }
869
- } ;
870
-
871
- let ( mut nightly_date, has_start) = if let Some ( Bound :: Date ( date) ) = cfg. args . start {
872
- ( date, true )
873
- } else {
874
- ( last_failure, false )
875
- } ;
905
+ let mut nightly_date = get_start_date ( cfg) ;
906
+ let mut last_failure = get_end_date ( cfg) ;
907
+ let has_start = cfg. args . start . is_some ( ) ;
876
908
877
909
let mut nightly_iter = NightlyFinderIter :: new ( nightly_date) ;
878
910
0 commit comments