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