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

Side by Side Diff: tools/heapcheck/PRESUBMIT.py

Issue 113193008: Remove heapcheck support. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « build/common.gypi ('k') | tools/heapcheck/base_unittests.gtest-heapcheck.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 # Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 """
6 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
7 for more details on the presubmit API built into gcl.
8 """
9
10 import re
11
12 def CheckChange(input_api, output_api):
13 """Checks the heapcheck suppressions files for bad data."""
14 sup_regex = re.compile('suppressions.*\.txt$')
15 suppressions = {}
16 errors = []
17 check_for_heapcheck = False
18 skip_next_line = False
19 for f in filter(lambda x: sup_regex.search(x.LocalPath()),
20 input_api.AffectedFiles()):
21 for line, line_num in zip(f.NewContents(),
22 xrange(1, len(f.NewContents()) + 1)):
23 line = line.lstrip()
24 if line.startswith('#') or not line:
25 continue
26
27 if skip_next_line:
28 if 'insert_a_suppression_name_here' in line:
29 errors.append('"insert_a_suppression_name_here" is not a valid '
30 'suppression name')
31 if suppressions.has_key(line):
32 errors.append('suppression with name "%s" at %s line %s has already '
33 'been defined at line %s' % (line, f.LocalPath(),
34 line_num,
35 suppressions[line][1]))
36 else:
37 suppressions[line] = (f, line_num)
38 check_for_heapcheck = True
39 skip_next_line = False
40 continue
41 if check_for_heapcheck:
42 if not line == 'Heapcheck:Leak':
43 errors.append('"%s" should be "Heapcheck:Leak" in %s line %s' %
44 (line, f.LocalPath(), line_num))
45 check_for_heapcheck = False;
46 if line == '{':
47 skip_next_line = True
48 continue
49 if (line.startswith('fun:') or line.startswith('obj:') or
50 line == 'Heapcheck:Leak' or line == '}' or
51 line == '...'):
52 continue
53 errors.append('"%s" is probably wrong: %s line %s' % (line, f.LocalPath(),
54 line_num))
55 if errors:
56 return [output_api.PresubmitError('\n'.join(errors))]
57 return []
58
59 def CheckChangeOnUpload(input_api, output_api):
60 return CheckChange(input_api, output_api)
61
62 def CheckChangeOnCommit(input_api, output_api):
63 return CheckChange(input_api, output_api)
OLDNEW
« no previous file with comments | « build/common.gypi ('k') | tools/heapcheck/base_unittests.gtest-heapcheck.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698