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

Side by Side Diff: tools/auto_bisect/bisect_utils.py

Issue 691553002: Refactoring auto-bisect bot (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 1 month 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/auto_bisect/bisect_perf_regression_test.py ('k') | tools/auto_bisect/builder.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 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 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 """Utility functions used by the bisect tool. 5 """Utility functions used by the bisect tool.
6 6
7 This includes functions related to checking out the depot and outputting 7 This includes functions related to checking out the depot and outputting
8 annotations for the Buildbot waterfall. 8 annotations for the Buildbot waterfall.
9 """ 9 """
10 10
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 'safesync_url': '', 59 'safesync_url': '',
60 }, 60 },
61 ] 61 ]
62 GCLIENT_SPEC_ANDROID = "\ntarget_os = ['android']" 62 GCLIENT_SPEC_ANDROID = "\ntarget_os = ['android']"
63 GCLIENT_CUSTOM_DEPS_V8 = { 63 GCLIENT_CUSTOM_DEPS_V8 = {
64 'src/v8_bleeding_edge': 'https://chromium.googlesource.com/v8/v8.git' 64 'src/v8_bleeding_edge': 'https://chromium.googlesource.com/v8/v8.git'
65 } 65 }
66 FILE_DEPS_GIT = '.DEPS.git' 66 FILE_DEPS_GIT = '.DEPS.git'
67 FILE_DEPS = 'DEPS' 67 FILE_DEPS = 'DEPS'
68 68
69 REPO_SYNC_COMMAND = ('git checkout -f $(git rev-list --max-count=1 '
70 '--before=%d remotes/m/master)')
71
72 # Paths to CrOS-related files.
73 # WARNING(qyearsley, 2014-08-15): These haven't been tested recently.
74 CROS_SDK_PATH = os.path.join('..', 'cros', 'chromite', 'bin', 'cros_sdk')
75 CROS_TEST_KEY_PATH = os.path.join(
76 '..', 'cros', 'chromite', 'ssh_keys', 'testing_rsa')
77 CROS_SCRIPT_KEY_PATH = os.path.join(
78 '..', 'cros', 'src', 'scripts', 'mod_for_test_scripts', 'ssh_keys',
79 'testing_rsa')
80
81 REPO_PARAMS = [
82 'https://chrome-internal.googlesource.com/chromeos/manifest-internal/',
83 '--repo-url',
84 'https://git.chromium.org/external/repo.git'
85 ]
86
87 # Bisect working directory. 69 # Bisect working directory.
88 BISECT_DIR = 'bisect' 70 BISECT_DIR = 'bisect'
89 71
90 # The percentage at which confidence is considered high. 72 # The percentage at which confidence is considered high.
91 HIGH_CONFIDENCE = 95 73 HIGH_CONFIDENCE = 95
92 74
93 # Below is the map of "depot" names to information about each depot. Each depot 75 # Below is the map of "depot" names to information about each depot. Each depot
94 # is a repository, and in the process of bisecting, revision ranges in these 76 # is a repository, and in the process of bisecting, revision ranges in these
95 # repositories may also be bisected. 77 # repositories may also be bisected.
96 # 78 #
97 # Each depot information dictionary may contain: 79 # Each depot information dictionary may contain:
98 # src: Path to the working directory. 80 # src: Path to the working directory.
99 # recurse: True if this repository will get bisected. 81 # recurse: True if this repository will get bisected.
100 # depends: A list of other repositories that are actually part of the same 82 # depends: A list of other repositories that are actually part of the same
101 # repository in svn. If the repository has any dependent repositories 83 # repository in svn. If the repository has any dependent repositories
102 # (e.g. skia/src needs skia/include and skia/gyp to be updated), then 84 # (e.g. skia/src needs skia/include and skia/gyp to be updated), then
103 # they are specified here. 85 # they are specified here.
104 # svn: URL of SVN repository. Needed for git workflow to resolve hashes to 86 # svn: URL of SVN repository. Needed for git workflow to resolve hashes to
105 # SVN revisions. 87 # SVN revisions.
106 # from: Parent depot that must be bisected before this is bisected. 88 # from: Parent depot that must be bisected before this is bisected.
107 # deps_var: Key name in vars variable in DEPS file that has revision 89 # deps_var: Key name in vars variable in DEPS file that has revision
108 # information. 90 # information.
109 DEPOT_DEPS_NAME = { 91 DEPOT_DEPS_NAME = {
110 'chromium': { 92 'chromium': {
111 'src': 'src', 93 'src': 'src',
112 'recurse': True, 94 'recurse': True,
113 'depends': None, 95 'depends': None,
114 'from': ['cros', 'android-chrome'], 96 'from': ['android-chrome'],
115 'viewvc': 97 'viewvc':
116 'http://src.chromium.org/viewvc/chrome?view=revision&revision=', 98 'http://src.chromium.org/viewvc/chrome?view=revision&revision=',
117 'deps_var': 'chromium_rev' 99 'deps_var': 'chromium_rev'
118 }, 100 },
119 'webkit': { 101 'webkit': {
120 'src': 'src/third_party/WebKit', 102 'src': 'src/third_party/WebKit',
121 'recurse': True, 103 'recurse': True,
122 'depends': None, 104 'depends': None,
123 'from': ['chromium'], 105 'from': ['chromium'],
124 'viewvc': 106 'viewvc':
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 params: A list of parameters to pass to gclient. 293 params: A list of parameters to pass to gclient.
312 cwd: Working directory to run from. 294 cwd: Working directory to run from.
313 295
314 Returns: 296 Returns:
315 The return code of the call. 297 The return code of the call.
316 """ 298 """
317 cmd = ['gclient'] + params 299 cmd = ['gclient'] + params
318 return _SubprocessCall(cmd, cwd=cwd) 300 return _SubprocessCall(cmd, cwd=cwd)
319 301
320 302
321 def SetupCrosRepo():
322 """Sets up CrOS repo for bisecting ChromeOS.
323
324 Returns:
325 True if successful, False otherwise.
326 """
327 cwd = os.getcwd()
328 try:
329 os.mkdir('cros')
330 except OSError as e:
331 if e.errno != errno.EEXIST: # EEXIST means the directory already exists.
332 return False
333 os.chdir('cros')
334
335 cmd = ['init', '-u'] + REPO_PARAMS
336
337 passed = False
338
339 if not _RunRepo(cmd):
340 if not _RunRepo(['sync']):
341 passed = True
342 os.chdir(cwd)
343
344 return passed
345
346
347 def _RunRepo(params):
348 """Runs CrOS repo command with specified parameters.
349
350 Args:
351 params: A list of parameters to pass to gclient.
352
353 Returns:
354 The return code of the call (zero indicates success).
355 """
356 cmd = ['repo'] + params
357 return _SubprocessCall(cmd)
358
359
360 def RunRepoSyncAtTimestamp(timestamp):
361 """Syncs all git depots to the timestamp specified using repo forall.
362
363 Args:
364 params: Unix timestamp to sync to.
365
366 Returns:
367 The return code of the call.
368 """
369 cmd = ['forall', '-c', REPO_SYNC_COMMAND % timestamp]
370 return _RunRepo(cmd)
371
372
373 def RunGClientAndCreateConfig(opts, custom_deps=None, cwd=None): 303 def RunGClientAndCreateConfig(opts, custom_deps=None, cwd=None):
374 """Runs gclient and creates a config containing both src and src-internal. 304 """Runs gclient and creates a config containing both src and src-internal.
375 305
376 Args: 306 Args:
377 opts: The options parsed from the command line through parse_args(). 307 opts: The options parsed from the command line through parse_args().
378 custom_deps: A dictionary of additional dependencies to add to .gclient. 308 custom_deps: A dictionary of additional dependencies to add to .gclient.
379 cwd: Working directory to run from. 309 cwd: Working directory to run from.
380 310
381 Returns: 311 Returns:
382 The return code of the call. 312 The return code of the call.
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
622 platform = os.environ.get('PROCESSOR_ARCHITECTURE') 552 platform = os.environ.get('PROCESSOR_ARCHITECTURE')
623 return platform and platform in ['AMD64', 'I64'] 553 return platform and platform in ['AMD64', 'I64']
624 554
625 555
626 def IsLinuxHost(): 556 def IsLinuxHost():
627 return sys.platform.startswith('linux') 557 return sys.platform.startswith('linux')
628 558
629 559
630 def IsMacHost(): 560 def IsMacHost():
631 return sys.platform.startswith('darwin') 561 return sys.platform.startswith('darwin')
OLDNEW
« no previous file with comments | « tools/auto_bisect/bisect_perf_regression_test.py ('k') | tools/auto_bisect/builder.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698