Skip to content

Commit e625c1b

Browse files
committed
handle other PrepareErrors
1 parent 6735c1d commit e625c1b

File tree

3 files changed

+29
-16
lines changed

3 files changed

+29
-16
lines changed

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ remove_dir_all = "0.7"
5050
reqwest = { version = "0.12", features = ["blocking", "json"] }
5151
rusqlite = { version = "0.32.1", features = ["chrono", "functions", "bundled"] }
5252
rust_team_data = { git = "https://github.com/rust-lang/team" }
53-
rustwide = { version = "0.19.3", features = [
53+
rustwide = { version = "0.20.0", features = [
5454
"unstable",
5555
"unstable-toolchain-ci",
5656
] }

src/runner/test.rs

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -48,21 +48,34 @@ pub(super) fn detect_broken<T>(res: Result<T, Error>) -> Result<T, Error> {
4848
match res {
4949
Ok(ok) => Ok(ok),
5050
Err(err) => {
51-
let mut reason = None;
52-
5351
if let Some(error) = err.downcast_ref() {
54-
reason = match *error {
55-
PrepareError::MissingCargoToml => Some(BrokenReason::CargoToml),
56-
PrepareError::InvalidCargoTomlSyntax => Some(BrokenReason::CargoToml),
57-
PrepareError::YankedDependencies(_) => Some(BrokenReason::Yanked),
58-
PrepareError::MissingDependencies(_) => Some(BrokenReason::MissingDependencies),
59-
PrepareError::PrivateGitRepository => Some(BrokenReason::MissingGitRepository),
60-
_ => None,
61-
}
62-
}
52+
let reason = match *error {
53+
PrepareError::MissingCargoToml => {
54+
TestResult::BrokenCrate(BrokenReason::CargoToml)
55+
}
56+
PrepareError::InvalidCargoTomlSyntax => {
57+
TestResult::BrokenCrate(BrokenReason::CargoToml)
58+
}
59+
PrepareError::YankedDependencies(_) => {
60+
TestResult::BrokenCrate(BrokenReason::Yanked)
61+
}
62+
PrepareError::MissingDependencies(_) => {
63+
TestResult::BrokenCrate(BrokenReason::MissingDependencies)
64+
}
65+
PrepareError::PrivateGitRepository => {
66+
TestResult::BrokenCrate(BrokenReason::MissingGitRepository)
67+
}
68+
_ => {
69+
let reason = failure_reason(&err);
70+
if reason.is_spurious() || matches!(reason, FailureReason::Unknown) {
71+
TestResult::PrepareFail(reason)
72+
} else {
73+
TestResult::BrokenCrate(BrokenReason::Unknown)
74+
}
75+
}
76+
};
6377

64-
if let Some(reason) = reason {
65-
Err(err.context(OverrideResult(TestResult::BrokenCrate(reason))))
78+
Err(err.context(OverrideResult(reason)))
6679
} else {
6780
Err(err)
6881
}

0 commit comments

Comments
 (0)