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

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

Issue 536553003: Parse Git hash for dependency repositories from DEPS file. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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
« no previous file with comments | « no previous file | tools/bisect-perf-regression_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 #!/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 1371 matching lines...) Expand 10 before | Expand all | Expand 10 after
1382 1382
1383 def IsDownloadable(self, depot): 1383 def IsDownloadable(self, depot):
1384 """Checks if build can be downloaded based on target platform and depot.""" 1384 """Checks if build can be downloaded based on target platform and depot."""
1385 if (self.opts.target_platform in ['chromium', 'android'] and 1385 if (self.opts.target_platform in ['chromium', 'android'] and
1386 self.opts.gs_bucket): 1386 self.opts.gs_bucket):
1387 return (depot == 'chromium' or 1387 return (depot == 'chromium' or
1388 'chromium' in DEPOT_DEPS_NAME[depot]['from'] or 1388 'chromium' in DEPOT_DEPS_NAME[depot]['from'] or
1389 'v8' in DEPOT_DEPS_NAME[depot]['from']) 1389 'v8' in DEPOT_DEPS_NAME[depot]['from'])
1390 return False 1390 return False
1391 1391
1392 def UpdateDepsContents(self, deps_contents, depot, git_revision, deps_key):
1393 """Returns modified version of DEPS file contents.
1394
1395 Args:
1396 deps_contents: DEPS file content.
1397 depot: Current depot being bisected.
1398 git_revision: A git hash to be updated in DEPS.
1399 deps_key: Key in vars section of DEPS file to be searched.
1400
1401 Returns:
1402 Updated DEPS content as string if deps key is found, otherwise None.
1403 """
1404 # Check whether the depot and revision pattern in DEPS file vars
1405 # e.g. for webkit the format is "webkit_revision": "12345".
1406 deps_revision = re.compile(r'(?<="%s": ")([0-9]+)(?=")' % deps_key,
1407 re.MULTILINE)
1408 new_data = None
qyearsley 2014/09/04 22:24:34 "data" is a pretty non-descriptive word to use in
1409 if re.search(deps_revision, deps_contents):
1410 svn_revision = self.source_control.SVNFindRev(
1411 git_revision, self._GetDepotDirectory(depot))
1412 if not svn_revision:
1413 print 'Could not determine SVN revision for %s' % git_revision
1414 return None
1415 # Update the revision information for the given depot
1416 new_data = re.sub(deps_revision, str(svn_revision), deps_contents)
1417 else:
1418 # Check whether the depot and revision pattern in DEPS file vars
1419 # e.g. for webkit the format is "webkit_revision": "559a6d4ab7a84c539..".
1420 deps_revision = re.compile(
1421 r'(?<=["\']%s["\']: ["\'])([a-fA-F0-9]{40})(?=["\'])' % deps_key,
1422 re.MULTILINE)
1423 if re.search(deps_revision, deps_contents):
1424 new_data = re.sub(deps_revision, git_revision, deps_contents)
1425 if new_data:
qyearsley 2014/09/04 22:24:34 This could be changed to if new_data and depot
1426 # For v8_bleeding_edge revisions change V8 branch in order
1427 # to fetch bleeding edge revision.
1428 if depot == 'v8_bleeding_edge':
1429 new_data = _UpdateV8Branch(new_data)
1430 if not new_data:
1431 return None
1432 return new_data
1433
1392 def UpdateDeps(self, revision, depot, deps_file): 1434 def UpdateDeps(self, revision, depot, deps_file):
1393 """Updates DEPS file with new revision of dependency repository. 1435 """Updates DEPS file with new revision of dependency repository.
1394 1436
1395 This method search DEPS for a particular pattern in which depot revision 1437 This method search DEPS for a particular pattern in which depot revision
1396 is specified (e.g "webkit_revision": "123456"). If a match is found then 1438 is specified (e.g "webkit_revision": "123456"). If a match is found then
1397 it resolves the given git hash to SVN revision and replace it in DEPS file. 1439 it resolves the given git hash to SVN revision and replace it in DEPS file.
1398 1440
1399 Args: 1441 Args:
1400 revision: A git hash revision of the dependency repository. 1442 revision: A git hash revision of the dependency repository.
1401 depot: Current depot being bisected. 1443 depot: Current depot being bisected.
(...skipping 14 matching lines...) Expand all
1416 # Hack for Angle repository. In the DEPS file, "vars" dictionary variable 1458 # Hack for Angle repository. In the DEPS file, "vars" dictionary variable
1417 # contains "angle_revision" key that holds git hash instead of SVN revision. 1459 # contains "angle_revision" key that holds git hash instead of SVN revision.
1418 # And sometime "angle_revision" key is not specified in "vars" variable. 1460 # And sometime "angle_revision" key is not specified in "vars" variable.
1419 # In such cases check, "deps" dictionary variable that matches 1461 # In such cases check, "deps" dictionary variable that matches
1420 # angle.git@[a-fA-F0-9]{40}$ and replace git hash. 1462 # angle.git@[a-fA-F0-9]{40}$ and replace git hash.
1421 if depot == 'angle': 1463 if depot == 'angle':
1422 return _UpdateDEPSForAngle(revision, depot, deps_file) 1464 return _UpdateDEPSForAngle(revision, depot, deps_file)
1423 1465
1424 try: 1466 try:
1425 deps_contents = ReadStringFromFile(deps_file) 1467 deps_contents = ReadStringFromFile(deps_file)
1426 # Check whether the depot and revision pattern in DEPS file vars 1468 updated_deps_content = self.UpdateDepsContents(
1427 # e.g. for webkit the format is "webkit_revision": "12345". 1469 deps_contents, depot, revision, deps_var)
1428 deps_revision = re.compile(r'(?<="%s": ")([0-9]+)(?=")' % deps_var, 1470 # Write changes to DEPS file
1429 re.MULTILINE) 1471 if updated_deps_content:
1430 match = re.search(deps_revision, deps_contents) 1472 WriteStringToFile(updated_deps_content, deps_file)
1431 if match:
1432 svn_revision = self.source_control.SVNFindRev(
1433 revision, self._GetDepotDirectory(depot))
1434 if not svn_revision:
1435 print 'Could not determine SVN revision for %s' % revision
1436 return False
1437 # Update the revision information for the given depot
1438 new_data = re.sub(deps_revision, str(svn_revision), deps_contents)
1439
1440 # For v8_bleeding_edge revisions change V8 branch in order
1441 # to fetch bleeding edge revision.
1442 if depot == 'v8_bleeding_edge':
1443 new_data = _UpdateV8Branch(new_data)
1444 if not new_data:
1445 return False
1446 # Write changes to DEPS file
1447 WriteStringToFile(new_data, deps_file)
1448 return True 1473 return True
1449 except IOError, e: 1474 except IOError, e:
1450 print 'Something went wrong while updating DEPS file. [%s]' % e 1475 print 'Something went wrong while updating DEPS file. [%s]' % e
1451 return False 1476 return False
1452 1477
1453 def CreateDEPSPatch(self, depot, revision): 1478 def CreateDEPSPatch(self, depot, revision):
1454 """Modifies DEPS and returns diff as text. 1479 """Modifies DEPS and returns diff as text.
1455 1480
1456 Args: 1481 Args:
1457 depot: Current depot being bisected. 1482 depot: Current depot being bisected.
(...skipping 1003 matching lines...) Expand 10 before | Expand all | Expand 10 after
2461 if min_revision_data['passed'] == '?': 2486 if min_revision_data['passed'] == '?':
2462 next_revision_index = min_revision 2487 next_revision_index = min_revision
2463 elif max_revision_data['passed'] == '?': 2488 elif max_revision_data['passed'] == '?':
2464 next_revision_index = max_revision 2489 next_revision_index = max_revision
2465 elif current_depot in ['android-chrome', 'cros', 'chromium', 'v8']: 2490 elif current_depot in ['android-chrome', 'cros', 'chromium', 'v8']:
2466 previous_revision = revision_list[min_revision] 2491 previous_revision = revision_list[min_revision]
2467 # If there were changes to any of the external libraries we track, 2492 # If there were changes to any of the external libraries we track,
2468 # should bisect the changes there as well. 2493 # should bisect the changes there as well.
2469 external_depot = self._FindNextDepotToBisect( 2494 external_depot = self._FindNextDepotToBisect(
2470 current_depot, min_revision_data, max_revision_data) 2495 current_depot, min_revision_data, max_revision_data)
2471
2472 # If there was no change in any of the external depots, the search 2496 # If there was no change in any of the external depots, the search
2473 # is over. 2497 # is over.
2474 if not external_depot: 2498 if not external_depot:
2475 if current_depot == 'v8': 2499 if current_depot == 'v8':
2476 self.warnings.append('Unfortunately, V8 bisection couldn\'t ' 2500 self.warnings.append('Unfortunately, V8 bisection couldn\'t '
2477 'continue any further. The script can only bisect into ' 2501 'continue any further. The script can only bisect into '
2478 'V8\'s bleeding_edge repository if both the current and ' 2502 'V8\'s bleeding_edge repository if both the current and '
2479 'previous revisions in trunk map directly to revisions in ' 2503 'previous revisions in trunk map directly to revisions in '
2480 'bleeding_edge.') 2504 'bleeding_edge.')
2481 break 2505 break
(...skipping 877 matching lines...) Expand 10 before | Expand all | Expand 10 after
3359 # bugs. If you change this, please update the perf dashboard as well. 3383 # bugs. If you change this, please update the perf dashboard as well.
3360 bisect_utils.OutputAnnotationStepStart('Results') 3384 bisect_utils.OutputAnnotationStepStart('Results')
3361 print 'Error: %s' % e.message 3385 print 'Error: %s' % e.message
3362 if opts.output_buildbot_annotations: 3386 if opts.output_buildbot_annotations:
3363 bisect_utils.OutputAnnotationStepClosed() 3387 bisect_utils.OutputAnnotationStepClosed()
3364 return 1 3388 return 1
3365 3389
3366 3390
3367 if __name__ == '__main__': 3391 if __name__ == '__main__':
3368 sys.exit(main()) 3392 sys.exit(main())
OLDNEW
« no previous file with comments | « no previous file | tools/bisect-perf-regression_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698