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

Unified Diff: cc/PRESUBMIT.py

Issue 11192030: cc: Switch to Chromium DCHECKs LOGs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebaseonenne Created 8 years, 2 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 | « cc/DEPS ('k') | cc/animation_curve.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/PRESUBMIT.py
diff --git a/cc/PRESUBMIT.py b/cc/PRESUBMIT.py
index 060890112f93e9b8b250dbfb5ef3005104b15501..2f2c0f5e28132f3b5131ad61ae467d899817242f 100644
--- a/cc/PRESUBMIT.py
+++ b/cc/PRESUBMIT.py
@@ -8,6 +8,41 @@ See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts for
details on the presubmit API built into gcl.
"""
+import re
+
+CC_SOURCE_FILES=(r'^cc/.*\.(cc|h)$',)
+
+def CheckAsserts(input_api, output_api, white_list=CC_SOURCE_FILES, black_list=None):
+ black_list = tuple(black_list or input_api.DEFAULT_BLACK_LIST)
+ source_file_filter = lambda x: input_api.FilterSourceFile(x, white_list, black_list)
+
+ assert_files = []
+ notreached_files = []
+
+ for f in input_api.AffectedSourceFiles(source_file_filter):
+ contents = input_api.ReadFile(f, 'rb')
+ # WebKit ASSERT() is not allowed.
+ if re.search(r"ASSERT\(", contents):
+ assert_files.append(f.LocalPath())
+ # WebKit ASSERT_NOT_REACHED() is not allowed.
+ if re.search(r"ASSERT_NOT_REACHED\(", contents):
+ notreached_files.append(f.LocalPath())
+
+ if assert_files:
+ return [output_api.PresubmitError(
+ 'These files use ASSERT instead of using DCHECK:',
+ items=assert_files)]
+ if notreached_files:
+ return [output_api.PresubmitError(
+ 'These files use ASSERT_NOT_REACHED instead of using NOTREACHED:',
+ items=notreached_files)]
+ return []
+
+def CheckChangeOnUpload(input_api, output_api):
+ results = []
+ results += CheckAsserts(input_api, output_api)
+ return results
+
def GetPreferredTrySlaves(project, change):
return [
'linux_layout_rel',
« no previous file with comments | « cc/DEPS ('k') | cc/animation_curve.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698