OLD | NEW |
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 1397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1408 """Parses the local DEPS file to determine blink/skia/v8 revisions which may | 1408 """Parses the local DEPS file to determine blink/skia/v8 revisions which may |
1409 be needed if the bisect recurses into those depots later. | 1409 be needed if the bisect recurses into those depots later. |
1410 | 1410 |
1411 Args: | 1411 Args: |
1412 depot: Depot being bisected. | 1412 depot: Depot being bisected. |
1413 | 1413 |
1414 Returns: | 1414 Returns: |
1415 A dict in the format {depot:revision} if successful, otherwise None. | 1415 A dict in the format {depot:revision} if successful, otherwise None. |
1416 """ | 1416 """ |
1417 try: | 1417 try: |
1418 locals = {'Var': lambda _: locals["vars"][_], | 1418 deps_data = {'Var': lambda _: deps_data["vars"][_], |
1419 'From': lambda *args: None} | 1419 'From': lambda *args: None |
1420 execfile(bisect_utils.FILE_DEPS_GIT, {}, locals) | 1420 } |
1421 locals = locals['deps'] | 1421 execfile(bisect_utils.FILE_DEPS_GIT, {}, deps_data) |
1422 results = {} | 1422 deps_data = deps_data['deps'] |
1423 | 1423 |
1424 rxp = re.compile(".git@(?P<revision>[a-fA-F0-9]+)") | 1424 rxp = re.compile(".git@(?P<revision>[a-fA-F0-9]+)") |
| 1425 results = {} |
| 1426 for depot_name, depot_data in DEPOT_DEPS_NAME.iteritems(): |
| 1427 if (depot_data.get('platform') and |
| 1428 depot_data.get('platform') != os.name): |
| 1429 continue |
1425 | 1430 |
1426 for d in DEPOT_NAMES: | 1431 if (depot_data.get('recurse') and depot in depot_data.get('from')): |
1427 if DEPOT_DEPS_NAME[d].has_key('platform'): | 1432 src_dir = depot_data.get('src') or depot_data.get('src_old') |
1428 if DEPOT_DEPS_NAME[d]['platform'] != os.name: | 1433 if src_dir: |
1429 continue | 1434 self.depot_cwd[depot_name] = os.path.join(self.src_cwd, src_dir[4:]) |
1430 | 1435 re_results = rxp.search(deps_data.get(src_dir, '')) |
1431 if (DEPOT_DEPS_NAME[d]['recurse'] and | |
1432 depot in DEPOT_DEPS_NAME[d]['from']): | |
1433 if (locals.has_key(DEPOT_DEPS_NAME[d]['src']) or | |
1434 locals.has_key(DEPOT_DEPS_NAME[d]['src_old'])): | |
1435 if locals.has_key(DEPOT_DEPS_NAME[d]['src']): | |
1436 re_results = rxp.search(locals[DEPOT_DEPS_NAME[d]['src']]) | |
1437 self.depot_cwd[d] = \ | |
1438 os.path.join(self.src_cwd, DEPOT_DEPS_NAME[d]['src'][4:]) | |
1439 elif (DEPOT_DEPS_NAME[d].has_key('src_old') and | |
1440 locals.has_key(DEPOT_DEPS_NAME[d]['src_old'])): | |
1441 re_results = \ | |
1442 rxp.search(locals[DEPOT_DEPS_NAME[d]['src_old']]) | |
1443 self.depot_cwd[d] = \ | |
1444 os.path.join(self.src_cwd, DEPOT_DEPS_NAME[d]['src_old'][4:]) | |
1445 | |
1446 if re_results: | 1436 if re_results: |
1447 results[d] = re_results.group('revision') | 1437 results[depot_name] = re_results.group('revision') |
1448 else: | 1438 else: |
1449 warning_text = ('Couldn\'t parse revision for %s while bisecting ' | 1439 warning_text = ('Couldn\'t parse revision for %s while bisecting ' |
1450 '%s' % (d, depot)) | 1440 '%s' % (depot_name, depot)) |
1451 if not warningText in self.warnings: | 1441 if not warning_text in self.warnings: |
1452 self.warnings.append(warningText) | 1442 self.warnings.append(warning_text) |
1453 else: | |
1454 print 'Couldn\'t find %s while parsing .DEPS.git.' % d | |
1455 print | |
1456 return None | |
1457 return results | 1443 return results |
1458 except ImportError: | 1444 except ImportError: |
1459 deps_file_contents = ReadStringFromFile(bisect_utils.FILE_DEPS_GIT) | 1445 deps_file_contents = ReadStringFromFile(bisect_utils.FILE_DEPS_GIT) |
1460 parse_results = self._ParseRevisionsFromDEPSFileManually( | 1446 parse_results = self._ParseRevisionsFromDEPSFileManually( |
1461 deps_file_contents) | 1447 deps_file_contents) |
1462 results = {} | 1448 results = {} |
1463 for depot_name, depot_revision in parse_results.iteritems(): | 1449 for depot_name, depot_revision in parse_results.iteritems(): |
1464 depot_revision = depot_revision.strip('@') | 1450 depot_revision = depot_revision.strip('@') |
1465 print depot_name, depot_revision | 1451 print depot_name, depot_revision |
1466 for current_name, current_data in DEPOT_DEPS_NAME.iteritems(): | 1452 for current_name, current_data in DEPOT_DEPS_NAME.iteritems(): |
(...skipping 2438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3905 # The perf dashboard scrapes the "results" step in order to comment on | 3891 # The perf dashboard scrapes the "results" step in order to comment on |
3906 # bugs. If you change this, please update the perf dashboard as well. | 3892 # bugs. If you change this, please update the perf dashboard as well. |
3907 bisect_utils.OutputAnnotationStepStart('Results') | 3893 bisect_utils.OutputAnnotationStepStart('Results') |
3908 print 'Error: %s' % e.message | 3894 print 'Error: %s' % e.message |
3909 if opts.output_buildbot_annotations: | 3895 if opts.output_buildbot_annotations: |
3910 bisect_utils.OutputAnnotationStepClosed() | 3896 bisect_utils.OutputAnnotationStepClosed() |
3911 return 1 | 3897 return 1 |
3912 | 3898 |
3913 if __name__ == '__main__': | 3899 if __name__ == '__main__': |
3914 sys.exit(main()) | 3900 sys.exit(main()) |
OLD | NEW |