@@ -25,7 +25,6 @@ extern crate structopt;
2525extern crate tar;
2626extern crate tee;
2727extern crate tempdir;
28- extern crate toml;
2928extern crate xz2;
3029
3130use std:: env;
@@ -50,7 +49,6 @@ use structopt::StructOpt;
5049use tar:: Archive ;
5150use tee:: TeeReader ;
5251use tempdir:: TempDir ;
53- use toml:: Value ;
5452use xz2:: read:: XzDecoder ;
5553
5654/// The first commit which build artifacts are made available through the CI for
@@ -197,33 +195,15 @@ impl Bound {
197195 Bound :: Commit ( commit) => Ok ( Bound :: Commit ( commit) ) ,
198196 Bound :: Date ( date) => {
199197 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) ;
201199
202200 eprintln ! ( "fetching {}" , url) ;
203201 let client = Client :: new ( ) ;
204202 let name = format ! ( "nightly manifest {}" , date_str) ;
205203 let ( response, mut bar) = download_progress ( & client, & name, & url) ?;
206204 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) ?;
227207
228208 eprintln ! ( "converted {} to {}" , date_str, commit) ;
229209
@@ -816,24 +796,50 @@ fn install(cfg: &Config, client: &Client, bound: &Bound) -> Result<(), Error> {
816796}
817797
818798fn 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 ) {
819829 let BisectionResult {
820830 searched : toolchains,
821831 dl_spec,
822832 found,
823- } = if cfg. is_commit {
824- bisect_ci ( & cfg, & client) ?
825- } else {
826- bisect_nightlies ( & cfg, & client) ?
827- } ;
833+ } = bisection_result;
828834
829835 eprintln ! (
830836 "searched toolchains {} through {}" ,
831837 toolchains. first( ) . unwrap( ) ,
832838 toolchains. last( ) . unwrap( ) ,
833839 ) ;
834840
835- if toolchains[ found] == * toolchains. last ( ) . unwrap ( ) {
836- let t = & toolchains[ found] ;
841+ if toolchains[ * found] == * toolchains. last ( ) . unwrap ( ) {
842+ let t = & toolchains[ * found] ;
837843 let r = match t. install ( & client, & dl_spec) {
838844 Ok ( ( ) ) => {
839845 let outcome = t. test ( & cfg) ;
@@ -855,14 +861,12 @@ fn bisect(cfg: &Config, client: &Client) -> Result<(), Error> {
855861 Satisfies :: Yes => { }
856862 Satisfies :: No | Satisfies :: Unknown => {
857863 eprintln ! ( "error: The regression was not found. Expanding the bounds may help." ) ;
858- return Ok ( ( ) ) ;
864+ return ;
859865 }
860866 }
861867 }
862868
863- eprintln ! ( "regression in {}" , toolchains[ found] ) ;
864-
865- Ok ( ( ) )
869+ eprintln ! ( "regression in {}" , toolchains[ * found] ) ;
866870}
867871
868872struct NightlyFinderIter {
@@ -1078,7 +1082,6 @@ fn toolchains_between(cfg: &Config, a: ToolchainSpec, b: ToolchainSpec) -> Vec<T
10781082
10791083fn bisect_ci ( cfg : & Config , client : & Client ) -> Result < BisectionResult , Error > {
10801084 eprintln ! ( "bisecting ci builds" ) ;
1081- let dl_spec = DownloadParams :: for_ci ( cfg) ;
10821085 let start = if let Some ( Bound :: Commit ( ref sha) ) = cfg. args . start {
10831086 sha
10841087 } else {
@@ -1093,6 +1096,11 @@ fn bisect_ci(cfg: &Config, client: &Client) -> Result<BisectionResult, Error> {
10931096
10941097 eprintln ! ( "starting at {}, ending at {}" , start, end) ;
10951098
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) ;
10961104 let mut commits = get_commits ( start, end) ?;
10971105 let now = chrono:: Utc :: now ( ) ;
10981106 commits. retain ( |c| now. signed_duration_since ( c. date ) . num_days ( ) < 167 ) ;
0 commit comments