OLD | NEW |
1 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2011 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 depot tools. | 5 """Top-level presubmit script for depot tools. |
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 depot_tools. | 8 details on the presubmit API built into depot_tools. |
9 """ | 9 """ |
10 | 10 |
(...skipping 11 matching lines...) Expand all Loading... |
22 'Otherwise, you break depot_tools on python 2.5, you get to keep the ' | 22 'Otherwise, you break depot_tools on python 2.5, you get to keep the ' |
23 'pieces.')) | 23 'pieces.')) |
24 | 24 |
25 | 25 |
26 results.extend(input_api.canned_checks.CheckOwners(input_api, output_api)) | 26 results.extend(input_api.canned_checks.CheckOwners(input_api, output_api)) |
27 black_list = list(input_api.DEFAULT_BLACK_LIST) + [ | 27 black_list = list(input_api.DEFAULT_BLACK_LIST) + [ |
28 r'^cpplint\.py$', | 28 r'^cpplint\.py$', |
29 r'^cpplint_chromium\.py$', | 29 r'^cpplint_chromium\.py$', |
30 r'^python_bin[\/\\].+', | 30 r'^python_bin[\/\\].+', |
31 r'^svn_bin[\/\\].+', | 31 r'^svn_bin[\/\\].+', |
32 r'^tests[\/\\]\w+?[\/\\].+'] | 32 r'^testing_support[\/\\]_rietveld[\/\\].+'] |
33 results.extend(input_api.canned_checks.RunPylint( | 33 results.extend(input_api.canned_checks.RunPylint( |
34 input_api, | 34 input_api, |
35 output_api, | 35 output_api, |
36 white_list=[r'.*\.py$'], | 36 white_list=[r'.*\.py$'], |
37 black_list=black_list)) | 37 black_list=black_list)) |
38 | 38 |
39 # TODO(maruel): Make sure at least one file is modified first. | 39 # TODO(maruel): Make sure at least one file is modified first. |
40 # TODO(maruel): If only tests are modified, only run them. | 40 # TODO(maruel): If only tests are modified, only run them. |
41 results.extend(input_api.canned_checks.RunUnitTestsInDirectory( | 41 results.extend(input_api.canned_checks.RunUnitTestsInDirectory( |
42 input_api, | 42 input_api, |
43 output_api, | 43 output_api, |
44 'tests', | 44 'tests', |
45 whitelist=[r'.*test\.py$'], | 45 whitelist=[r'.*test\.py$'], |
46 blacklist=tests_to_black_list)) | 46 blacklist=tests_to_black_list)) |
47 return results | 47 return results |
48 | 48 |
49 | 49 |
50 def RunGitClTests(input_api, output_api): | 50 def RunGitClTests(input_api, output_api): |
51 """Run all the shells scripts in the directory test. | 51 """Run all the shells scripts in the directory test. |
52 """ | 52 """ |
53 if input_api.platform == 'win32': | 53 if input_api.platform == 'win32': |
54 # Skip for now as long as the test scripts are bash scripts. | 54 # Skip for now as long as the test scripts are bash scripts. |
55 return [] | 55 return [] |
56 | 56 |
57 # First loads a local Rietveld instance. | 57 # First loads a local Rietveld instance. |
58 import sys | 58 import sys |
59 old_sys_path = sys.path | 59 old_sys_path = sys.path |
60 try: | 60 try: |
61 sys.path = [input_api.PresubmitLocalPath()] + sys.path | 61 sys.path = [input_api.PresubmitLocalPath()] + sys.path |
62 from tests import local_rietveld # pylint: disable=W0403 | 62 from testing_support import local_rietveld |
63 server = local_rietveld.LocalRietveld() | 63 server = local_rietveld.LocalRietveld() |
64 finally: | 64 finally: |
65 sys.path = old_sys_path | 65 sys.path = old_sys_path |
66 | 66 |
67 results = [] | 67 results = [] |
68 try: | 68 try: |
69 # Start a local rietveld instance to test against. | 69 # Start a local rietveld instance to test against. |
70 server.start_server() | 70 server.start_server() |
71 test_path = input_api.os_path.abspath( | 71 test_path = input_api.os_path.abspath( |
72 input_api.os_path.join(input_api.PresubmitLocalPath(), 'tests')) | 72 input_api.os_path.join(input_api.PresubmitLocalPath(), 'tests')) |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 | 107 |
108 | 108 |
109 def CheckChangeOnCommit(input_api, output_api): | 109 def CheckChangeOnCommit(input_api, output_api): |
110 output = [] | 110 output = [] |
111 output.extend(CommonChecks(input_api, output_api, [])) | 111 output.extend(CommonChecks(input_api, output_api, [])) |
112 output.extend(input_api.canned_checks.CheckDoNotSubmit( | 112 output.extend(input_api.canned_checks.CheckDoNotSubmit( |
113 input_api, | 113 input_api, |
114 output_api)) | 114 output_api)) |
115 output.extend(RunGitClTests(input_api, output_api)) | 115 output.extend(RunGitClTests(input_api, output_api)) |
116 return output | 116 return output |
OLD | NEW |