Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(541)

Side by Side Diff: PRESUBMIT.py

Issue 7828024: Do not run integration tests on upload, they are too slow. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: git branch has no -q flag Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | tests/gclient_scm_test.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
11 11
12 def CommonChecks(input_api, output_api): 12 def CommonChecks(input_api, output_api, tests_to_black_list):
13 results = [] 13 results = []
14 import sys 14 import sys
15 if not sys.version.startswith('2.5'): 15 if not sys.version.startswith('2.5'):
16 # Depot_tools has the particularity that it needs to be tested on python 16 # Depot_tools has the particularity that it needs to be tested on python
17 # 2.5. But we don't want the presubmit check to fail if it is not installed. 17 # 2.5. But we don't want the presubmit check to fail if it is not installed.
18 results.append(output_api.PresubmitNotifyResult( 18 results.append(output_api.PresubmitNotifyResult(
19 'You should install python 2.5 and run ln -s $(which python2.5) python.' 19 'You should install python 2.5 and run ln -s $(which python2.5) python.'
20 '\n' 20 '\n'
21 'A great place to put this symlink is in depot_tools.\n' 21 'A great place to put this symlink is in depot_tools.\n'
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 '
(...skipping 11 matching lines...) Expand all
34 output_api, 34 output_api,
35 white_list=[r'.*\.py$'], 35 white_list=[r'.*\.py$'],
36 black_list=black_list)) 36 black_list=black_list))
37 37
38 # TODO(maruel): Make sure at least one file is modified first. 38 # TODO(maruel): Make sure at least one file is modified first.
39 # TODO(maruel): If only tests are modified, only run them. 39 # TODO(maruel): If only tests are modified, only run them.
40 results.extend(input_api.canned_checks.RunUnitTestsInDirectory( 40 results.extend(input_api.canned_checks.RunUnitTestsInDirectory(
41 input_api, 41 input_api,
42 output_api, 42 output_api,
43 'tests', 43 'tests',
44 whitelist=[r'.*test\.py$'])) 44 whitelist=[r'.*tests\.py$'],
45 results.extend(RunGitClTests(input_api, output_api)) 45 blacklist=tests_to_black_list))
46 return results 46 return results
47 47
48 48
49 def RunGitClTests(input_api, output_api): 49 def RunGitClTests(input_api, output_api):
50 """Run all the shells scripts in the directory test. 50 """Run all the shells scripts in the directory test.
51 """ 51 """
52 if input_api.platform == 'win32': 52 if input_api.platform == 'win32':
53 # Skip for now as long as the test scripts are bash scripts. 53 # Skip for now as long as the test scripts are bash scripts.
54 return [] 54 return []
55 55
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 except (OSError, input_api.subprocess.CalledProcessError), e: 88 except (OSError, input_api.subprocess.CalledProcessError), e:
89 results.append(output_api.PresubmitError('%s failed\n%s' % (test, e))) 89 results.append(output_api.PresubmitError('%s failed\n%s' % (test, e)))
90 except local_rietveld.Failure, e: 90 except local_rietveld.Failure, e:
91 results.append(output_api.PresubmitError('\n'.join(str(i) for i in e.args))) 91 results.append(output_api.PresubmitError('\n'.join(str(i) for i in e.args)))
92 finally: 92 finally:
93 server.stop_server() 93 server.stop_server()
94 return results 94 return results
95 95
96 96
97 def CheckChangeOnUpload(input_api, output_api): 97 def CheckChangeOnUpload(input_api, output_api):
98 return CommonChecks(input_api, output_api) 98 # Do not run integration tests on upload since they are way too slow.
99 tests_to_black_list = [
100 r'^checkout_test\.py$',
101 r'^gclient_smoketest\.py$',
102 r'^scm_unittest\.py$',
103 ]
104 return CommonChecks(input_api, output_api, tests_to_black_list)
99 105
100 106
101 def CheckChangeOnCommit(input_api, output_api): 107 def CheckChangeOnCommit(input_api, output_api):
102 output = [] 108 output = []
103 output.extend(CommonChecks(input_api, output_api)) 109 output.extend(CommonChecks(input_api, output_api, []))
104 output.extend(input_api.canned_checks.CheckDoNotSubmit( 110 output.extend(input_api.canned_checks.CheckDoNotSubmit(
105 input_api, 111 input_api,
106 output_api)) 112 output_api))
113 output.extend(RunGitClTests(input_api, output_api))
107 return output 114 return output
OLDNEW
« no previous file with comments | « no previous file | tests/gclient_scm_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698