[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: playground/devtools
From: Daniel Calviño Sánchez <danxuliu () gmail ! com>
Date: 2010-02-14 0:16:21
Message-ID: 1266106581.451237.22931.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 1089781 by danxuliu:
Adjust memory tests to changes in Valgrind 3.5:
-maximum number of callers is now 50,
-saving XML output to a file is now specified by --xml-file=,
-error explanations can be outputted either in plain text XML elements ("what") like \
in previous versions, or in composed elements ("xwhat") with the message in a plain \
text subelement ("text"). Which one is used seems to depend on the error reported.
M +21 -1 kdevelop4-extra-libraries/veritas/tests/runMemcheck.py
M +21 -2 kdevelop4-extra-plugins/coverage/tests/runMemcheck.py
M +21 -1 kdevelop4-extra-plugins/xtest/qtest/tests/runMemcheck.py
--- trunk/playground/devtools/kdevelop4-extra-libraries/veritas/tests/runMemcheck.py \
#1089780:1089781 @@ -1,4 +1,5 @@
#!/usr/bin/python
+# -*- coding: utf-8 -*-
# run valgrind's memory error checker on all tests.
# filter uninteresting errors and known false positives
# eg staticly initialized memory from libraries like libfontconfig
@@ -14,12 +15,29 @@
return not line.startswith('<unknown program name>') and \
not line.startswith('profiling:')
+def isValgrind3_5OrHigher():
+ process = Popen("valgrind --version", stdout=PIPE, shell=True)
+ process.wait()
+ valgrindOutput = process.stdout.read().strip()
+
+ import re, string
+ version = re.search("[0-9]+(.[0-9]+)*", valgrindOutput).group(0)
+ version = string.split(version, ".")
+
+ if map(int, version) < [3, 5]:
+ return False
+ else:
+ return True
+
def memcheck(test):
''' run valgrind-memcheck on test in testdir. return xml output as string '''
#proc = Popen(["valgrind", "--tool=memcheck", "--leak-check=full", "--xml=yes", \
test], stdout=PIPE, stderr=PIPE) #proc.wait()
#out = proc.stderr.readlines()
- system("valgrind --tool=memcheck --leak-check=full --xml=yes --num-callers=75 " \
+ test + " 1>/dev/null 2>.memcheck.tmp") + if isValgrind3_5OrHigher():
+ system("valgrind --tool=memcheck --leak-check=full --xml=yes \
--xml-file=.memcheck.tmp --num-callers=50 " + test + " 1>/dev/null") + else:
+ system("valgrind --tool=memcheck --leak-check=full --xml=yes \
--num-callers=75 " + test + " 1>/dev/null 2>.memcheck.tmp") out = \
open(".memcheck.tmp").readlines() remove(".memcheck.tmp")
out = filter(garbage, out)
@@ -71,6 +89,8 @@
if xml_child_data(frame, 'fn'): # filter anonymous frames out
self.stack.append(Frame(frame))
self.what = xml_child_data(self.dom, 'what')
+ if self.dom.getElementsByTagName('xwhat').length > 0:
+ self.what = xml_child_data(self.dom.getElementsByTagName('xwhat')[0], \
'text')
def is_definitely_lost(self):
return self.kind == u'Leak_DefinitelyLost'
--- trunk/playground/devtools/kdevelop4-extra-plugins/coverage/tests/runMemcheck.py \
#1089780:1089781 @@ -1,5 +1,5 @@
#!/usr/bin/python
-#!/usr/bin/python
+# -*- coding: utf-8 -*-
# run valgrind's memory error checker on all tests.
# filter uninteresting errors and known false positives
# eg staticly initialized memory from libraries like libfontconfig
@@ -16,12 +16,29 @@
not line.startswith('profiling:') and \
line.find('</valgrindoutput>') # problem is that valgrind erroneously \
puts multiple of these end-document entries if processes are spawned _inside_ the exe \
under investigation
+def isValgrind3_5OrHigher():
+ process = Popen("valgrind --version", stdout=PIPE, shell=True)
+ process.wait()
+ valgrindOutput = process.stdout.read().strip()
+
+ import re, string
+ version = re.search("[0-9]+(.[0-9]+)*", valgrindOutput).group(0)
+ version = string.split(version, ".")
+
+ if map(int, version) < [3, 5]:
+ return False
+ else:
+ return True
+
def memcheck(test):
''' run valgrind-memcheck on test in testdir. return xml output as string '''
#proc = Popen("valgrind --tool=memcheck --leak-check=full --xml=yes " + test, \
stdout=PIPE, stderr=PIPE, shell=True, executable="/bin/bash") #proc.wait()
#out = proc.stderr.readlines()
- system("valgrind --tool=memcheck --leak-check=full --xml=yes --num-callers=75 " \
+ test + " 1>/dev/null 2>.memcheck.tmp") + if isValgrind3_5OrHigher():
+ system("valgrind --tool=memcheck --leak-check=full --xml=yes \
--xml-file=.memcheck.tmp --num-callers=50 " + test + " 1>/dev/null") + else:
+ system("valgrind --tool=memcheck --leak-check=full --xml=yes \
--num-callers=75 " + test + " 1>/dev/null 2>.memcheck.tmp") out = \
open(".memcheck.tmp").readlines() remove(".memcheck.tmp")
out = filter(garbage, out)
@@ -73,6 +90,8 @@
if xml_child_data(frame, 'fn'): # filter anonymous frames out
self.stack.append(Frame(frame))
self.what = xml_child_data(self.dom, 'what')
+ if self.dom.getElementsByTagName('xwhat').length > 0:
+ self.what = xml_child_data(self.dom.getElementsByTagName('xwhat')[0], \
'text')
def is_definitely_lost(self):
return self.kind == u'Leak_DefinitelyLost'
--- trunk/playground/devtools/kdevelop4-extra-plugins/xtest/qtest/tests/runMemcheck.py \
#1089780:1089781 @@ -1,4 +1,5 @@
#!/usr/bin/python
+# -*- coding: utf-8 -*-
# run valgrind's memory error checker on all tests.
# filter uninteresting errors and known false positives
# eg staticly initialized memory from libraries like libfontconfig
@@ -15,12 +16,29 @@
not line.startswith('profiling:') and \
line.find('</valgrindoutput>') # problem is that valgrind erroneously \
puts multiple of these end-document entries if processes are spawned _inside_ the exe \
under investigation
+def isValgrind3_5OrHigher():
+ process = Popen("valgrind --version", stdout=PIPE, shell=True)
+ process.wait()
+ valgrindOutput = process.stdout.read().strip()
+
+ import re, string
+ version = re.search("[0-9]+(.[0-9]+)*", valgrindOutput).group(0)
+ version = string.split(version, ".")
+
+ if map(int, version) < [3, 5]:
+ return False
+ else:
+ return True
+
def memcheck(test):
''' run valgrind-memcheck on test in testdir. return xml output as string '''
#proc = Popen("valgrind --tool=memcheck --leak-check=full --xml=yes " + test, \
stdout=PIPE, stderr=PIPE, shell=True, executable="/bin/bash") #proc.wait()
#out = proc.stderr.readlines()
- system("valgrind --tool=memcheck --leak-check=full --xml=yes --num-callers=75 " \
+ test + " 1>/dev/null 2>.memcheck.tmp") + if isValgrind3_5OrHigher():
+ system("valgrind --tool=memcheck --leak-check=full --xml=yes \
--xml-file=.memcheck.tmp --num-callers=50 " + test + " 1>/dev/null") + else:
+ system("valgrind --tool=memcheck --leak-check=full --xml=yes \
--num-callers=75 " + test + " 1>/dev/null 2>.memcheck.tmp") out = \
open(".memcheck.tmp").readlines() remove(".memcheck.tmp")
out = filter(garbage, out)
@@ -72,6 +90,8 @@
if xml_child_data(frame, 'fn'): # filter anonymous frames out
self.stack.append(Frame(frame))
self.what = xml_child_data(self.dom, 'what')
+ if self.dom.getElementsByTagName('xwhat').length > 0:
+ self.what = xml_child_data(self.dom.getElementsByTagName('xwhat')[0], \
'text')
def is_definitely_lost(self):
return self.kind == u'Leak_DefinitelyLost'
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic