OLD | NEW |
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 """Top-level presubmit script for Chromium. | 5 """Top-level presubmit script for Chromium. |
6 | 6 |
7 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts | 7 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts |
8 for more details about the presubmit API built into gcl. | 8 for more details about the presubmit API built into gcl. |
9 """ | 9 """ |
10 | 10 |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 | 289 |
290 | 290 |
291 def _CheckNoUNIT_TESTInSourceFiles(input_api, output_api): | 291 def _CheckNoUNIT_TESTInSourceFiles(input_api, output_api): |
292 """Checks to make sure no source files use UNIT_TEST""" | 292 """Checks to make sure no source files use UNIT_TEST""" |
293 problems = [] | 293 problems = [] |
294 for f in input_api.AffectedFiles(): | 294 for f in input_api.AffectedFiles(): |
295 if (not f.LocalPath().endswith(('.cc', '.mm'))): | 295 if (not f.LocalPath().endswith(('.cc', '.mm'))): |
296 continue | 296 continue |
297 | 297 |
298 for line_num, line in f.ChangedContents(): | 298 for line_num, line in f.ChangedContents(): |
299 if 'UNIT_TEST' in line: | 299 if 'UNIT_TEST ' in line or line.endswith('UNIT_TEST'): |
300 problems.append(' %s:%d' % (f.LocalPath(), line_num)) | 300 problems.append(' %s:%d' % (f.LocalPath(), line_num)) |
301 | 301 |
302 if not problems: | 302 if not problems: |
303 return [] | 303 return [] |
304 return [output_api.PresubmitPromptWarning('UNIT_TEST is only for headers.\n' + | 304 return [output_api.PresubmitPromptWarning('UNIT_TEST is only for headers.\n' + |
305 '\n'.join(problems))] | 305 '\n'.join(problems))] |
306 | 306 |
307 | 307 |
308 def _CheckNoNewWStrings(input_api, output_api): | 308 def _CheckNoNewWStrings(input_api, output_api): |
309 """Checks to make sure we don't introduce use of wstrings.""" | 309 """Checks to make sure we don't introduce use of wstrings.""" |
(...skipping 767 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1077 trybots += ['cros_x86'] | 1077 trybots += ['cros_x86'] |
1078 | 1078 |
1079 # The AOSP bot doesn't build the chrome/ layer, so ignore any changes to it | 1079 # The AOSP bot doesn't build the chrome/ layer, so ignore any changes to it |
1080 # unless they're .gyp(i) files as changes to those files can break the gyp | 1080 # unless they're .gyp(i) files as changes to those files can break the gyp |
1081 # step on that bot. | 1081 # step on that bot. |
1082 if (not all(re.search('^chrome', f) for f in files) or | 1082 if (not all(re.search('^chrome', f) for f in files) or |
1083 any(re.search('\.gypi?$', f) for f in files)): | 1083 any(re.search('\.gypi?$', f) for f in files)): |
1084 trybots += ['android_aosp'] | 1084 trybots += ['android_aosp'] |
1085 | 1085 |
1086 return trybots | 1086 return trybots |
OLD | NEW |