summaryrefslogtreecommitdiffstats
path: root/tools/valgrind/tsan_analyze.py
diff options
context:
space:
mode:
authortimurrrr@chromium.org <timurrrr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-30 18:38:39 +0000
committertimurrrr@chromium.org <timurrrr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-30 18:38:39 +0000
commit253652f76f5dc7813ab50b04bd337862caaf8965 (patch)
tree3bf942ece9f1b892c6af273cf2272add33dd8bba /tools/valgrind/tsan_analyze.py
parent8db89020f48b2cba994f7ee48176250dad6e91c7 (diff)
downloadchromium_src-253652f76f5dc7813ab50b04bd337862caaf8965.zip
chromium_src-253652f76f5dc7813ab50b04bd337862caaf8965.tar.gz
chromium_src-253652f76f5dc7813ab50b04bd337862caaf8965.tar.bz2
Print suppressions used by ThreadSanitizer.
The suppression-count logic is copied from memcheck_analyze.py Review URL: http://codereview.chromium.org/246046 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@27638 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools/valgrind/tsan_analyze.py')
-rw-r--r--tools/valgrind/tsan_analyze.py48
1 files changed, 37 insertions, 11 deletions
diff --git a/tools/valgrind/tsan_analyze.py b/tools/valgrind/tsan_analyze.py
index 13f3bc7..b06f91e 100644
--- a/tools/valgrind/tsan_analyze.py
+++ b/tools/valgrind/tsan_analyze.py
@@ -28,36 +28,62 @@ class TsanAnalyze:
'''
self.races = []
+ self.used_suppressions = {}
for file in files:
- self.races = self.races + self.GetReportFrom(file)
+ self.ParseReportFile(file)
- def GetReportFrom(self, filename):
- ret = []
+ def ParseReportFile(self, filename):
f = open(filename, 'r')
while True:
+ # Read race reports.
line = f.readline()
if (line == ''):
break
+
+ if re.search("ERROR SUMMARY", line):
+ # TSAN has finished working. The remaining reports are duplicates.
+ break
+
tmp = ""
- while (re.match(".*INFO: T.* " +
- "(has been created by T.* at this point|is program's main thread)"
- ".*", line)):
+ while (re.search("INFO: T.* "
+ "(has been created by T.* at this point"
+ "|is program's main thread)", line)):
tmp = tmp + line
- while not re.match(".*}}}.*", line):
+ while not re.search("}}}", line):
line = f.readline()
tmp = tmp + line
line = f.readline()
- if (re.match(".*Possible data race.*", line)):
+ if (re.search("Possible data race", line)):
tmp = tmp + line
- while not re.match(".*}}}.*", line):
+ while not re.search("}}}", line):
line = f.readline()
tmp = tmp + line
- ret.append(tmp.strip())
+ self.races.append(tmp.strip())
+
+ while True:
+ # Read the list of used suppressions.
+ line = f.readline()
+ if (line == ''):
+ break
+ match = re.search(" used_suppression:\s+([0-9]+)\s(.*)", line)
+ if match:
+ count, supp_name = match.groups()
+ if supp_name in self.used_suppressions:
+ self.used_suppressions[supp_name] += count
+ else:
+ self.used_suppressions[supp_name] = count
f.close()
- return ret
def Report(self):
+ print "-----------------------------------------------------"
+ print "Suppressions used:"
+ print " count name"
+ for item in sorted(self.used_suppressions.items(), key=lambda (k,v): (v,k)):
+ print "%7s %s" % (item[1], item[0])
+ print "-----------------------------------------------------"
+ sys.stdout.flush()
+
if len(self.races) > 0:
logging.error("Found %i race reports" % len(self.races))
for report in self.races: