about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/ci/citool/src/analysis.rs13
-rw-r--r--src/ci/citool/src/utils.rs6
2 files changed, 12 insertions, 7 deletions
diff --git a/src/ci/citool/src/analysis.rs b/src/ci/citool/src/analysis.rs
index 9fc7c309bfb..62974be2dbe 100644
--- a/src/ci/citool/src/analysis.rs
+++ b/src/ci/citool/src/analysis.rs
@@ -8,9 +8,9 @@ use build_helper::metrics::{
 };
 
 use crate::github::JobInfoResolver;
-use crate::metrics;
 use crate::metrics::{JobMetrics, JobName, get_test_suites};
 use crate::utils::{output_details, pluralize};
+use crate::{metrics, utils};
 
 /// Outputs durations of individual bootstrap steps from the gathered bootstrap invocations,
 /// and also a table with summarized information about executed tests.
@@ -394,18 +394,17 @@ fn aggregate_tests(metrics: &JsonRoot) -> TestSuiteData {
             // Poor man's detection of doctests based on the "(line XYZ)" suffix
             let is_doctest = matches!(suite.metadata, TestSuiteMetadata::CargoPackage { .. })
                 && test.name.contains("(line");
-            let test_entry = Test { name: generate_test_name(&test.name), stage, is_doctest };
+            let test_entry = Test {
+                name: utils::normalize_path_delimiters(&test.name).to_string(),
+                stage,
+                is_doctest,
+            };
             tests.insert(test_entry, test.outcome.clone());
         }
     }
     TestSuiteData { tests }
 }
 
-/// Normalizes Windows-style path delimiters to Unix-style paths.
-fn generate_test_name(name: &str) -> String {
-    name.replace('\\', "/")
-}
-
 /// Prints test changes in Markdown format to stdout.
 fn report_test_diffs(
     diff: AggregatedTestDiffs,
diff --git a/src/ci/citool/src/utils.rs b/src/ci/citool/src/utils.rs
index a4c6ff85ef7..0367d349a1e 100644
--- a/src/ci/citool/src/utils.rs
+++ b/src/ci/citool/src/utils.rs
@@ -1,3 +1,4 @@
+use std::borrow::Cow;
 use std::path::Path;
 
 use anyhow::Context;
@@ -28,3 +29,8 @@ where
     func();
     println!("</details>\n");
 }
+
+/// Normalizes Windows-style path delimiters to Unix-style paths.
+pub fn normalize_path_delimiters(name: &str) -> Cow<str> {
+    if name.contains("\\") { name.replace('\\', "/").into() } else { name.into() }
+}