From fb87d4529da7608b9c93c9fce33387a29cb7cde3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bennet=20Ble=C3=9Fmann?= Date: Thu, 19 Dec 2024 12:48:54 +0100 Subject: [PATCH] detect linker error due to bus error and categorize it as spuriouse --- src/report/display.rs | 2 ++ src/results/mod.rs | 3 +++ src/runner/test.rs | 6 ++++++ 3 files changed, 11 insertions(+) diff --git a/src/report/display.rs b/src/report/display.rs index 10aaf72f..aee6247e 100644 --- a/src/report/display.rs +++ b/src/report/display.rs @@ -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(), @@ -30,6 +31,7 @@ impl ResultName for FailureReason { | FailureReason::Timeout | FailureReason::OOM | FailureReason::NoSpace + | FailureReason::BusErrorWhileLinking | FailureReason::CompilerDiagnosticChange | FailureReason::ICE => self.short_name(), } diff --git a/src/results/mod.rs b/src/results/mod.rs index 633bce7a..6c5da0fc 100644 --- a/src/results/mod.rs +++ b/src/results/mod.rs @@ -197,6 +197,7 @@ pub enum FailureReason { Unknown, OOM, NoSpace, + BusErrorWhileLinking, Timeout, ICE, NetworkAccess, @@ -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"), @@ -281,6 +283,7 @@ impl FailureReason { match *self { FailureReason::OOM | FailureReason::NoSpace + | FailureReason::BusErrorWhileLinking | FailureReason::Timeout | FailureReason::NetworkAccess | FailureReason::CompilerDiagnosticChange => true, diff --git a/src/runner/test.rs b/src/runner/test.rs index d5b4f6f2..2ce9ffde 100644 --- a/src/runner/test.rs +++ b/src/runner/test.rs @@ -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(); @@ -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; } @@ -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() {