Skip to content

Commit e4ebb7d

Browse files
committed
Remove toolchain just once and after running test not inside it
1 parent d8f542d commit e4ebb7d

File tree

1 file changed

+10
-13
lines changed

1 file changed

+10
-13
lines changed

src/main.rs

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,7 @@ impl Toolchain {
512512
Ok(())
513513
}
514514

515-
fn test(&self, cfg: &Config, dl_spec: &DownloadParams) -> TestOutcome {
515+
fn test(&self, cfg: &Config) -> TestOutcome {
516516
let outcome = if cfg.args.prompt {
517517
loop {
518518
let status = self.run_test(cfg);
@@ -540,10 +540,6 @@ impl Toolchain {
540540
}
541541
};
542542

543-
if !cfg.args.preserve {
544-
let _ = self.remove(dl_spec);
545-
}
546-
547543
outcome
548544
}
549545

@@ -840,7 +836,7 @@ fn bisect(cfg: &Config, client: &Client) -> Result<(), Error> {
840836
let t = &toolchains[found];
841837
let r = match t.install(&client, &dl_spec) {
842838
Ok(()) => {
843-
let outcome = t.test(&cfg, &dl_spec);
839+
let outcome = t.test(&cfg);
844840
if !cfg.args.preserve {
845841
let _ = t.remove(&dl_spec);
846842
}
@@ -982,7 +978,12 @@ fn bisect_nightlies(cfg: &Config, client: &Client) -> Result<BisectionResult, Er
982978
}
983979
match t.install(client, &dl_spec) {
984980
Ok(()) => {
985-
let outcome = t.test(&cfg, &dl_spec);
981+
let outcome = t.test(&cfg);
982+
983+
if !cfg.args.preserve {
984+
let _ = t.remove(&dl_spec);
985+
}
986+
986987
if let TestOutcome::Baseline = outcome {
987988
first_success = Some(nightly_date);
988989
break;
@@ -993,10 +994,6 @@ fn bisect_nightlies(cfg: &Config, client: &Client) -> Result<BisectionResult, Er
993994
}
994995

995996
nightly_date = nightly_iter.next().unwrap();
996-
997-
if !cfg.args.preserve {
998-
let _ = t.remove(&dl_spec);
999-
}
1000997
}
1001998
Err(InstallError::NotFound { .. }) => {
1002999
// go back just one day, presumably missing nightly
@@ -1030,7 +1027,7 @@ fn bisect_nightlies(cfg: &Config, client: &Client) -> Result<BisectionResult, Er
10301027
let found = least_satisfying(&toolchains, |t| {
10311028
match t.install(&client, &dl_spec) {
10321029
Ok(()) => {
1033-
let outcome = t.test(&cfg, &dl_spec);
1030+
let outcome = t.test(&cfg);
10341031
// we want to fail, so a successful build doesn't satisfy us
10351032
let r = match outcome {
10361033
TestOutcome::Baseline => Satisfies::No,
@@ -1139,7 +1136,7 @@ fn bisect_ci(cfg: &Config, client: &Client) -> Result<BisectionResult, Error> {
11391136
match t.install(&client, &dl_spec) {
11401137
Ok(()) => {
11411138
eprintln!("testing {}", t);
1142-
let outcome = t.test(&cfg, &dl_spec);
1139+
let outcome = t.test(&cfg);
11431140
// we want to fail, so a successful build doesn't satisfy us
11441141
let r = match outcome {
11451142
TestOutcome::Regressed => Satisfies::Yes,

0 commit comments

Comments
 (0)