OLD | NEW |
1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2013 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 Blink. | 5 """Top-level presubmit script for Blink. |
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 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 args += ['--file', f.LocalPath()] | 301 args += ['--file', f.LocalPath()] |
302 checkperms = input_api.subprocess.Popen( | 302 checkperms = input_api.subprocess.Popen( |
303 args, stdout=input_api.subprocess.PIPE) | 303 args, stdout=input_api.subprocess.PIPE) |
304 errors = checkperms.communicate()[0].strip() | 304 errors = checkperms.communicate()[0].strip() |
305 if errors: | 305 if errors: |
306 return [output_api.PresubmitError( | 306 return [output_api.PresubmitError( |
307 'checkperms.py failed.', errors.splitlines())] | 307 'checkperms.py failed.', errors.splitlines())] |
308 return [] | 308 return [] |
309 | 309 |
310 | 310 |
| 311 def _CheckForInvalidPreferenceError(input_api, output_api): |
| 312 pattern = input_api.re.compile('Invalid name for preference: (.+)') |
| 313 results = [] |
| 314 |
| 315 for f in input_api.AffectedFiles(): |
| 316 if not f.LocalPath().endswith('-expected.txt'): |
| 317 continue |
| 318 for line_num, line in f.ChangedContents(): |
| 319 error = pattern.search(line) |
| 320 if error: |
| 321 results.append(output_api.PresubmitError('Found an invalid prefe
rence %s in expected result %s:%s' % (error.group(1), f, line_num))) |
| 322 return results |
| 323 |
311 def CheckChangeOnUpload(input_api, output_api): | 324 def CheckChangeOnUpload(input_api, output_api): |
312 results = [] | 325 results = [] |
313 results.extend(_CommonChecks(input_api, output_api)) | 326 results.extend(_CommonChecks(input_api, output_api)) |
314 results.extend(_CheckStyle(input_api, output_api)) | 327 results.extend(_CheckStyle(input_api, output_api)) |
315 results.extend(_CheckForPrintfDebugging(input_api, output_api)) | 328 results.extend(_CheckForPrintfDebugging(input_api, output_api)) |
316 results.extend(_CheckForDangerousTestFunctions(input_api, output_api)) | 329 results.extend(_CheckForDangerousTestFunctions(input_api, output_api)) |
| 330 results.extend(_CheckForInvalidPreferenceError(input_api, output_api)) |
317 return results | 331 return results |
318 | 332 |
319 | 333 |
320 def CheckChangeOnCommit(input_api, output_api): | 334 def CheckChangeOnCommit(input_api, output_api): |
321 results = [] | 335 results = [] |
322 results.extend(_CommonChecks(input_api, output_api)) | 336 results.extend(_CommonChecks(input_api, output_api)) |
323 results.extend(input_api.canned_checks.CheckTreeIsOpen( | 337 results.extend(input_api.canned_checks.CheckTreeIsOpen( |
324 input_api, output_api, | 338 input_api, output_api, |
325 json_url='http://blink-status.appspot.com/current?format=json')) | 339 json_url='http://blink-status.appspot.com/current?format=json')) |
326 results.extend(input_api.canned_checks.CheckChangeHasDescription( | 340 results.extend(input_api.canned_checks.CheckChangeHasDescription( |
(...skipping 15 matching lines...) Expand all Loading... |
342 'mac_blink_rel': set(['defaulttests']), | 356 'mac_blink_rel': set(['defaulttests']), |
343 'win_blink_compile_dbg': set(['defaulttests']), | 357 'win_blink_compile_dbg': set(['defaulttests']), |
344 'win_blink_rel': set(['defaulttests']), | 358 'win_blink_rel': set(['defaulttests']), |
345 }, | 359 }, |
346 'tryserver.chromium.gpu': { | 360 'tryserver.chromium.gpu': { |
347 'linux_gpu': set(['defaulttests']), | 361 'linux_gpu': set(['defaulttests']), |
348 'mac_gpu': set(['defaulttests']), | 362 'mac_gpu': set(['defaulttests']), |
349 'win_gpu': set(['defaulttests']), | 363 'win_gpu': set(['defaulttests']), |
350 } | 364 } |
351 } | 365 } |
OLD | NEW |