-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathanalyse-graalpy-failures.py
202 lines (191 loc) · 6.4 KB
/
analyse-graalpy-failures.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
import argparse
import os
from ErrorAnalyzer import ErrorAnalyzer
from FailureDataCollector import FailureDataCollectorCliParser
import matplotlib.pyplot as plt
from ResultVisualizer import ResultVisualizer
parser = argparse.ArgumentParser(description="Analyse graalpy failures")
parser.add_argument(
"-gx",
"--graalpy-xml",
help="Name of the JunitXML-file with graalpy results",
default="graalpy-test-results.xml",
)
parser.add_argument(
"-cx",
"--cpython-xml",
help="Name of the JunitXML-file with cpython results",
default="cpython-test-results.xml",
)
parser.add_argument(
"-gf",
"--graalpy-folder",
help="Name of the folder with graalpy results",
required=True,
)
parser.add_argument(
"-cf",
"--cpython-folder",
help="Name of the folder with cpython results",
required=True,
)
parser.add_argument(
"-p",
"--print-general-information",
help="print general information about the test results",
action="store_true",
)
parser.add_argument("-ft", "--filter-type", help="filter error type by regex")
parser.add_argument("-fm", "--filter-message", help="filter error message by regex")
parser.add_argument("-fs", "--filter-stacktrace", help="filter stacktrace by regex")
parser.add_argument("-fp", "--filter-package", help="filter package by regex")
parser.add_argument(
"-sh",
"--show-hist",
help="show histogram of error types, message, package and last stacktrace line",
action="store_true",
)
parser.add_argument(
"-sht",
"--show-hist-type",
help="show histogram of error types",
action="store_true",
)
parser.add_argument(
"-gt",
"--group-type",
help="group failures with passing regex expression of the error type for error type histogram (list possible)",
nargs="+",
)
parser.add_argument(
"-shm",
"--show-hist-message",
help="show histogram of error messages",
action="store_true",
)
parser.add_argument(
"-gm",
"--group-message",
help="group failures with passing regex expression of the error message for error message histogram (list possible)",
nargs="+",
)
parser.add_argument(
"-shp",
"--show-hist-package",
help="show histogram of packages",
action="store_true",
)
parser.add_argument(
"-gp",
"--group-package",
help="group failures with passing regex expression of the error package for package histogram (list possible)",
nargs="+",
)
parser.add_argument(
"-shl",
"--show-hist-last-lines",
help="show histogram of last stacktrace lines",
action="store_true",
)
parser.add_argument(
"-gl",
"--group-last-lines",
help="group failures with passing regex expression of the last stacktrace line for the last stacktrace line histogram (list possible)",
nargs="+",
)
parser.add_argument(
"-ptt", "--print-top-types", help="print top error types", action="store_true"
)
parser.add_argument(
"-ptm", "--print-top-messages", help="print top error messages", action="store_true"
)
parser.add_argument(
"-ptl",
"--print-top-last-lines",
help="print top last stacktrace lines",
action="store_true",
)
parser.add_argument(
"-pe", "--print-everything", help="print everything", action="store_true"
)
parser.add_argument(
"--plot-tfidf-messages", help="plot tfidf of error messages", action="store_true"
)
parser.add_argument(
"--plot-tfidf-stacktraces",
help="plot tfidf of error stacktraces",
action="store_true",
)
parser.add_argument(
"--plot-tfidf-last-lines",
help="plot tfidf of last error stacktrace lines",
action="store_true",
)
parser.add_argument(
"--print-tfidf-stacktraces",
help="print tfidf of error stacktraces",
action="store_true",
)
parser.add_argument(
"--print-tfidf-last-lines",
help="print tfidf of last error stacktrace lines",
action="store_true",
)
if __name__ == "__main__":
args = parser.parse_args()
cli_parser = FailureDataCollectorCliParser(args)
root_analyzer = ErrorAnalyzer(cli_parser)
if args.filter_type:
root_analyzer = root_analyzer.filter_error_type(args.filter_type)
if args.filter_message:
root_analyzer = root_analyzer.filter_error_message(args.filter_message)
if args.filter_stacktrace:
root_analyzer = root_analyzer.filter_stacktrace(args.filter_stacktrace)
if args.filter_package:
root_analyzer = root_analyzer.filter_packages(args.filter_package)
if args.show_hist_type or args.show_hist:
analyzer = root_analyzer
for error_type in args.group_type or list():
analyzer = analyzer.group_error_type(error_type)
visualizer = ResultVisualizer(analyzer)
visualizer.plot_hist_error_types()
if args.show_hist_message or args.show_hist:
analyzer = root_analyzer
for error_message in args.group_message or list():
analyzer = analyzer.group_error_message(error_message)
visualizer = ResultVisualizer(analyzer)
visualizer.plot_hist_error_messages()
if args.show_hist_package or args.show_hist:
analyzer = root_analyzer
for package in args.group_package or list():
analyzer = analyzer.group_packages(package)
visualizer = ResultVisualizer(analyzer)
visualizer.plot_hist_packages()
if args.show_hist_last_lines or args.show_hist:
analyzer = root_analyzer
for last_line in args.group_last_lines or list():
analyzer = analyzer.group_last_lines(last_line)
visualizer = ResultVisualizer(analyzer)
visualizer.plot_hist_last_stacktrace_lines()
visualizer = ResultVisualizer(root_analyzer)
if args.print_general_information:
visualizer.print_general_information()
if args.print_top_types:
visualizer.print_top_error_types()
if args.print_top_messages:
visualizer.print_top_error_messages()
if args.print_top_last_lines:
visualizer.print_top_error_last_stacktrace_lines()
if args.print_everything:
visualizer.print_everything()
if args.plot_tfidf_messages:
visualizer.plot_tfidf_error_messages()
if args.plot_tfidf_stacktraces:
visualizer.plot_tfidf_error_stacktraces()
if args.plot_tfidf_last_lines:
visualizer.plot_tfidf_last_stacktrace_lines()
if args.print_tfidf_stacktraces:
visualizer.print_tfidf_error_stacktraces(0.8, 0.95)
if args.print_tfidf_last_lines:
visualizer.print_tfidf_last_stacktrace_lines(0.8, 0.95)
plt.show()