Skip to content

Add options to skip verifying bisection ranges #262

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
136 changes: 81 additions & 55 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,18 @@ a date (YYYY-MM-DD), git tag name (e.g. 1.58.0) or git commit SHA."

#[arg(long, help = "Do not install cargo [default: install cargo]")]
without_cargo: bool,

#[arg(
long,
help = "Do not verify that the start and end of the nightly range are correct"
)]
no_verify_nightly: bool,

#[arg(
long,
help = "Do not verify that the start and end commits of the range are correct"
)]
no_verify_ci: bool,
}

pub type GitDate = Date<Utc>;
Expand Down Expand Up @@ -954,39 +966,45 @@ impl Config {
);
}

eprintln!("checking the start range to find a passing nightly");
match self.install_and_test(&t, &dl_spec) {
Ok(r) => {
// If Satisfies::No, then the regression was not identified in this nightly.
// Break out of the loop and use this as the start date for the
// bisection range
if r == Satisfies::No {
first_success = Some(nightly_date);
break;
} else if has_start {
// If this date was explicitly defined on the command line &
// has regression, then this is an error in the test definition.
// The user must re-define the start date and try again
bail!(
"the start of the range ({}) must not reproduce the regression",
if has_start && self.args.no_verify_nightly {
eprintln!("skipping checking the start of the range");
first_success = Some(nightly_date);
break;
} else {
eprintln!("checking the start range to find a passing nightly");
match self.install_and_test(&t, &dl_spec) {
Ok(r) => {
// If Satisfies::No, then the regression was not identified in this nightly.
// Break out of the loop and use this as the start date for the
// bisection range
if r == Satisfies::No {
first_success = Some(nightly_date);
break;
} else if has_start {
// If this date was explicitly defined on the command line &
// has regression, then this is an error in the test definition.
// The user must re-define the start date and try again
bail!(
"the start of the range ({}) must not reproduce the regression",
t
);
}
last_failure = nightly_date;
nightly_date = nightly_iter.next().unwrap();
}
Err(InstallError::NotFound { .. }) => {
// go back just one day, presumably missing a nightly
nightly_date = nightly_date.pred();
eprintln!(
"*** unable to install {}. roll back one day and try again...",
t
);
if has_start {
bail!("could not find {}", t);
}
}
last_failure = nightly_date;
nightly_date = nightly_iter.next().unwrap();
}
Err(InstallError::NotFound { .. }) => {
// go back just one day, presumably missing a nightly
nightly_date = nightly_date.pred();
eprintln!(
"*** unable to install {}. roll back one day and try again...",
t
);
if has_start {
bail!("could not find {}", t);
}
Err(error) => return Err(error.into()),
}
Err(error) => return Err(error.into()),
}
}

Expand All @@ -1001,14 +1019,18 @@ impl Config {
t_end.std_targets.sort();
t_end.std_targets.dedup();

eprintln!("checking the end range to verify it does not pass");
let result_nightly = self.install_and_test(&t_end, &dl_spec)?;
// The regression was not identified in this nightly.
if result_nightly == Satisfies::No {
bail!(
"the end of the range ({}) does not reproduce the regression",
t_end
);
if self.args.no_verify_nightly {
eprintln!("skipping checking the end of the range");
} else {
eprintln!("checking the end range to verify it does not pass");
let result_nightly = self.install_and_test(&t_end, &dl_spec)?;
// The regression was not identified in this nightly.
if result_nightly == Satisfies::No {
bail!(
"the end of the range ({}) does not reproduce the regression",
t_end
);
}
}

let toolchains = toolchains_between(
Expand Down Expand Up @@ -1147,25 +1169,29 @@ impl Config {
.collect::<Vec<_>>();

if !toolchains.is_empty() {
// validate commit at start of range
eprintln!("checking the start range to verify it passes");
let start_range_result = self.install_and_test(&toolchains[0], &dl_spec)?;
if start_range_result == Satisfies::Yes {
bail!(
"the commit at the start of the range ({}) includes the regression",
&toolchains[0]
);
}
if self.args.no_verify_ci {
eprintln!("skipping verifying CI range")
} else {
// validate commit at start of range
eprintln!("checking the start range to verify it passes");
let start_range_result = self.install_and_test(&toolchains[0], &dl_spec)?;
if start_range_result == Satisfies::Yes {
bail!(
"the commit at the start of the range ({}) includes the regression",
&toolchains[0]
);
}

// validate commit at end of range
eprintln!("checking the end range to verify it does not pass");
let end_range_result =
self.install_and_test(&toolchains[toolchains.len() - 1], &dl_spec)?;
if end_range_result == Satisfies::No {
bail!(
"the commit at the end of the range ({}) does not reproduce the regression",
&toolchains[toolchains.len() - 1]
);
// validate commit at end of range
eprintln!("checking the end range to verify it does not pass");
let end_range_result =
self.install_and_test(&toolchains[toolchains.len() - 1], &dl_spec)?;
if end_range_result == Satisfies::No {
bail!(
"the commit at the end of the range ({}) does not reproduce the regression",
&toolchains[toolchains.len() - 1]
);
}
}
}

Expand Down
4 changes: 4 additions & 0 deletions tests/cmd/h.stdout
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ Options:
-h, --help Print help information (use `--help` for more detail)
...
--install <INSTALL> Install the given artifact
--no-verify-ci Do not verify that the start and end commits of the range are
correct
--no-verify-nightly Do not verify that the start and end of the nightly range are
correct
--preserve Preserve the downloaded artifacts
--preserve-target Preserve the target directory used for builds
--prompt Manually evaluate for regression with prompts
Expand Down
6 changes: 6 additions & 0 deletions tests/cmd/help.stdout
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ Options:
--install <INSTALL>
Install the given artifact

--no-verify-ci
Do not verify that the start and end commits of the range are correct

--no-verify-nightly
Do not verify that the start and end of the nightly range are correct

--preserve
Preserve the downloaded artifacts

Expand Down