1840.1.2
by Monty Taylor
Added valgrind stripping program to the tree. |
1 |
#!/usr/bin/env python
|
2 |
#
|
|
3 |
# Copyright (C) 2010 Monty Taylor
|
|
4 |
#
|
|
5 |
# This program is free software; you can redistribute it and/or modify
|
|
6 |
# it under the terms of the GNU General Public License as published by
|
|
7 |
# the Free Software Foundation; version 2 of the License.
|
|
8 |
#
|
|
9 |
# This program is distributed in the hope that it will be useful,
|
|
10 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12 |
# GNU General Public License for more details.
|
|
13 |
#
|
|
14 |
# You should have received a copy of the GNU General Public License
|
|
15 |
# along with this program; if not, write to the Free Software
|
|
16 |
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
17 |
||
18 |
current_test= None |
|
1840.1.3
by Monty Taylor
Added support for valgrind suppressions. |
19 |
in_leak_summary= False |
20 |
in_suppression= False |
|
21 |
new_current_test= True |
|
1840.1.2
by Monty Taylor
Added valgrind stripping program to the tree. |
22 |
results=[] |
23 |
summary={} |
|
24 |
total_warning_count=0 |
|
25 |
||
26 |
for line in open('var/log/master.err','r').readlines(): |
|
27 |
if line[:12] == "CURRENT_TEST": |
|
28 |
current_test= line.split()[1] |
|
29 |
in_leak_summary=False |
|
30 |
new_current_test=True |
|
31 |
continue
|
|
1840.1.3
by Monty Taylor
Added support for valgrind suppressions. |
32 |
if line.strip() == "{": |
33 |
in_suppression= True |
|
34 |
results.append("Suppression:\n{\n") |
|
35 |
continue
|
|
36 |
if line.strip() == "}": |
|
37 |
in_suppression= False |
|
38 |
results.append("}\n") |
|
39 |
continue
|
|
40 |
if in_suppression: |
|
41 |
results.append(line) |
|
42 |
continue
|
|
43 |
||
44 |
||
1840.1.2
by Monty Taylor
Added valgrind stripping program to the tree. |
45 |
if line[:2] != "==": |
46 |
continue
|
|
47 |
valgrind_command= line.split("==")[2] |
|
48 |
if valgrind_command[1:5] == "LEAK": |
|
49 |
in_leak_summary=True |
|
50 |
continue
|
|
51 |
if in_leak_summary: |
|
52 |
continue
|
|
53 |
if valgrind_command[1:6] in ("Copyr","Using","Comma","Memch","For c","ERROR","HEAP "," i"," tot", "Threa","Warni"): |
|
54 |
continue
|
|
55 |
if len(valgrind_command.strip()) > 0: |
|
56 |
if new_current_test: |
|
57 |
summary[current_test]=1 |
|
58 |
total_warning_count += 1 |
|
59 |
new_current_test = False |
|
60 |
results.append("\n\n************") |
|
61 |
results.append(current_test) |
|
62 |
results.append("************\n\n") |
|
63 |
new_current_test = False |
|
64 |
elif valgrind_command[1] != " ": |
|
65 |
summary[current_test] += 1 |
|
66 |
total_warning_count += 1 |
|
67 |
results.append("\n") |
|
68 |
results.append(valgrind_command) |
|
69 |
||
70 |
warning_count=open("total_warning_count","w") |
|
71 |
warning_count.write(str(total_warning_count)) |
|
72 |
warning_count.write("\n") |
|
73 |
warning_count.close() |
|
74 |
||
75 |
outfile=open('stripped_log','w') |
|
76 |
outfile.write("Total warnings:") |
|
77 |
outfile.write(str(total_warning_count)) |
|
78 |
outfile.write("\n\n") |
|
79 |
||
80 |
for k,v in summary.items(): |
|
81 |
outfile.write(str(v)) |
|
82 |
outfile.write(" warnings in ") |
|
83 |
outfile.write(k) |
|
84 |
outfile.write("\n") |
|
85 |
||
86 |
outfile.write("\n\n") |
|
87 |
||
88 |
for line in results: |
|
89 |
outfile.write(line) |
|
90 |
outfile.close() |