Skip to content

Commit a30468e

Browse files
oharboeclaude
andcommitted
review: syn-dashboard treats corrupt test.xml as no result, unshadow loop var
Malformed failures/errors attributes now make the whole test.xml count as "no result" (—) like a ParseError, instead of raising — or worse, being swallowed per-attribute and rendering a green cell for a corrupt file. Rename the generator variable shadowing the outer result. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
1 parent 13ce4d0 commit a30468e

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

‎flow/util/synDashboard.py‎

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,13 @@ def test_status(test_dir):
5757
return None
5858
try:
5959
root = ET.parse(xml_file).getroot()
60-
except ET.ParseError:
60+
failures = 0
61+
for suite in root.iter("testsuite"):
62+
failures += int(suite.get("failures") or 0) + int(suite.get("errors") or 0)
63+
except (ET.ParseError, ValueError, TypeError):
64+
# A corrupt test.xml is "no result", not a pass — swallowing the
65+
# error inside the sum would render a green cell for it.
6166
return None
62-
failures = 0
63-
for suite in root.iter("testsuite"):
64-
failures += int(suite.get("failures", 0)) + int(suite.get("errors", 0))
6567
return failures == 0, xml_file.stat().st_mtime
6668

6769

@@ -158,7 +160,7 @@ def main():
158160
if result and not result["passed"] and result["failing"]:
159161
failing = result["failing"]
160162
break
161-
newest = max(result["mtime"] for result in results.values())
163+
newest = max(r["mtime"] for r in results.values())
162164
row = [f"{platform}/{pkg}"] + cells + [format_rules(failing), age(newest)]
163165
print("| " + " | ".join(row) + " |")
164166
print()

0 commit comments

Comments
 (0)