From 8de319076ff0432cba3c09e06c1b0ac05d321d8e Mon Sep 17 00:00:00 2001 From: "timurrrr@chromium.org" Date: Tue, 21 Jun 2011 08:18:51 +0000 Subject: Print suppression hashes for TSan reports The buildbot should extract the suppression snippets, all the needed regexps are already there for Valgrind and HeapChecker bots. Also, make Memcheck hashes device-independent TEST=Run base_unittests --gtest_filter=*Sanity* without suppressions Review URL: http://codereview.chromium.org/7201026 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@89804 0039d316-1c4b-4281-b951-d872f2087c98 --- tools/valgrind/memcheck_analyze.py | 17 +++++++++++++---- tools/valgrind/tsan_analyze.py | 13 +++++++++++-- 2 files changed, 24 insertions(+), 6 deletions(-) (limited to 'tools/valgrind') diff --git a/tools/valgrind/memcheck_analyze.py b/tools/valgrind/memcheck_analyze.py index f4a1322..177fd17 100755 --- a/tools/valgrind/memcheck_analyze.py +++ b/tools/valgrind/memcheck_analyze.py @@ -1,5 +1,5 @@ #!/usr/bin/python -# Copyright (c) 2010 The Chromium Authors. All rights reserved. +# Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. @@ -9,6 +9,7 @@ import gdb_helper +import hashlib import logging import optparse import os @@ -254,8 +255,10 @@ class ValgrindError: assert self._suppression != None, "Your Valgrind doesn't generate " \ "suppressions - is it too old?" - output += "Suppression (error hash=#%016X#):" % \ - (self.__hash__() & 0xffffffffffffffff) + output += "Suppression (error hash=#%016X#):\n" % self.ErrorHash() + output += (" For more info on using suppressions see " + "http://dev.chromium.org/developers/how-tos/using-valgrind#TOC-Suppressing-Errors") + # Widen suppression slightly to make portable between mac and linux supp = self._suppression; supp = supp.replace("fun:_Znwj", "fun:_Znw*") @@ -300,6 +303,12 @@ class ValgrindError: return rep + # This is a device-independent hash identifying the suppression. + # By printing out this hash we can find duplicate reports between tests and + # different shards running on multiple buildbots + def ErrorHash(self): + return int(hashlib.md5(self.UniqueString()).hexdigest()[:16], 16) + def __hash__(self): return hash(self.UniqueString()) def __eq__(self, rhs): @@ -489,7 +498,7 @@ class MemcheckAnalyzer: # ... but we saw it in earlier reports, e.g. previous UI test cur_report_errors.add("This error was already printed in " "some other test, see 'hash=#%016X#'" % \ - (error.__hash__() & 0xffffffffffffffff)) + self.ErrorHash()) else: # ... and we haven't seen it in other tests as well self._errors.add(error) diff --git a/tools/valgrind/tsan_analyze.py b/tools/valgrind/tsan_analyze.py index 79298ee..e35d3e1 100644 --- a/tools/valgrind/tsan_analyze.py +++ b/tools/valgrind/tsan_analyze.py @@ -10,6 +10,7 @@ import gdb_helper import common +import hashlib import logging import optparse import os @@ -112,11 +113,19 @@ class TsanAnalyzer(object): result.append(self.stack_trace_line_) self.ReadLine() if re.match('-+ suppression -+', self.line_): - result.append(self.line_) + # We need to calculate the suppression hash and prepend a line like + # "Suppression (error hash=#0123456789ABCDEF#):" so the buildbot can + # extract the suppression snippet. + supp = "" while not re.match('-+ end suppression -+', self.line_): self.ReadLine() - result.append(self.line_) + supp += self.line_ self.ReadLine() + result.append("Suppression (error hash=#%016X#):\n" % \ + (int(hashlib.md5(supp).hexdigest()[:16], 16))) + result.append(" For more info on using suppressions see " + "http://dev.chromium.org/developers/how-tos/using-valgrind/threadsanitizer#TOC-Suppressing-data-races\n") + result.append(supp) else: self.ReadLine() -- cgit v1.1