| 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 buildbot. | 5 """Top-level presubmit script for buildbot. |
| 6 | 6 |
| 7 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts for | 7 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts for |
| 8 details on the presubmit API built into gcl. | 8 details on the presubmit API built into gcl. |
| 9 """ | 9 """ |
| 10 | 10 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 join('third_party', 'mock-0.7.2'), | 33 join('third_party', 'mock-0.7.2'), |
| 34 join('third_party', 'sqlalchemy_0_7_1'), | 34 join('third_party', 'sqlalchemy_0_7_1'), |
| 35 join('third_party', 'sqlalchemy_migrate_0_7_1'), | 35 join('third_party', 'sqlalchemy_migrate_0_7_1'), |
| 36 join('third_party', 'tempita_0_5'), | 36 join('third_party', 'tempita_0_5'), |
| 37 join('third_party', 'twisted_10_2'), | 37 join('third_party', 'twisted_10_2'), |
| 38 join('scripts'), | 38 join('scripts'), |
| 39 # Initially, a separate run was done for unit tests but now that | 39 # Initially, a separate run was done for unit tests but now that |
| 40 # pylint is fetched in memory with setuptools, it seems it caches | 40 # pylint is fetched in memory with setuptools, it seems it caches |
| 41 # sys.path so modifications to sys.path aren't kept. | 41 # sys.path so modifications to sys.path aren't kept. |
| 42 join('scripts', 'master', 'unittests'), | 42 join('scripts', 'master', 'unittests'), |
| 43 join('scripts', 'slave', 'unittests'), |
| 43 join('site_config'), | 44 join('site_config'), |
| 44 join('test'), | 45 join('test'), |
| 45 ] + sys.path | 46 ] + sys.path |
| 46 | 47 |
| 47 output.extend(input_api.canned_checks.RunPylint( | 48 output.extend(input_api.canned_checks.RunPylint( |
| 48 input_api, | 49 input_api, |
| 49 output_api, | 50 output_api, |
| 50 black_list=black_list)) | 51 black_list=black_list)) |
| 51 finally: | 52 finally: |
| 52 sys.path = sys_path_backup | 53 sys.path = sys_path_backup |
| 53 | 54 |
| 54 if input_api.is_committing: | 55 if input_api.is_committing: |
| 55 output.extend(input_api.canned_checks.PanProjectChecks( | 56 output.extend(input_api.canned_checks.PanProjectChecks( |
| 56 input_api, output_api, excluded_paths=black_list)) | 57 input_api, output_api, excluded_paths=black_list)) |
| 57 return output | 58 return output |
| 58 | 59 |
| 59 | 60 |
| 60 def RunTests(input_api, output_api): | 61 def RunTests(input_api, output_api): |
| 61 out = [] | 62 out = [] |
| 62 whitelist = [r'.+_test\.py$'] | 63 whitelist = [r'.+_test\.py$'] |
| 63 out.extend(input_api.canned_checks.RunUnitTestsInDirectory( | 64 out.extend(input_api.canned_checks.RunUnitTestsInDirectory( |
| 64 input_api, output_api, 'test', whitelist)) | 65 input_api, output_api, 'test', whitelist)) |
| 65 out.extend(input_api.canned_checks.RunUnitTestsInDirectory( | 66 out.extend(input_api.canned_checks.RunUnitTestsInDirectory( |
| 66 input_api, | 67 input_api, |
| 67 output_api, | 68 output_api, |
| 68 input_api.os_path.join('scripts', 'master', 'unittests'), | 69 input_api.os_path.join('scripts', 'master', 'unittests'), |
| 69 whitelist)) | 70 whitelist)) |
| 71 out.extend(input_api.canned_checks.RunUnitTestsInDirectory( |
| 72 input_api, |
| 73 output_api, |
| 74 input_api.os_path.join('scripts', 'slave', 'unittests'), |
| 75 whitelist)) |
| 70 internal_path = input_api.os_path.join('..', 'build_internal', 'test') | 76 internal_path = input_api.os_path.join('..', 'build_internal', 'test') |
| 71 if input_api.os_path.isfile(internal_path): | 77 if input_api.os_path.isfile(internal_path): |
| 72 out.extend(input_api.canned_checks.RunUnitTestsInDirectory( | 78 out.extend(input_api.canned_checks.RunUnitTestsInDirectory( |
| 73 input_api, output_api, internal_path, whitelist)) | 79 input_api, output_api, internal_path, whitelist)) |
| 74 return out | 80 return out |
| 75 | 81 |
| 76 | 82 |
| 77 def CheckChangeOnUpload(input_api, output_api): | 83 def CheckChangeOnUpload(input_api, output_api): |
| 78 return CommonChecks(input_api, output_api) | 84 return CommonChecks(input_api, output_api) |
| 79 | 85 |
| 80 | 86 |
| 81 def CheckChangeOnCommit(input_api, output_api): | 87 def CheckChangeOnCommit(input_api, output_api): |
| 82 output = [] | 88 output = [] |
| 83 output.extend(CommonChecks(input_api, output_api)) | 89 output.extend(CommonChecks(input_api, output_api)) |
| 84 output.extend(RunTests(input_api, output_api)) | 90 output.extend(RunTests(input_api, output_api)) |
| 85 return output | 91 return output |
| OLD | NEW |