Skip to content

Commit d1d40a6

Browse files
committed
Properly report the scanned date
1 parent d5fe74b commit d1d40a6

File tree

1 file changed

+35
-11
lines changed

1 file changed

+35
-11
lines changed

src/main.rs

Lines changed: 35 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -587,25 +587,50 @@ fn bisect(cfg: &Config, client: &Client) -> Result<(), Error> {
587587
bisect_ci_via(cfg, client, &*cfg.repo_access, &working_commit, &bad_commit)?;
588588

589589
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);
591591
}
592592
}
593593

594594
Ok(())
595595
}
596596

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+
597624
fn print_results(cfg: &Config, client: &Client, bisection_result: &BisectionResult) {
598625
let BisectionResult {
599626
searched: toolchains,
600627
dl_spec,
601628
found,
602629
} = bisection_result;
603630

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);
609634

610635
if toolchains[*found] == *toolchains.last().unwrap() {
611636
let t = &toolchains[*found];
@@ -645,6 +670,7 @@ fn print_results(cfg: &Config, client: &Client, bisection_result: &BisectionResu
645670
}
646671

647672
fn print_final_report(
673+
cfg: &Config,
648674
nightly_bisection_result: &BisectionResult,
649675
ci_bisection_result: &BisectionResult,
650676
) {
@@ -676,11 +702,9 @@ fn print_final_report(
676702
eprintln!("# Regression found in the compiler");
677703
eprintln!("");
678704

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);
684708

685709
eprintln!("regressed nightly: {}", nightly_toolchains[*nightly_found],);
686710

0 commit comments

Comments
 (0)