summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorthestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-14 18:47:54 +0000
committerthestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-14 18:47:54 +0000
commitccb5c4021fccb00d87e6b3c79b6c3df3cb485a00 (patch)
tree153fad1e7bd97e486c735830859e0a37f8611ca3 /tools
parent3ce597fc42a1cb4914f9e5396708167987e669d7 (diff)
downloadchromium_src-ccb5c4021fccb00d87e6b3c79b6c3df3cb485a00.zip
chromium_src-ccb5c4021fccb00d87e6b3c79b6c3df3cb485a00.tar.gz
chromium_src-ccb5c4021fccb00d87e6b3c79b6c3df3cb485a00.tar.bz2
Add a presubmit check to look for duplicate Valgrind/Heapchecker suppression names.
BUG=none TEST=none Review URL: http://codereview.chromium.org/3343020 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@59405 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools')
-rwxr-xr-xtools/heapcheck/PRESUBMIT.py8
-rwxr-xr-xtools/valgrind/memcheck/PRESUBMIT.py21
2 files changed, 27 insertions, 2 deletions
diff --git a/tools/heapcheck/PRESUBMIT.py b/tools/heapcheck/PRESUBMIT.py
index 415400c..1b47afc 100755
--- a/tools/heapcheck/PRESUBMIT.py
+++ b/tools/heapcheck/PRESUBMIT.py
@@ -9,6 +9,7 @@ for more details on the presubmit API built into gcl.
def CheckChange(input_api, output_api):
"""Checks the memcheck suppressions files for bad data."""
+ suppressions = {}
errors = []
skip_next_line = False
func_re = input_api.re.compile('[a-z_.]+\(.+\)$')
@@ -19,6 +20,13 @@ def CheckChange(input_api, output_api):
continue
if skip_next_line:
+ if suppressions.has_key(line):
+ errors.append('suppression with name "%s" at %s line %s has already '
+ 'been defined at line %s' % (line, f.LocalPath(),
+ line_num,
+ suppressions[line][1]))
+ else:
+ suppressions[line] = (f, line_num)
skip_next_line = False
continue
if line == '{':
diff --git a/tools/valgrind/memcheck/PRESUBMIT.py b/tools/valgrind/memcheck/PRESUBMIT.py
index a31a596..182c800 100755
--- a/tools/valgrind/memcheck/PRESUBMIT.py
+++ b/tools/valgrind/memcheck/PRESUBMIT.py
@@ -9,7 +9,12 @@ for more details on the presubmit API built into gcl.
def CheckChange(input_api, output_api):
"""Checks the memcheck suppressions files for bad data."""
+ suppressions = {}
errors = []
+ # skip_next_line has 3 possible values:
+ # - False: don't skip the next line.
+ # - 'skip_suppression_name': the next line is a suppression name, skip.
+ # - 'skip_param': the next line is a system call parameter error, skip.
skip_next_line = False
func_re = input_api.re.compile('[a-z_.]+\(.+\)$')
for f, line_num, line in input_api.RightHandSideLines(lambda x:
@@ -19,11 +24,23 @@ def CheckChange(input_api, output_api):
continue
if skip_next_line:
+ if skip_next_line == 'skip_suppression_name':
+ if suppressions.has_key(line):
+ errors.append('suppression with name "%s" at %s line %s has already '
+ 'been defined at line %s' % (line, f.LocalPath(),
+ line_num,
+ suppressions[line][1]))
+ else:
+ suppressions[line] = (f, line_num)
skip_next_line = False
continue
- if line == '{' or line == "Memcheck:Param":
- skip_next_line = True
+ if line == '{':
+ skip_next_line = 'skip_suppression_name'
continue
+ if line == "Memcheck:Param":
+ skip_next_line = 'skip_param'
+ continue
+
if (line.startswith('fun:') or line.startswith('obj:') or
line.startswith('Memcheck:') or line == '}' or
line == '...'):