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

Side by Side Diff: PRESUBMIT.py

Issue 6758001: Move git_cl back into depot_tools. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 9 years, 9 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 | README.codereview » ('j') | git_cl.py » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2010 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 gcl. 8 details on the presubmit API built into depot_tools.
9 """ 9 """
10 10
11 UNIT_TESTS = [ 11 UNIT_TESTS = [
12 'tests.fix_encoding_test', 12 'tests.fix_encoding_test',
13 'tests.gcl_unittest', 13 'tests.gcl_unittest',
14 'tests.gclient_scm_test', 14 'tests.gclient_scm_test',
15 'tests.gclient_smoketest', 15 'tests.gclient_smoketest',
16 'tests.gclient_utils_test', 16 'tests.gclient_utils_test',
17 'tests.owners_unittest', 17 'tests.owners_unittest',
18 'tests.presubmit_unittest', 18 'tests.presubmit_unittest',
(...skipping 25 matching lines...) Expand all
44 black_list = list(input_api.DEFAULT_BLACK_LIST) + [ 44 black_list = list(input_api.DEFAULT_BLACK_LIST) + [
45 r'^cpplint\.py$', 45 r'^cpplint\.py$',
46 r'^git_cl[\/\\]test[\/\\](local_)?rietveld.*', 46 r'^git_cl[\/\\]test[\/\\](local_)?rietveld.*',
47 r'^git_cl[\/\\]upload.*', 47 r'^git_cl[\/\\]upload.*',
48 ] 48 ]
49 output.extend(input_api.canned_checks.RunPylint( 49 output.extend(input_api.canned_checks.RunPylint(
50 input_api, 50 input_api,
51 output_api, 51 output_api,
52 white_list=white_list, 52 white_list=white_list,
53 black_list=black_list)) 53 black_list=black_list))
54 output.extend(RunGitClTests(input_api, output_api))
54 return output 55 return output
55 56
56 57
58 def RunGitClTests(input_api, output_api):
59 """Run all the shells scripts in the directory test.
60 """
61 # Not exposed from InputApi.
62 from os import listdir
63
64 # First loads a local Rietveld instance.
65 import sys
66 old_sys_path = sys.path
67 try:
68 sys.path = [input_api.PresubmitLocalPath()] + sys.path
69 from tests import local_rietveld # pylint: disable=W0403
70 server = local_rietveld.LocalRietveld()
71 finally:
72 sys.path = old_sys_path
73
74 # Set to True for testing.
75 verbose = False
76 if verbose:
77 stdout = None
78 stderr = None
79 else:
80 stdout = input_api.subprocess.PIPE
81 stderr = input_api.subprocess.STDOUT
82 output = []
83 try:
84 # Start a local rietveld instance to test against.
85 server.start_server()
86 test_path = input_api.os_path.abspath(
87 input_api.os_path.join(input_api.PresubmitLocalPath(), 'tests'))
88 for test in listdir(test_path):
89 # test-lib.sh is not an actual test so it should not be run. The other
90 # tests are tests known to fail.
91 DISABLED_TESTS = (
92 'owners.sh', 'push-from-logs.sh', 'rename.sh', 'test-lib.sh')
93 if test in DISABLED_TESTS or not test.endswith('.sh'):
94 continue
95
96 print('Running %s' % test)
97 proc = input_api.subprocess.Popen(
98 [input_api.os_path.join(test_path, test)],
99 cwd=test_path,
100 stdout=stdout,
101 stderr=stderr)
102 proc.communicate()
103 if proc.returncode != 0:
104 output.append(output_api.PresubmitError('%s failed' % test))
105 except local_rietveld.Failure, e:
106 output.append(output_api.PresubmitError('\n'.join(str(i) for i in e.args)))
107 finally:
108 server.stop_server()
109 return output
110
111
57 def CheckChangeOnUpload(input_api, output_api): 112 def CheckChangeOnUpload(input_api, output_api):
58 return CommonChecks(input_api, output_api) 113 return CommonChecks(input_api, output_api)
59 114
60 115
61 def CheckChangeOnCommit(input_api, output_api): 116 def CheckChangeOnCommit(input_api, output_api):
62 output = [] 117 output = []
63 output.extend(CommonChecks(input_api, output_api)) 118 output.extend(CommonChecks(input_api, output_api))
64 output.extend(input_api.canned_checks.CheckDoNotSubmit( 119 output.extend(input_api.canned_checks.CheckDoNotSubmit(
65 input_api, 120 input_api,
66 output_api)) 121 output_api))
67 return output 122 return output
OLDNEW
« no previous file with comments | « no previous file | README.codereview » ('j') | git_cl.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698