Rollup merge of #151810 - Unique-Usman:ua/debuginfostat, r=Kobzol
citool: report debuginfo test statistics Extend CI postprocessing to aggregate pass/fail/ignored counts for debuginfo tests. Tests are identified via their reported suite names (e.g. debuginfo-gdb, debuginfo-lldb or debuginfo-cdb).
This commit is contained in:
commit
b86fbcd358
2 changed files with 52 additions and 1 deletions
|
|
@ -111,6 +111,29 @@ pub struct JsonStepSystemStats {
|
|||
pub cpu_utilization_percent: f64,
|
||||
}
|
||||
|
||||
#[derive(Eq, Hash, PartialEq, Debug)]
|
||||
pub enum DebuggerKind {
|
||||
Gdb,
|
||||
Lldb,
|
||||
Cdb,
|
||||
}
|
||||
|
||||
impl DebuggerKind {
|
||||
pub fn debuginfo_kind(name: &str) -> Option<DebuggerKind> {
|
||||
let name = name.to_ascii_lowercase();
|
||||
|
||||
if name.contains("debuginfo-gdb") {
|
||||
Some(DebuggerKind::Gdb)
|
||||
} else if name.contains("debuginfo-lldb") {
|
||||
Some(DebuggerKind::Lldb)
|
||||
} else if name.contains("debuginfo-cdb") {
|
||||
Some(DebuggerKind::Cdb)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn null_as_f64_nan<'de, D: serde::Deserializer<'de>>(d: D) -> Result<f64, D::Error> {
|
||||
use serde::Deserialize as _;
|
||||
Option::<f64>::deserialize(d).map(|f| f.unwrap_or(f64::NAN))
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ use std::fmt::Debug;
|
|||
use std::time::Duration;
|
||||
|
||||
use build_helper::metrics::{
|
||||
BuildStep, JsonRoot, TestOutcome, TestSuite, TestSuiteMetadata, escape_step_name,
|
||||
BuildStep, DebuggerKind, JsonRoot, TestOutcome, TestSuite, TestSuiteMetadata, escape_step_name,
|
||||
format_build_steps,
|
||||
};
|
||||
|
||||
|
|
@ -139,11 +139,39 @@ fn record_test_suites(metrics: &JsonRoot) {
|
|||
let table = render_table(aggregated);
|
||||
println!("\n# Test results\n");
|
||||
println!("{table}");
|
||||
report_debuginfo_statistics(&suites);
|
||||
} else {
|
||||
eprintln!("No test suites found in metrics");
|
||||
}
|
||||
}
|
||||
|
||||
fn report_debuginfo_statistics(suites: &[&TestSuite]) {
|
||||
let mut debugger_test_record: HashMap<DebuggerKind, TestSuiteRecord> = HashMap::new();
|
||||
for suite in suites {
|
||||
if let TestSuiteMetadata::Compiletest { .. } = suite.metadata {
|
||||
for test in &suite.tests {
|
||||
if let Some(kind) = DebuggerKind::debuginfo_kind(&test.name) {
|
||||
let record =
|
||||
debugger_test_record.entry(kind).or_insert(TestSuiteRecord::default());
|
||||
match test.outcome {
|
||||
TestOutcome::Passed => record.passed += 1,
|
||||
TestOutcome::Ignored { .. } => record.ignored += 1,
|
||||
TestOutcome::Failed => record.failed += 1,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
println!("## DebugInfo Test Statistics");
|
||||
for (kind, record) in debugger_test_record {
|
||||
println!(
|
||||
"- {:?}: Passed ✅={}, Failed ❌={}, Ignored 🚫={}",
|
||||
kind, record.passed, record.failed, record.ignored
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
fn render_table(suites: BTreeMap<String, TestSuiteRecord>) -> String {
|
||||
use std::fmt::Write;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue