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

Side by Side Diff: tools/bisect_utils.py

Issue 12780015: Added call to stop goma in case it's still running from a build that timed out. Added --verbose par… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 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
« no previous file with comments | « tools/bisect-perf-regression.py ('k') | tools/prepare-bisect-perf-regression.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) 2013 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2013 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 """Set of operations/utilities related to checking out the depot, and 5 """Set of operations/utilities related to checking out the depot, and
6 outputting annotations on the buildbot waterfall. These are intended to be 6 outputting annotations on the buildbot waterfall. These are intended to be
7 used by the bisection scripts.""" 7 used by the bisection scripts."""
8 8
9 import errno 9 import errno
10 import os 10 import os
(...skipping 20 matching lines...) Expand all
31 GCLIENT_SPEC = ''.join([l for l in GCLIENT_SPEC.splitlines()]) 31 GCLIENT_SPEC = ''.join([l for l in GCLIENT_SPEC.splitlines()])
32 32
33 33
34 def OutputAnnotationStepStart(name): 34 def OutputAnnotationStepStart(name):
35 """Outputs appropriate annotation to signal the start of a step to 35 """Outputs appropriate annotation to signal the start of a step to
36 a trybot. 36 a trybot.
37 37
38 Args: 38 Args:
39 name: The name of the step. 39 name: The name of the step.
40 """ 40 """
41 print
41 print '@@@SEED_STEP %s@@@' % name 42 print '@@@SEED_STEP %s@@@' % name
42 print '@@@STEP_CURSOR %s@@@' % name 43 print '@@@STEP_CURSOR %s@@@' % name
43 print '@@@STEP_STARTED@@@' 44 print '@@@STEP_STARTED@@@'
45 print
44 46
45 47
46 def OutputAnnotationStepClosed(): 48 def OutputAnnotationStepClosed():
47 """Outputs appropriate annotation to signal the closing of a step to 49 """Outputs appropriate annotation to signal the closing of a step to
48 a trybot.""" 50 a trybot."""
51 print
49 print '@@@STEP_CLOSED@@@' 52 print '@@@STEP_CLOSED@@@'
53 print
50 54
51 55
52 def CreateAndChangeToSourceDirectory(working_directory): 56 def CreateAndChangeToSourceDirectory(working_directory):
53 """Creates a directory 'bisect' as a subdirectory of 'working_directory'. If 57 """Creates a directory 'bisect' as a subdirectory of 'working_directory'. If
54 the function is successful, the current working directory will change to that 58 the function is successful, the current working directory will change to that
55 of the new 'bisect' directory. 59 of the new 'bisect' directory.
56 60
57 Returns: 61 Returns:
58 True if the directory was successfully created (or already existed). 62 True if the directory was successfully created (or already existed).
59 """ 63 """
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 """Runs gclient and creates a config containing both src and src-internal. 96 """Runs gclient and creates a config containing both src and src-internal.
93 97
94 Returns: 98 Returns:
95 The return code of the call. 99 The return code of the call.
96 """ 100 """
97 return_code = RunGClient( 101 return_code = RunGClient(
98 ['config', '--spec=%s' % GCLIENT_SPEC, '--git-deps']) 102 ['config', '--spec=%s' % GCLIENT_SPEC, '--git-deps'])
99 return return_code 103 return return_code
100 104
101 105
102 def RunGClientAndSync(): 106 def RunGClientAndSync(reset):
103 """Runs gclient and does a normal sync. 107 """Runs gclient and does a normal sync.
104 108
109 Args:
110 reset: Whether to reset any changes to the depot.
111
105 Returns: 112 Returns:
106 The return code of the call. 113 The return code of the call.
107 """ 114 """
108 return RunGClient(['sync']) 115 params = ['sync', '--verbose']
116 if reset:
117 params.extend(['--reset', '--force', '--delete_unversioned_trees'])
118 return RunGClient(params)
109 119
110 120
111 def SetupGitDepot(output_buildbot_annotations): 121 def SetupGitDepot(output_buildbot_annotations, reset):
112 """Sets up the depot for the bisection. The depot will be located in a 122 """Sets up the depot for the bisection. The depot will be located in a
113 subdirectory called 'bisect'. 123 subdirectory called 'bisect'.
114 124
125 Args:
126 reset: Whether to reset any changes to the depot.
127
115 Returns: 128 Returns:
116 True if gclient successfully created the config file and did a sync, False 129 True if gclient successfully created the config file and did a sync, False
117 otherwise. 130 otherwise.
118 """ 131 """
119 name = 'Setting up Bisection Depot' 132 name = 'Setting up Bisection Depot'
120 133
121 if output_buildbot_annotations: 134 if output_buildbot_annotations:
122 OutputAnnotationStepStart(name) 135 OutputAnnotationStepStart(name)
123 136
124 passed = False 137 passed = False
125 138
126 if not RunGClientAndCreateConfig(): 139 if not RunGClientAndCreateConfig():
127 if not RunGClientAndSync(): 140 if not RunGClientAndSync(reset):
128 passed = True 141 passed = True
129 142
130 if output_buildbot_annotations: 143 if output_buildbot_annotations:
131 print 144 print
132 OutputAnnotationStepClosed() 145 OutputAnnotationStepClosed()
133 146
134 return passed 147 return passed
135 148
136 149
137 def CreateBisectDirectoryAndSetupDepot(opts): 150 def CreateBisectDirectoryAndSetupDepot(opts, reset=False):
138 """Sets up a subdirectory 'bisect' and then retrieves a copy of the depot 151 """Sets up a subdirectory 'bisect' and then retrieves a copy of the depot
139 there using gclient. 152 there using gclient.
140 153
141 Args: 154 Args:
142 opts: The options parsed from the command line through parse_args(). 155 opts: The options parsed from the command line through parse_args().
156 reset: Whether to reset any changes to the depot.
143 157
144 Returns: 158 Returns:
145 Returns 0 on success, otherwise 1. 159 Returns 0 on success, otherwise 1.
146 """ 160 """
147 if not CreateAndChangeToSourceDirectory(opts.working_directory): 161 if not CreateAndChangeToSourceDirectory(opts.working_directory):
148 print 'Error: Could not create bisect directory.' 162 print 'Error: Could not create bisect directory.'
149 print 163 print
150 return 1 164 return 1
151 165
152 if not SetupGitDepot(opts.output_buildbot_annotations): 166 if not SetupGitDepot(opts.output_buildbot_annotations, reset):
153 print 'Error: Failed to grab source.' 167 print 'Error: Failed to grab source.'
154 print 168 print
155 return 1 169 return 1
156 170
157 return 0 171 return 0
OLDNEW
« no previous file with comments | « tools/bisect-perf-regression.py ('k') | tools/prepare-bisect-perf-regression.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698