wombatu-kun commented on code in PR #19918:
URL: https://github.com/apache/hudi/pull/19918#discussion_r4346905100


##########
scripts/ci/test_timing_summary.py:
##########
@@ -0,0 +1,118 @@
+#!/usr/bin/env python3
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+"""Summarise test timings from surefire and scalatest XML reports.
+
+Scans every target/surefire-reports/TEST-*.xml under the given root (both 
surefire and the
+scalatest-maven-plugin write that layout) and prints, as Markdown, the slowest 
test classes and
+the slowest individual tests. CI appends the output to the job's step summary 
so the long tail
+of a job is visible on the run page without opening logs; run it locally after 
`mvn test` to
+see the same for a module.
+
+Usage: test_timing_summary.py [--root DIR] [--classes N] [--tests N] [--title 
TEXT]
+"""
+import argparse
+import collections
+import os
+import sys
+import xml.etree.ElementTree as ET
+
+
+def scan(root):
+    classes = collections.defaultdict(lambda: [0.0, 0, 0])  # time, tests, 
failed
+    tests = []
+    files = 0
+    for dirpath, dirnames, filenames in os.walk(root):
+        # Reports live at <module>/target/surefire-reports. Prune everything 
else so the walk
+        # stays cheap on a built checkout, where target/ holds thousands of 
class directories.
+        base = os.path.basename(dirpath)
+        if base == "target":
+            dirnames[:] = [d for d in dirnames if d == "surefire-reports"]

Review Comment:
   `scan` only enters `surefire-reports`, so the failsafe ITs that 
test-flink-1, test-flink-2 and integration-tests mostly run never reach the 
tables (test-flink-2's summary on this PR's run reads 0 tests). Could it accept 
`failsafe-reports` as well, since failsafe writes the same `TEST-*.xml`?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to