Skip to content

Commit

Permalink
detect linker error due to bus error and categorize it as spuriouse
Browse files Browse the repository at this point in the history
  • Loading branch information
Skgland committed Dec 19, 2024
1 parent 4759ec5 commit fb87d45
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/report/display.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ impl ResultName for FailureReason {
FailureReason::OOM => "OOM".into(),
FailureReason::ICE => "ICE".into(),
FailureReason::NoSpace => "no space left on device".into(),
FailureReason::BusErrorWhileLinking => "bus error while linking".into(),
FailureReason::CompilerError(_) => "compiler error".into(),
FailureReason::DependsOn(_) => "faulty deps".into(),
FailureReason::CompilerDiagnosticChange => "compiler diagnostic changed".into(),
Expand All @@ -30,6 +31,7 @@ impl ResultName for FailureReason {
| FailureReason::Timeout
| FailureReason::OOM
| FailureReason::NoSpace
| FailureReason::BusErrorWhileLinking
| FailureReason::CompilerDiagnosticChange
| FailureReason::ICE => self.short_name(),
}
Expand Down
3 changes: 3 additions & 0 deletions src/results/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ pub enum FailureReason {
Unknown,
OOM,
NoSpace,
BusErrorWhileLinking,
Timeout,
ICE,
NetworkAccess,
Expand All @@ -213,6 +214,7 @@ impl ::std::fmt::Display for FailureReason {
FailureReason::Unknown => write!(f, "unknown"),
FailureReason::OOM => write!(f, "oom"),
FailureReason::NoSpace => write!(f, "no-space"),
FailureReason::BusErrorWhileLinking => write!(f, "bus-error-while-linking"),
FailureReason::Timeout => write!(f, "timeout"),
FailureReason::ICE => write!(f, "ice"),
FailureReason::NetworkAccess => write!(f, "network-access"),
Expand Down Expand Up @@ -281,6 +283,7 @@ impl FailureReason {
match *self {
FailureReason::OOM
| FailureReason::NoSpace
| FailureReason::BusErrorWhileLinking
| FailureReason::Timeout
| FailureReason::NetworkAccess
| FailureReason::CompilerDiagnosticChange => true,
Expand Down
6 changes: 6 additions & 0 deletions src/runner/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ fn run_cargo(

let mut did_ice = false;
let mut did_network = false;
let mut had_bus_error_while_linking = false;
let mut did_trybuild = false;
let mut ran_out_of_space = false;
let mut error_codes = BTreeSet::new();
Expand All @@ -153,6 +154,9 @@ fn run_cargo(
if line.contains("Address already in use") {
did_network = true;
}
if line.contains("collect2: fatal error: ld terminated with signal 7 [Bus error]") {
had_bus_error_while_linking = true;
}
if line.to_lowercase().contains("no space left on device") {
ran_out_of_space = true;
}
Expand Down Expand Up @@ -233,6 +237,8 @@ fn run_cargo(
Err(e.context(FailureReason::ICE).into())
} else if ran_out_of_space {
Err(e.context(FailureReason::NoSpace).into())
} else if had_bus_error_while_linking {
Err(e.context(FailureReason::BusErrorWhileLinking).into())
} else if !deps.is_empty() {
Err(e.context(FailureReason::DependsOn(deps)).into())
} else if !error_codes.is_empty() {
Expand Down

0 comments on commit fb87d45

Please sign in to comment.