| 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 swarm_client. | 5 """Top-level presubmit script for swarm_client. |
| 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 |
| 11 def CommonChecks(input_api, output_api): | 11 def CommonChecks(input_api, output_api): |
| 12 import sys | 12 import sys |
| 13 def join(*args): | 13 def join(*args): |
| 14 return input_api.os_path.join(input_api.PresubmitLocalPath(), *args) | 14 return input_api.os_path.join(input_api.PresubmitLocalPath(), *args) |
| 15 | 15 |
| 16 output = [] | 16 output = [] |
| 17 sys_path_backup = sys.path | 17 sys_path_backup = sys.path |
| 18 try: | 18 try: |
| 19 sys.path = [ | 19 sys.path = [ |
| 20 input_api.PresubmitLocalPath(), |
| 21 join('googletest'), |
| 20 join('tests', 'gtest_fake'), | 22 join('tests', 'gtest_fake'), |
| 21 ] + sys.path | 23 ] + sys.path |
| 22 output.extend(input_api.canned_checks.RunPylint(input_api, output_api)) | 24 output.extend(input_api.canned_checks.RunPylint(input_api, output_api)) |
| 23 finally: | 25 finally: |
| 24 sys.path = sys_path_backup | 26 sys.path = sys_path_backup |
| 25 | 27 |
| 26 integation_tests = [] | 28 integation_tests = [] |
| 27 if not input_api.is_committing: | 29 if not input_api.is_committing: |
| 28 # These tests are touching the live infrastructure. It's a pain if your IP | 30 # These tests are touching the live infrastructure. It's a pain if your IP |
| 29 # is not whitelisted so only run these on commit. | 31 # is not whitelisted so only run these on commit. |
| 30 integation_tests = [ | 32 integation_tests = [ |
| 31 r'.*isolateserver_archive_smoke_test\.py$', | 33 r'.*isolateserver_archive_smoke_test\.py$', |
| 32 r'.*swarm_get_results_smoke_test\.py$', | 34 r'.*swarm_get_results_smoke_test\.py$', |
| 33 ] | 35 ] |
| 34 | 36 |
| 35 output.extend( | 37 output.extend( |
| 36 input_api.canned_checks.RunUnitTestsInDirectory( | 38 input_api.canned_checks.RunUnitTestsInDirectory( |
| 37 input_api, output_api, | 39 input_api, output_api, |
| 38 input_api.os_path.join(input_api.PresubmitLocalPath(), 'tests'), | 40 input_api.os_path.join(input_api.PresubmitLocalPath(), 'tests'), |
| 39 whitelist=[r'.+_test\.py$'], | 41 whitelist=[r'.+_test\.py$'], |
| 40 blacklist=integation_tests)) | 42 blacklist=integation_tests)) |
| 43 output.extend( |
| 44 input_api.canned_checks.RunUnitTestsInDirectory( |
| 45 input_api, output_api, |
| 46 input_api.os_path.join( |
| 47 input_api.PresubmitLocalPath(), 'googletest', 'tests'), |
| 48 whitelist=[r'.+_test\.py$'])) |
| 41 | 49 |
| 42 if input_api.is_committing: | 50 if input_api.is_committing: |
| 43 output.extend(input_api.canned_checks.PanProjectChecks(input_api, | 51 output.extend(input_api.canned_checks.PanProjectChecks(input_api, |
| 44 output_api, | 52 output_api, |
| 45 owners_check=False)) | 53 owners_check=False)) |
| 46 return output | 54 return output |
| 47 | 55 |
| 48 | 56 |
| 49 def CheckChangeOnUpload(input_api, output_api): | 57 def CheckChangeOnUpload(input_api, output_api): |
| 50 return CommonChecks(input_api, output_api) | 58 return CommonChecks(input_api, output_api) |
| 51 | 59 |
| 52 | 60 |
| 53 def CheckChangeOnCommit(input_api, output_api): | 61 def CheckChangeOnCommit(input_api, output_api): |
| 54 return CommonChecks(input_api, output_api) | 62 return CommonChecks(input_api, output_api) |
| OLD | NEW |