| OLD | NEW |
| 1 # Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2010 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 """Generic presubmit checks that can be reused by other presubmit checks.""" | 5 """Generic presubmit checks that can be reused by other presubmit checks.""" |
| 6 | 6 |
| 7 | 7 |
| 8 ### Description checks | 8 ### Description checks |
| 9 | 9 |
| 10 def CheckChangeHasTestField(input_api, output_api): | 10 def CheckChangeHasTestField(input_api, output_api): |
| (...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 449 | 449 |
| 450 results = [] | 450 results = [] |
| 451 for unit_test in unit_tests: | 451 for unit_test in unit_tests: |
| 452 cmd = [] | 452 cmd = [] |
| 453 if input_api.platform == 'win32' and unit_test.endswith('.py'): | 453 if input_api.platform == 'win32' and unit_test.endswith('.py'): |
| 454 # Windows needs some help. | 454 # Windows needs some help. |
| 455 cmd = [input_api.python_executable] | 455 cmd = [input_api.python_executable] |
| 456 cmd.append(unit_test) | 456 cmd.append(unit_test) |
| 457 if input_api.verbose: | 457 if input_api.verbose: |
| 458 print('Running %s' % unit_test) | 458 print('Running %s' % unit_test) |
| 459 cmd.append('--verbose') |
| 459 try: | 460 try: |
| 460 if input_api.verbose: | 461 if input_api.verbose: |
| 461 input_api.subprocess.check_call(cmd, cwd=input_api.PresubmitLocalPath()) | 462 input_api.subprocess.check_call(cmd, cwd=input_api.PresubmitLocalPath()) |
| 462 else: | 463 else: |
| 463 input_api.subprocess.check_output( | 464 input_api.subprocess.check_output( |
| 464 cmd, cwd=input_api.PresubmitLocalPath()) | 465 cmd, cwd=input_api.PresubmitLocalPath()) |
| 465 except (OSError, input_api.subprocess.CalledProcessError), e: | 466 except (OSError, input_api.subprocess.CalledProcessError), e: |
| 466 results.append(message_type('%s failed!\n%s' % (unit_test, e))) | 467 results.append(message_type('%s failed!\n%s' % (unit_test, e))) |
| 467 return results | 468 return results |
| 468 | 469 |
| (...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 893 input_api, output_api, source_file_filter=text_files)) | 894 input_api, output_api, source_file_filter=text_files)) |
| 894 results.extend(input_api.canned_checks.CheckSvnForCommonMimeTypes( | 895 results.extend(input_api.canned_checks.CheckSvnForCommonMimeTypes( |
| 895 input_api, output_api)) | 896 input_api, output_api)) |
| 896 results.extend(input_api.canned_checks.CheckLicense( | 897 results.extend(input_api.canned_checks.CheckLicense( |
| 897 input_api, output_api, license_header, source_file_filter=sources)) | 898 input_api, output_api, license_header, source_file_filter=sources)) |
| 898 results.extend(_CheckConstNSObject( | 899 results.extend(_CheckConstNSObject( |
| 899 input_api, output_api, source_file_filter=sources)) | 900 input_api, output_api, source_file_filter=sources)) |
| 900 results.extend(_CheckSingletonInHeaders( | 901 results.extend(_CheckSingletonInHeaders( |
| 901 input_api, output_api, source_file_filter=sources)) | 902 input_api, output_api, source_file_filter=sources)) |
| 902 return results | 903 return results |
| OLD | NEW |