Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(164)

Unified Diff: tools/valgrind/memcheck/PRESUBMIT.py

Issue 3343020: Add a presubmit check to look for duplicate Valgrind/Heapchecker suppression name... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/heapcheck/PRESUBMIT.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/valgrind/memcheck/PRESUBMIT.py
===================================================================
--- tools/valgrind/memcheck/PRESUBMIT.py (revision 59155)
+++ tools/valgrind/memcheck/PRESUBMIT.py (working copy)
@@ -9,7 +9,12 @@
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 @@
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 == '...'):
« no previous file with comments | « tools/heapcheck/PRESUBMIT.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698