@@ -25,7 +25,6 @@ extern crate structopt;
25
25
extern crate tar;
26
26
extern crate tee;
27
27
extern crate tempdir;
28
- extern crate toml;
29
28
extern crate xz2;
30
29
31
30
use std:: env;
@@ -50,7 +49,6 @@ use structopt::StructOpt;
50
49
use tar:: Archive ;
51
50
use tee:: TeeReader ;
52
51
use tempdir:: TempDir ;
53
- use toml:: Value ;
54
52
use xz2:: read:: XzDecoder ;
55
53
56
54
/// The first commit which build artifacts are made available through the CI for
@@ -197,33 +195,15 @@ impl Bound {
197
195
Bound :: Commit ( commit) => Ok ( Bound :: Commit ( commit) ) ,
198
196
Bound :: Date ( date) => {
199
197
let date_str = date. format ( "%Y-%m-%d" ) ;
200
- let url = format ! ( "{}/{}/channel-rust-nightly.toml " , NIGHTLY_SERVER , date_str) ;
198
+ let url = format ! ( "{}/{}/channel-rust-nightly-git-commit-hash.txt " , NIGHTLY_SERVER , date_str) ;
201
199
202
200
eprintln ! ( "fetching {}" , url) ;
203
201
let client = Client :: new ( ) ;
204
202
let name = format ! ( "nightly manifest {}" , date_str) ;
205
203
let ( response, mut bar) = download_progress ( & client, & name, & url) ?;
206
204
let mut response = TeeReader :: new ( response, & mut bar) ;
207
- let mut toml_buf = String :: new ( ) ;
208
- response. read_to_string ( & mut toml_buf) ?;
209
-
210
- let manifest = toml_buf. parse :: < Value > ( ) . unwrap ( ) ;
211
-
212
- let commit = match manifest {
213
- Value :: Table ( t) => match t. get ( "pkg" ) {
214
- Some ( & Value :: Table ( ref t) ) => match t. get ( "rust" ) {
215
- Some ( & Value :: Table ( ref t) ) => match t. get ( "git_commit_hash" ) {
216
- Some ( & Value :: String ( ref hash) ) => hash. to_owned ( ) ,
217
- _ => bail ! (
218
- "not a rustup manifest (no valid git_commit_hash key under rust"
219
- ) ,
220
- } ,
221
- _ => bail ! ( "not a rustup manifest (no rust key under pkg)" ) ,
222
- } ,
223
- _ => bail ! ( "not a rustup manifest (missing pkg key)" ) ,
224
- } ,
225
- _ => bail ! ( "not a rustup manifest (not a table at root)" ) ,
226
- } ;
205
+ let mut commit = String :: new ( ) ;
206
+ response. read_to_string ( & mut commit) ?;
227
207
228
208
eprintln ! ( "converted {} to {}" , date_str, commit) ;
229
209
@@ -816,24 +796,50 @@ fn install(cfg: &Config, client: &Client, bound: &Bound) -> Result<(), Error> {
816
796
}
817
797
818
798
fn bisect ( cfg : & Config , client : & Client ) -> Result < ( ) , Error > {
799
+ if cfg. is_commit {
800
+ let bisection_result = bisect_ci ( & cfg, & client) ?;
801
+ print_results ( cfg, client, & bisection_result) ;
802
+ } else {
803
+ let bisection_result = bisect_nightlies ( & cfg, & client) ?;
804
+ print_results ( cfg, client, & bisection_result) ;
805
+ let regression = & bisection_result. searched [ bisection_result. found ] ;
806
+
807
+ if let ToolchainSpec :: Nightly { date } = regression. spec {
808
+ let previous_date = date - chrono:: Duration :: days ( 1 ) ;
809
+
810
+ if let Bound :: Commit ( regression_commit) = Bound :: Date ( date) . as_commit ( ) ? {
811
+ if let Bound :: Commit ( working_commit) = Bound :: Date ( previous_date) . as_commit ( ) ? {
812
+ eprintln ! (
813
+ "looking for regression commit between {} and {}" ,
814
+ date. format( "%Y-%m-%d" ) ,
815
+ previous_date. format( "%Y-%m-%d" ) ,
816
+ ) ;
817
+
818
+ let bisection_result = bisect_ci_between ( cfg, client, & working_commit, & regression_commit) ?;
819
+ print_results ( cfg, client, & bisection_result) ;
820
+ }
821
+ }
822
+ }
823
+ }
824
+
825
+ Ok ( ( ) )
826
+ }
827
+
828
+ fn print_results ( cfg : & Config , client : & Client , bisection_result : & BisectionResult ) {
819
829
let BisectionResult {
820
830
searched : toolchains,
821
831
dl_spec,
822
832
found,
823
- } = if cfg. is_commit {
824
- bisect_ci ( & cfg, & client) ?
825
- } else {
826
- bisect_nightlies ( & cfg, & client) ?
827
- } ;
833
+ } = bisection_result;
828
834
829
835
eprintln ! (
830
836
"searched toolchains {} through {}" ,
831
837
toolchains. first( ) . unwrap( ) ,
832
838
toolchains. last( ) . unwrap( ) ,
833
839
) ;
834
840
835
- if toolchains[ found] == * toolchains. last ( ) . unwrap ( ) {
836
- let t = & toolchains[ found] ;
841
+ if toolchains[ * found] == * toolchains. last ( ) . unwrap ( ) {
842
+ let t = & toolchains[ * found] ;
837
843
let r = match t. install ( & client, & dl_spec) {
838
844
Ok ( ( ) ) => {
839
845
let outcome = t. test ( & cfg) ;
@@ -855,14 +861,12 @@ fn bisect(cfg: &Config, client: &Client) -> Result<(), Error> {
855
861
Satisfies :: Yes => { }
856
862
Satisfies :: No | Satisfies :: Unknown => {
857
863
eprintln ! ( "error: The regression was not found. Expanding the bounds may help." ) ;
858
- return Ok ( ( ) ) ;
864
+ return ;
859
865
}
860
866
}
861
867
}
862
868
863
- eprintln ! ( "regression in {}" , toolchains[ found] ) ;
864
-
865
- Ok ( ( ) )
869
+ eprintln ! ( "regression in {}" , toolchains[ * found] ) ;
866
870
}
867
871
868
872
struct NightlyFinderIter {
@@ -1078,7 +1082,6 @@ fn toolchains_between(cfg: &Config, a: ToolchainSpec, b: ToolchainSpec) -> Vec<T
1078
1082
1079
1083
fn bisect_ci ( cfg : & Config , client : & Client ) -> Result < BisectionResult , Error > {
1080
1084
eprintln ! ( "bisecting ci builds" ) ;
1081
- let dl_spec = DownloadParams :: for_ci ( cfg) ;
1082
1085
let start = if let Some ( Bound :: Commit ( ref sha) ) = cfg. args . start {
1083
1086
sha
1084
1087
} else {
@@ -1093,6 +1096,11 @@ fn bisect_ci(cfg: &Config, client: &Client) -> Result<BisectionResult, Error> {
1093
1096
1094
1097
eprintln ! ( "starting at {}, ending at {}" , start, end) ;
1095
1098
1099
+ bisect_ci_between ( cfg, client, start, end)
1100
+ }
1101
+
1102
+ fn bisect_ci_between ( cfg : & Config , client : & Client , start : & str , end : & str ) -> Result < BisectionResult , Error > {
1103
+ let dl_spec = DownloadParams :: for_ci ( cfg) ;
1096
1104
let mut commits = get_commits ( start, end) ?;
1097
1105
let now = chrono:: Utc :: now ( ) ;
1098
1106
commits. retain ( |c| now. signed_duration_since ( c. date ) . num_days ( ) < 167 ) ;
0 commit comments