diff options
author | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-09 21:33:26 +0000 |
---|---|---|
committer | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-09 21:33:26 +0000 |
commit | 4d16f4c72c872cb8b1b7399617d887e86e10dbab (patch) | |
tree | 8ec03974518a10adc380d3839117bc6033d74902 | |
parent | 13a96c981dc1dfc826e6592408e910d8284ccc52 (diff) | |
download | chromium_src-4d16f4c72c872cb8b1b7399617d887e86e10dbab.zip chromium_src-4d16f4c72c872cb8b1b7399617d887e86e10dbab.tar.gz chromium_src-4d16f4c72c872cb8b1b7399617d887e86e10dbab.tar.bz2 |
Add support for per-module suppression files.
Also fixes a typo in logging.
Review URL: http://codereview.chromium.org/17321
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@7837 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | net/data/valgrind/suppressions.txt | 31 | ||||
-rwxr-xr-x | tools/valgrind/chrome_tests.py | 37 | ||||
-rwxr-xr-x | tools/valgrind/valgrind_analyze.py | 2 | ||||
-rwxr-xr-x | tools/valgrind/valgrind_test.py | 20 |
4 files changed, 68 insertions, 22 deletions
diff --git a/net/data/valgrind/suppressions.txt b/net/data/valgrind/suppressions.txt new file mode 100644 index 0000000..5eaa6b7 --- /dev/null +++ b/net/data/valgrind/suppressions.txt @@ -0,0 +1,31 @@ +{ + Test DiskCacheBackendTest.InvalidEntryEnumeration leaks. + Memcheck:Leak + fun:_Znwj + fun:_ZN10disk_cache12StorageBlockINS_12RankingsNodeEE12AllocateDataEv + fun:_ZN10disk_cache12StorageBlockINS_12RankingsNodeEE4LoadEv + fun:_ZN10disk_cache9EntryImpl15LoadNodeAddressEv + fun:_ZN10disk_cache11BackendImpl8NewEntryENS_4AddrEPPNS_9EntryImplEPb + fun:_ZN10disk_cache11BackendImpl10MatchEntryERKSsjb + fun:_ZN10disk_cache11BackendImpl9OpenEntryERKSsPPNS_5EntryE + fun:_ZN49DiskCacheBackendTest_InvalidEntryEnumeration_Test8TestBodyEv + fun:_ZN7testing4Test3RunEv +} +{ + Test DiskCacheBackendTest.InvalidEntryRead leaks. + Memcheck:Leak + fun:_Znwj + fun:_ZN10disk_cache11BackendImpl8NewEntryENS_4AddrEPPNS_9EntryImplEPb + fun:_ZN10disk_cache11BackendImpl10MatchEntryERKSsjb + fun:_ZN10disk_cache11BackendImpl9OpenEntryERKSsPPNS_5EntryE + fun:_ZN42DiskCacheBackendTest_InvalidEntryRead_Test8TestBodyEv + fun:_ZN7testing4Test3RunEv +} +{ + Test DiskCacheBackendTest.InvalidEntryWithLoad leaks. + Memcheck:Leak + fun:_Znwj + fun:_ZN10disk_cache11BackendImpl11CreateEntryERKSsPPNS_5EntryE + fun:_ZN46DiskCacheBackendTest_InvalidEntryWithLoad_Test8TestBodyEv + fun:_ZN7testing4Test3RunEv +} diff --git a/tools/valgrind/chrome_tests.py b/tools/valgrind/chrome_tests.py index d393353..0292f14 100755 --- a/tools/valgrind/chrome_tests.py +++ b/tools/valgrind/chrome_tests.py @@ -82,10 +82,17 @@ class ChromeTests: '''Generates the default command array that most tests will use.''' module_dir = os.path.join(self._source_dir, module) - # For now, the suppressions files are all the same across all modules. Copy - # the code in the purify version of chrome_tests.py if we ever need - # per-module suppressions again... - self._data_dir = google.path_utils.ScriptDir() + # We need multiple data dirs, the current script directory and a module + # specific one. The global suppression file lives in our directory, and the + # module specific suppression file lives with the module. + self._data_dirs = [google.path_utils.ScriptDir()] + + if module == "chrome": + # unfortunately, not all modules have the same directory structure + self._data_dirs.append(os.path.join(module_dir, "test", "data", + "valgrind")) + else: + self._data_dirs.append(os.path.join(module_dir, "data", "valgrind")) if not self._options.build_dir: dir_chrome = os.path.join(self._source_dir, "chrome", "Hammer") @@ -114,7 +121,10 @@ class ChromeTests: self._options.build_dir = dir_chrome cmd = list(self._command_preamble) - cmd.append("--data_dir=%s" % self._data_dir) + for directory in self._data_dirs: + suppression_file = os.path.join(directory, "suppressions.txt") + if os.path.exists(suppression_file): + cmd.append("--suppressions=%s" % suppression_file) if self._options.baseline: cmd.append("--baseline") if self._options.verbose: @@ -135,14 +145,15 @@ class ChromeTests: and append the command-line option to cmd. ''' filters = [] - filename = os.path.join(self._data_dir, name + ".gtest.txt") - if os.path.exists(filename): - f = open(filename, 'r') - for line in f.readlines(): - if line.startswith("#") or line.startswith("//") or line.isspace(): - continue - line = line.rstrip() - filters.append(line) + for directory in self._data_dirs: + filename = os.path.join(directory, name + ".gtest.txt") + if os.path.exists(filename): + f = open(filename, 'r') + for line in f.readlines(): + if line.startswith("#") or line.startswith("//") or line.isspace(): + continue + line = line.rstrip() + filters.append(line) gtest_filter = self._options.gtest_filter if len(filters): if gtest_filter: diff --git a/tools/valgrind/valgrind_analyze.py b/tools/valgrind/valgrind_analyze.py index c73f6bf..601888a 100755 --- a/tools/valgrind/valgrind_analyze.py +++ b/tools/valgrind/valgrind_analyze.py @@ -97,7 +97,7 @@ class ValgrindError: " (") if frame[SRC_FILE_DIR] != "": - output += (frame[SRC_FILE_DIR] + "/" + frame[SRC_FILE_DIR] + ":" + + output += (frame[SRC_FILE_DIR] + "/" + frame[SRC_FILE_NAME] + ":" + frame[SRC_LINE]) else: output += frame[OBJECT_FILE] diff --git a/tools/valgrind/valgrind_test.py b/tools/valgrind/valgrind_test.py index 1a6f363..8ab7c55 100755 --- a/tools/valgrind/valgrind_test.py +++ b/tools/valgrind/valgrind_test.py @@ -31,7 +31,7 @@ class Valgrind(): TMP_DIR = "valgrind.tmp" def __init__(self): - self._data_dir = None + self._suppressions_files = [] def CreateOptionParser(self): self._parser = optparse.OptionParser("usage: %prog [options] <program to " @@ -45,8 +45,9 @@ class Valgrind(): self._parser.add_option("", "--source_dir", help="path to top of source tree for this build" "(used to normalize source paths in baseline)") - self._parser.add_option("", "--data_dir", default=".", - help="path to where purify data files live") + self._parser.add_option("", "--suppressions", default=["."], + action="append", + help="path to a valgrind suppression file") self._parser.add_option("", "--generate_suppressions", action="store_true", default=False, help="Skip analysis and generate suppressions") @@ -56,7 +57,7 @@ class Valgrind(): self.CreateOptionParser() self._options, self._args = self._parser.parse_args() self._timeout = int(self._options.timeout) - self._data_dir = self._options.data_dir + self._suppressions = self._options.suppressions self._generate_suppressions = self._options.generate_suppressions self._source_dir = self._options.source_dir return True @@ -78,10 +79,13 @@ class Valgrind(): else: proc += ["--xml=yes"] - suppressions = os.path.join(self._data_dir, "suppressions.txt") - if os.path.exists(suppressions): - proc += ["--suppressions=%s" % suppressions] - else: + suppression_count = 0 + for suppression_file in self._suppressions: + if os.path.exists(suppression_file): + suppression_count += 1 + proc += ["--suppressions=%s" % suppression_file] + + if not suppression_count: logging.warning("WARNING: NOT USING SUPPRESSIONS!") proc += ["--log-file=" + self.TMP_DIR + "/valgrind.%p"] + self._args |