Skip to content

armgit / godot

Public Imported from GitHub
0

Godot Engine – Multi-platform 2D and 3D game engine

CI: Silence leak report originating in lavapipe

Rémi Verschelde36c557113e90
diff --git a/misc/scripts/check_ci_log.py b/misc/scripts/check_ci_log.py
index 171783e7b30..f1bd099ad75 100755
--- a/misc/scripts/check_ci_log.py
+++ b/misc/scripts/check_ci_log.py
@@ -1,6 +1,7 @@
#!/usr/bin/env python3
import os
+import re
import sys
if len(sys.argv) < 2:
@@ -35,12 +36,22 @@ if (
# account leaks also in external libraries. They are usually provided without
# debugging symbols, so the leak report from it usually has only 2/3 lines,
# so searching for 5 element - "#4 0x" - should correctly detect the vast
-# majority of memory leaks
+# majority of memory leaks.
+# Leaks allocated directly from an "<unknown module>" are ignored too: they come
+# from a library LeakSanitizer can't see (e.g. Mesa's lavapipe Vulkan driver on
+# some GitHub runners), so they can't be suppressed by name and aren't Godot's.
if file_contents.find("ERROR: LeakSanitizer:") != -1:
- if file_contents.find("#4 0x") != -1:
- print("ERROR: Memory leak was found")
- sys.exit(53)
+ leak_reports = re.split(r"(?:Direct|Indirect) leak of", re.sub(r"\x1b\[[0-9;]*m", "", file_contents))[1:]
+ for leak_report in leak_reports:
+ allocated_from = re.search(r"#1 0x[0-9a-f]+ +(.*)", leak_report)
+ if leak_report.find("#4 0x") != -1 and not (
+ allocated_from and allocated_from.group(1).startswith("(<unknown module>)")
+ ):
+ print("ERROR: Memory leak was found")
+ sys.exit(53)
+ if leak_reports:
+ print("WARNING: Memory leak was found in external libraries, ignoring")
# It may happen that Godot detects leaking nodes/resources and removes them, so
# this possibility should also be handled as a potential error, even if