Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
godotengine
GitHub Repository: godotengine/godot
Path: blob/master/misc/scripts/check_ci_log.py
9896 views
1
#!/usr/bin/env python
2
# -*- coding: utf-8 -*-
3
4
import sys
5
6
if len(sys.argv) < 2:
7
print("ERROR: You must run program with file name as argument.")
8
sys.exit(50)
9
10
fname = sys.argv[1]
11
12
with open(fname.strip(), "r", encoding="utf-8") as fileread:
13
file_contents = fileread.read()
14
15
# If find "ERROR: AddressSanitizer:", then happens invalid read or write
16
# This is critical bug, so we need to fix this as fast as possible
17
18
if file_contents.find("ERROR: AddressSanitizer:") != -1:
19
print("FATAL ERROR: An incorrectly used memory was found.")
20
sys.exit(51)
21
22
# There is also possible, that program crashed with or without backtrace.
23
24
if (
25
file_contents.find("Program crashed with signal") != -1
26
or file_contents.find("Dumping the backtrace") != -1
27
or file_contents.find("Segmentation fault (core dumped)") != -1
28
or file_contents.find("Aborted (core dumped)") != -1
29
or file_contents.find("terminate called without an active exception") != -1
30
):
31
print("FATAL ERROR: Godot has been crashed.")
32
sys.exit(52)
33
34
# Finding memory leaks in Godot is quite difficult, because we need to take into
35
# account leaks also in external libraries. They are usually provided without
36
# debugging symbols, so the leak report from it usually has only 2/3 lines,
37
# so searching for 5 element - "#4 0x" - should correctly detect the vast
38
# majority of memory leaks
39
40
if file_contents.find("ERROR: LeakSanitizer:") != -1:
41
if file_contents.find("#4 0x") != -1:
42
print("ERROR: Memory leak was found")
43
sys.exit(53)
44
45
# It may happen that Godot detects leaking nodes/resources and removes them, so
46
# this possibility should also be handled as a potential error, even if
47
# LeakSanitizer doesn't report anything
48
49
if file_contents.find("ObjectDB instances leaked at exit") != -1:
50
print("ERROR: Memory leak was found")
51
sys.exit(54)
52
53
# In test project may be put several assert functions which will control if
54
# project is executed with right parameters etc. which normally will not stop
55
# execution of project
56
57
if file_contents.find("Assertion failed") != -1:
58
print("ERROR: Assertion failed in project, check execution log for more info")
59
sys.exit(55)
60
61
# For now Godot leaks a lot of rendering stuff so for now we just show info
62
# about it and this needs to be re-enabled after fixing this memory leaks.
63
64
if file_contents.find("were leaked") != -1 or file_contents.find("were never freed") != -1:
65
print("WARNING: Memory leak was found")
66
67
sys.exit(0)
68
69