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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 if test in DISABLED_TESTS or not test.endswith('.sh'): | 78 if test in DISABLED_TESTS or not test.endswith('.sh'): |
79 continue | 79 continue |
80 | 80 |
81 print('Running %s' % test) | 81 print('Running %s' % test) |
82 try: | 82 try: |
83 if input_api.verbose: | 83 if input_api.verbose: |
84 input_api.subprocess.check_call( | 84 input_api.subprocess.check_call( |
85 [input_api.os_path.join(test_path, test)], cwd=test_path) | 85 [input_api.os_path.join(test_path, test)], cwd=test_path) |
86 else: | 86 else: |
87 input_api.subprocess.check_output( | 87 input_api.subprocess.check_output( |
88 [input_api.os_path.join(test_path, test)], cwd=test_path) | 88 [input_api.os_path.join(test_path, test)], cwd=test_path, |
| 89 stderr=input_api.subprocess.STDOUT) |
89 except (OSError, input_api.subprocess.CalledProcessError), e: | 90 except (OSError, input_api.subprocess.CalledProcessError), e: |
90 results.append(output_api.PresubmitError('%s failed\n%s' % (test, e))) | 91 results.append(output_api.PresubmitError('%s failed\n%s' % (test, e))) |
91 except local_rietveld.Failure, e: | 92 except local_rietveld.Failure, e: |
92 results.append(output_api.PresubmitError('\n'.join(str(i) for i in e.args))) | 93 results.append(output_api.PresubmitError('\n'.join(str(i) for i in e.args))) |
93 finally: | 94 finally: |
94 server.stop_server() | 95 server.stop_server() |
95 return results | 96 return results |
96 | 97 |
97 | 98 |
98 def CheckChangeOnUpload(input_api, output_api): | 99 def CheckChangeOnUpload(input_api, output_api): |
99 # Do not run integration tests on upload since they are way too slow. | 100 # Do not run integration tests on upload since they are way too slow. |
100 tests_to_black_list = [ | 101 tests_to_black_list = [ |
101 r'^checkout_test\.py$', | 102 r'^checkout_test\.py$', |
102 r'^gclient_smoketest\.py$', | 103 r'^gclient_smoketest\.py$', |
103 r'^scm_unittest\.py$', | 104 r'^scm_unittest\.py$', |
104 ] | 105 ] |
105 return CommonChecks(input_api, output_api, tests_to_black_list) | 106 return CommonChecks(input_api, output_api, tests_to_black_list) |
106 | 107 |
107 | 108 |
108 def CheckChangeOnCommit(input_api, output_api): | 109 def CheckChangeOnCommit(input_api, output_api): |
109 output = [] | 110 output = [] |
110 output.extend(CommonChecks(input_api, output_api, [])) | 111 output.extend(CommonChecks(input_api, output_api, [])) |
111 output.extend(input_api.canned_checks.CheckDoNotSubmit( | 112 output.extend(input_api.canned_checks.CheckDoNotSubmit( |
112 input_api, | 113 input_api, |
113 output_api)) | 114 output_api)) |
114 output.extend(RunGitClTests(input_api, output_api)) | 115 output.extend(RunGitClTests(input_api, output_api)) |
115 return output | 116 return output |
OLD | NEW |