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

Side by Side Diff: tools/bisect-perf-regression.py

Issue 256593004: [bisect] - Parse DEPS file manually if execfile fails. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 8 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2013 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2013 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Performance Test Bisect Tool 6 """Performance Test Bisect Tool
7 7
8 This script bisects a series of changelists using binary search. It starts at 8 This script bisects a series of changelists using binary search. It starts at
9 a bad revision where a performance metric has regressed, and asks for a last 9 a bad revision where a performance metric has regressed, and asks for a last
10 known-good revision. It will then binary search across this revision range by 10 known-good revision. It will then binary search across this revision range by
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 # svn: Needed for git workflow to resolve hashes to svn revisions. 69 # svn: Needed for git workflow to resolve hashes to svn revisions.
70 # from: Parent depot that must be bisected before this is bisected. 70 # from: Parent depot that must be bisected before this is bisected.
71 # deps_var: Key name in vars varible in DEPS file that has revision information. 71 # deps_var: Key name in vars varible in DEPS file that has revision information.
72 DEPOT_DEPS_NAME = { 72 DEPOT_DEPS_NAME = {
73 'chromium' : { 73 'chromium' : {
74 "src" : "src", 74 "src" : "src",
75 "recurse" : True, 75 "recurse" : True,
76 "depends" : None, 76 "depends" : None,
77 "from" : ['cros', 'android-chrome'], 77 "from" : ['cros', 'android-chrome'],
78 'viewvc': 'http://src.chromium.org/viewvc/chrome?view=revision&revision=', 78 'viewvc': 'http://src.chromium.org/viewvc/chrome?view=revision&revision=',
79 'deps_var': None 79 'deps_var': 'chromium_rev'
80 }, 80 },
81 'webkit' : { 81 'webkit' : {
82 "src" : "src/third_party/WebKit", 82 "src" : "src/third_party/WebKit",
83 "recurse" : True, 83 "recurse" : True,
84 "depends" : None, 84 "depends" : None,
85 "from" : ['chromium'], 85 "from" : ['chromium'],
86 'viewvc': 'http://src.chromium.org/viewvc/blink?view=revision&revision=', 86 'viewvc': 'http://src.chromium.org/viewvc/blink?view=revision&revision=',
87 'deps_var': 'webkit_revision' 87 'deps_var': 'webkit_revision'
88 }, 88 },
89 'angle' : { 89 'angle' : {
(...skipping 1270 matching lines...) Expand 10 before | Expand all | Expand 10 after
1360 1360
1361 bleeding_edge_revision = None 1361 bleeding_edge_revision = None
1362 1362
1363 for c in commits: 1363 for c in commits:
1364 bleeding_edge_revision = self._GetV8BleedingEdgeFromV8TrunkIfMappable(c) 1364 bleeding_edge_revision = self._GetV8BleedingEdgeFromV8TrunkIfMappable(c)
1365 if bleeding_edge_revision: 1365 if bleeding_edge_revision:
1366 break 1366 break
1367 1367
1368 return bleeding_edge_revision 1368 return bleeding_edge_revision
1369 1369
1370 def Get3rdPartyRevisionsFromCurrentRevision(self, depot, revision): 1370 def _ParseRevisionsFromDEPSFile(self, depot):
1371 """Parses the DEPS file to determine WebKit/v8/etc... versions. 1371 """Parses the local DEPS file to determine blink/skia/v8 revisions which may
1372 be needed if the bisect recurses into those depots later.
1373
1374 Args:
1375 depot: Depot being bisected.
1372 1376
1373 Returns: 1377 Returns:
1374 A dict in the format {depot:revision} if successful, otherwise None. 1378 A dict in the format {depot:revision} if successful, otherwise None.
1375 """ 1379 """
1376 cwd = os.getcwd() 1380 try:
1377 self.ChangeToDepotWorkingDirectory(depot)
1378
1379 results = {}
1380
1381 if depot == 'chromium' or depot == 'android-chrome':
1382 locals = {'Var': lambda _: locals["vars"][_], 1381 locals = {'Var': lambda _: locals["vars"][_],
1383 'From': lambda *args: None} 1382 'From': lambda *args: None}
1384 execfile(bisect_utils.FILE_DEPS_GIT, {}, locals) 1383 execfile(bisect_utils.FILE_DEPS_GIT, {}, locals)
1385 1384 locals = locals['deps']
1386 os.chdir(cwd) 1385 results = {}
1387 1386
1388 rxp = re.compile(".git@(?P<revision>[a-fA-F0-9]+)") 1387 rxp = re.compile(".git@(?P<revision>[a-fA-F0-9]+)")
1389 1388
1390 for d in DEPOT_NAMES: 1389 for d in DEPOT_NAMES:
1391 if DEPOT_DEPS_NAME[d].has_key('platform'): 1390 if DEPOT_DEPS_NAME[d].has_key('platform'):
1392 if DEPOT_DEPS_NAME[d]['platform'] != os.name: 1391 if DEPOT_DEPS_NAME[d]['platform'] != os.name:
1393 continue 1392 continue
1394 1393
1395 if (DEPOT_DEPS_NAME[d]['recurse'] and 1394 if (DEPOT_DEPS_NAME[d]['recurse'] and
1396 depot in DEPOT_DEPS_NAME[d]['from']): 1395 depot in DEPOT_DEPS_NAME[d]['from']):
1397 if (locals['deps'].has_key(DEPOT_DEPS_NAME[d]['src']) or 1396 if (locals.has_key(DEPOT_DEPS_NAME[d]['src']) or
1398 locals['deps'].has_key(DEPOT_DEPS_NAME[d]['src_old'])): 1397 locals.has_key(DEPOT_DEPS_NAME[d]['src_old'])):
1399 if locals['deps'].has_key(DEPOT_DEPS_NAME[d]['src']): 1398 if locals.has_key(DEPOT_DEPS_NAME[d]['src']):
1400 re_results = rxp.search(locals['deps'][DEPOT_DEPS_NAME[d]['src']]) 1399 re_results = rxp.search(locals[DEPOT_DEPS_NAME[d]['src']])
1401 self.depot_cwd[d] = \ 1400 self.depot_cwd[d] = \
1402 os.path.join(self.src_cwd, DEPOT_DEPS_NAME[d]['src'][4:]) 1401 os.path.join(self.src_cwd, DEPOT_DEPS_NAME[d]['src'][4:])
1403 elif locals['deps'].has_key(DEPOT_DEPS_NAME[d]['src_old']): 1402 elif (DEPOT_DEPS_NAME[d].has_key('src_old') and
1403 locals.has_key(DEPOT_DEPS_NAME[d]['src_old'])):
1404 re_results = \ 1404 re_results = \
1405 rxp.search(locals['deps'][DEPOT_DEPS_NAME[d]['src_old']]) 1405 rxp.search(locals[DEPOT_DEPS_NAME[d]['src_old']])
1406 self.depot_cwd[d] = \ 1406 self.depot_cwd[d] = \
1407 os.path.join(self.src_cwd, DEPOT_DEPS_NAME[d]['src_old'][4:]) 1407 os.path.join(self.src_cwd, DEPOT_DEPS_NAME[d]['src_old'][4:])
1408 1408
1409 if re_results: 1409 if re_results:
1410 results[d] = re_results.group('revision') 1410 results[d] = re_results.group('revision')
1411 else: 1411 else:
1412 print 'Couldn\'t parse revision for %s.' % d 1412 warning_text = ('Couldn\'t parse revision for %s while bisecting '
1413 print 1413 '%s' % (d, depot))
1414 return None 1414 if not warningText in self.warnings:
1415 self.warnings.append(warningText)
1415 else: 1416 else:
1416 print 'Couldn\'t find %s while parsing .DEPS.git.' % d 1417 print 'Couldn\'t find %s while parsing .DEPS.git.' % d
1417 print 1418 print
1418 return None 1419 return None
1420 return results
1421 except ImportError:
qyearsley 2014/04/25 16:46:19 This block (line 1422 to 1439) is a bit dense, and
shatch 2014/04/25 17:17:14 Done.
1422 # We'll parse the "vars" section of the DEPS file.
1423 rxp = re.compile("vars = {(?P<revision>[^}]+)", re.MULTILINE)
qyearsley 2014/04/25 16:46:19 <revision> isn't a very clear name for "everything
shatch 2014/04/25 17:17:14 Done.
1424 re_results = rxp.search(ReadStringFromFile(bisect_utils.FILE_DEPS_GIT))
1425 locals = {}
1426 if re_results:
qyearsley 2014/04/25 16:46:19 To avoid nesting one level here, maybe: if not re
shatch 2014/04/25 17:17:14 Done.
1427 for current_line in re_results.group("revision").splitlines():
1428 try:
1429 depot_name = current_line.split("'")[1].split("'")[0]
1430 depot_revision = current_line.split(": '")[1].split("'")[0]
qyearsley 2014/04/25 16:46:19 These two lines are particularly hard for me to un
shatch 2014/04/25 17:17:14 Done.
1431 for current_name, current_data in DEPOT_DEPS_NAME.iteritems():
1432 if (current_data.has_key('deps_var') and
1433 current_data['deps_var'] == depot_name):
1434 src_name = current_name
1435 locals[src_name] = depot_revision
1436 break
1437 except IndexError:
1438 pass
1439 return locals
1440
1441 def Get3rdPartyRevisionsFromCurrentRevision(self, depot, revision):
1442 """Parses the DEPS file to determine WebKit/v8/etc... versions.
1443
1444 Returns:
1445 A dict in the format {depot:revision} if successful, otherwise None.
1446 """
1447 cwd = os.getcwd()
1448 self.ChangeToDepotWorkingDirectory(depot)
1449
1450 results = {}
1451
1452 if depot == 'chromium' or depot == 'android-chrome':
1453 results = self._ParseRevisionsFromDEPSFile(depot)
1454 os.chdir(cwd)
1419 elif depot == 'cros': 1455 elif depot == 'cros':
1420 cmd = [CROS_SDK_PATH, '--', 'portageq-%s' % self.opts.cros_board, 1456 cmd = [CROS_SDK_PATH, '--', 'portageq-%s' % self.opts.cros_board,
1421 'best_visible', '/build/%s' % self.opts.cros_board, 'ebuild', 1457 'best_visible', '/build/%s' % self.opts.cros_board, 'ebuild',
1422 CROS_CHROMEOS_PATTERN] 1458 CROS_CHROMEOS_PATTERN]
1423 (output, return_code) = RunProcessAndRetrieveOutput(cmd) 1459 (output, return_code) = RunProcessAndRetrieveOutput(cmd)
1424 1460
1425 assert not return_code, 'An error occurred while running' \ 1461 assert not return_code, 'An error occurred while running' \
1426 ' "%s"' % ' '.join(cmd) 1462 ' "%s"' % ' '.join(cmd)
1427 1463
1428 if len(output) > CROS_CHROMEOS_PATTERN: 1464 if len(output) > CROS_CHROMEOS_PATTERN:
(...skipping 2290 matching lines...) Expand 10 before | Expand all | Expand 10 after
3719 # The perf dashboard scrapes the "results" step in order to comment on 3755 # The perf dashboard scrapes the "results" step in order to comment on
3720 # bugs. If you change this, please update the perf dashboard as well. 3756 # bugs. If you change this, please update the perf dashboard as well.
3721 bisect_utils.OutputAnnotationStepStart('Results') 3757 bisect_utils.OutputAnnotationStepStart('Results')
3722 print 'Error: %s' % e.message 3758 print 'Error: %s' % e.message
3723 if opts.output_buildbot_annotations: 3759 if opts.output_buildbot_annotations:
3724 bisect_utils.OutputAnnotationStepClosed() 3760 bisect_utils.OutputAnnotationStepClosed()
3725 return 1 3761 return 1
3726 3762
3727 if __name__ == '__main__': 3763 if __name__ == '__main__':
3728 sys.exit(main()) 3764 sys.exit(main())
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698