OLD | NEW |
| (Empty) |
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 | |
3 # found in the LICENSE file. | |
4 | |
5 """Top-level presubmit script for swarm_client. | |
6 | |
7 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts for | |
8 details on the presubmit API built into gcl. | |
9 """ | |
10 | |
11 def CommonChecks(input_api, output_api): | |
12 import sys | |
13 def join(*args): | |
14 return input_api.os_path.join(input_api.PresubmitLocalPath(), *args) | |
15 | |
16 output = [] | |
17 sys_path_backup = sys.path | |
18 try: | |
19 sys.path = [ | |
20 input_api.PresubmitLocalPath(), | |
21 join('googletest'), | |
22 join('tests', 'gtest_fake'), | |
23 ] + sys.path | |
24 output.extend(input_api.canned_checks.RunPylint(input_api, output_api)) | |
25 finally: | |
26 sys.path = sys_path_backup | |
27 | |
28 # These tests are touching the live infrastructure. It's a pain if your IP | |
29 # is not whitelisted so do not run them for now. They should use a local fake | |
30 # web service instead. | |
31 blacklist = [ | |
32 r'.*isolateserver_smoke_test\.py$', | |
33 r'.*swarming_smoke_test\.py$', | |
34 ] | |
35 blacklist_googletest = [] | |
36 if not input_api.is_committing: | |
37 # Remove all slow tests, e.g. the ones that take >1s to complete. | |
38 blacklist.extend([ | |
39 r'.*isolate_smoke_test\.py$', | |
40 r'.*trace_inputs_smoke_test\.py$', | |
41 r'.*url_open_timeout_test\.py$', | |
42 ]) | |
43 blacklist_googletest.extend([ | |
44 r'.*fix_test_cases_smoke_test\.py$', | |
45 r'.*isolate_test_cases_smoke_test\.py$', | |
46 r'.*run_test_cases_smoke_test\.py$', | |
47 r'.*run_test_cases_test\.py$', | |
48 ]) | |
49 | |
50 output.extend( | |
51 input_api.canned_checks.RunUnitTestsInDirectory( | |
52 input_api, output_api, | |
53 input_api.os_path.join(input_api.PresubmitLocalPath(), 'tests'), | |
54 whitelist=[r'.+_test\.py$'], | |
55 blacklist=blacklist)) | |
56 output.extend( | |
57 input_api.canned_checks.RunUnitTestsInDirectory( | |
58 input_api, output_api, | |
59 input_api.os_path.join( | |
60 input_api.PresubmitLocalPath(), 'googletest', 'tests'), | |
61 whitelist=[r'.+_test\.py$'], | |
62 blacklist=blacklist_googletest)) | |
63 | |
64 if input_api.is_committing: | |
65 output.extend(input_api.canned_checks.PanProjectChecks(input_api, | |
66 output_api, | |
67 owners_check=False)) | |
68 return output | |
69 | |
70 | |
71 def CheckChangeOnUpload(input_api, output_api): | |
72 return CommonChecks(input_api, output_api) | |
73 | |
74 | |
75 def CheckChangeOnCommit(input_api, output_api): | |
76 return CommonChecks(input_api, output_api) | |
OLD | NEW |