Chromium Code Reviews| 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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 169 | 169 |
| 170 # The confidence percentage at which confidence can be consider "high". | 170 # The confidence percentage at which confidence can be consider "high". |
| 171 HIGH_CONFIDENCE = 95 | 171 HIGH_CONFIDENCE = 95 |
| 172 | 172 |
| 173 # Patch template to add a new file, DEPS.sha under src folder. | 173 # Patch template to add a new file, DEPS.sha under src folder. |
| 174 # This file contains SHA1 value of the DEPS changes made while bisecting | 174 # This file contains SHA1 value of the DEPS changes made while bisecting |
| 175 # dependency repositories. This patch send along with DEPS patch to try server. | 175 # dependency repositories. This patch send along with DEPS patch to try server. |
| 176 # When a build requested is posted with a patch, bisect builders on try server, | 176 # When a build requested is posted with a patch, bisect builders on try server, |
| 177 # once build is produced, it reads SHA value from this file and appends it | 177 # once build is produced, it reads SHA value from this file and appends it |
| 178 # to build archive filename. | 178 # to build archive filename. |
| 179 DEPS_SHA_PATCH = """diff --git src/DEPS.sha src/DEPS.sha | 179 DEPS_SHA_PATCH = """diff --git DEPS.sha DEPS.sha |
| 180 new file mode 100644 | 180 new file mode 100644 |
| 181 --- /dev/null | 181 --- /dev/null |
| 182 +++ src/DEPS.sha | 182 +++ DEPS.sha |
| 183 @@ -0,0 +1 @@ | 183 @@ -0,0 +1 @@ |
| 184 +%(deps_sha)s | 184 +%(deps_sha)s |
| 185 """ | 185 """ |
| 186 | 186 |
| 187 # The possible values of the --bisect_mode flag, which determines what to | 187 # The possible values of the --bisect_mode flag, which determines what to |
| 188 # use when classifying a revision as "good" or "bad". | 188 # use when classifying a revision as "good" or "bad". |
| 189 BISECT_MODE_MEAN = 'mean' | 189 BISECT_MODE_MEAN = 'mean' |
| 190 BISECT_MODE_STD_DEV = 'std_dev' | 190 BISECT_MODE_STD_DEV = 'std_dev' |
| 191 BISECT_MODE_RETURN_CODE = 'return_code' | 191 BISECT_MODE_RETURN_CODE = 'return_code' |
| 192 | 192 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 243 | 243 |
| 244 For more details please visit | 244 For more details please visit |
| 245 https://sites.google.com/a/chromium.org/dev/developers/performance-try-bots | 245 https://sites.google.com/a/chromium.org/dev/developers/performance-try-bots |
| 246 """ | 246 """ |
| 247 | 247 |
| 248 RESULTS_THANKYOU = """ | 248 RESULTS_THANKYOU = """ |
| 249 O O | Visit http://www.chromium.org/developers/core-principles for Chrome's | 249 O O | Visit http://www.chromium.org/developers/core-principles for Chrome's |
| 250 X | policy on perf regressions. Contact chrome-perf-dashboard-team with any | 250 X | policy on perf regressions. Contact chrome-perf-dashboard-team with any |
| 251 / \ | questions or suggestions about bisecting. THANK YOU.""" | 251 / \ | questions or suggestions about bisecting. THANK YOU.""" |
| 252 | 252 |
| 253 # Git branch name used to run bisect try jobs. | |
| 254 BISECT_TRYJOB_BRANCH = 'bisect-tryjob' | |
| 255 # Git master branch name. | |
| 256 BISECT_MASTER_BRANCH = 'master' | |
| 257 # File to store 'git diff' content. | |
| 258 BISECT_PATCH_FILE = 'deps_patch.txt' | |
| 259 # SVN repo where the bisect try jobs are submitted. | |
| 260 SVN_REPO_URL = 'svn://svn.chromium.org/chrome-try/try-perf' | |
| 261 | |
| 262 class RunGitError(Exception): | |
| 263 | |
| 264 def __str__(self): | |
| 265 return '%s\nError executing git command.' % self.args[0] | |
| 266 | |
| 253 | 267 |
| 254 def _AddAdditionalDepotInfo(depot_info): | 268 def _AddAdditionalDepotInfo(depot_info): |
| 255 """Adds additional depot info to the global depot variables.""" | 269 """Adds additional depot info to the global depot variables.""" |
| 256 global DEPOT_DEPS_NAME | 270 global DEPOT_DEPS_NAME |
| 257 global DEPOT_NAMES | 271 global DEPOT_NAMES |
| 258 DEPOT_DEPS_NAME = dict(DEPOT_DEPS_NAME.items() + depot_info.items()) | 272 DEPOT_DEPS_NAME = dict(DEPOT_DEPS_NAME.items() + depot_info.items()) |
| 259 DEPOT_NAMES = DEPOT_DEPS_NAME.keys() | 273 DEPOT_NAMES = DEPOT_DEPS_NAME.keys() |
| 260 | 274 |
| 261 | 275 |
| 262 def GetSHA1HexDigest(contents): | 276 def GetSHA1HexDigest(contents): |
| (...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 839 'was added without proper support?' % depot_name) | 853 'was added without proper support?' % depot_name) |
| 840 | 854 |
| 841 def ChangeToDepotDir(self, depot_name): | 855 def ChangeToDepotDir(self, depot_name): |
| 842 """Given a depot, changes to the appropriate working directory. | 856 """Given a depot, changes to the appropriate working directory. |
| 843 | 857 |
| 844 Args: | 858 Args: |
| 845 depot_name: The name of the depot (see DEPOT_NAMES). | 859 depot_name: The name of the depot (see DEPOT_NAMES). |
| 846 """ | 860 """ |
| 847 os.chdir(self.GetDepotDir(depot_name)) | 861 os.chdir(self.GetDepotDir(depot_name)) |
| 848 | 862 |
| 863 def _PrepareBisectBranch(parent_branch, new_branch): | |
| 864 """Creates a new branch to submit bisect try job. | |
| 865 | |
| 866 Args: | |
| 867 parent_branch: Parent branch to be used to create new branch. | |
| 868 new_branch: New branch name. | |
| 869 """ | |
| 870 current_branch, returncode = bisect_utils.RunGit( | |
| 871 ['rev-parse', '--abbrev-ref', 'HEAD']) | |
| 872 if returncode: | |
| 873 raise RunGitError('Must be in a git repository to send changes to trybots.') | |
| 874 | |
| 875 current_branch = current_branch.strip() | |
| 876 # Make sure current branch is master. | |
| 877 if current_branch != parent_branch: | |
| 878 output, returncode = bisect_utils.RunGit(['checkout', '-f', parent_branch]) | |
| 879 if returncode: | |
| 880 raise RunGitError('Failed to checkout branch: %s.' % output) | |
| 881 | |
| 882 # Delete new branch if exists. | |
| 883 output, returncode = bisect_utils.RunGit(['branch', '--list' ]) | |
| 884 if new_branch in output: | |
| 885 output, returncode = bisect_utils.RunGit(['branch', '-D', new_branch]) | |
| 886 if returncode: | |
| 887 raise RunGitError('Deleting branch failed, %s', output) | |
| 888 | |
| 889 # Check if the tree is dirty: make sure the index is up to date and then | |
| 890 # run diff-index. | |
| 891 bisect_utils.RunGit(['update-index', '--refresh', '-q']) | |
| 892 output, returncode = bisect_utils.RunGit(['diff-index', 'HEAD']) | |
| 893 if output: | |
| 894 raise RunGitError('Cannot send a try job with a dirty tree.') | |
| 895 | |
| 896 # Create/check out the telemetry-tryjob branch, and edit the configs | |
| 897 # for the tryjob there. | |
| 898 output, returncode = bisect_utils.RunGit(['checkout', '-b', new_branch]) | |
| 899 if returncode: | |
| 900 raise RunGitError('Failed to checkout branch: %s.' % output) | |
| 901 | |
| 902 output, returncode = bisect_utils.RunGit( | |
| 903 ['branch', '--set-upstream-to', parent_branch]) | |
| 904 if returncode: | |
| 905 raise RunGitError('Error in git branch --set-upstream-to') | |
| 906 | |
| 907 | |
| 908 def _BuilderTryjob(git_revision, bot_name, bisect_job_name, patch=None): | |
| 909 """Attempts to run a tryjob from the current directory. | |
| 910 | |
| 911 Args: | |
| 912 git_revision: A Git hash revision. | |
| 913 bot_name: Name of the bisect bot to be used for try job. | |
| 914 bisect_job_name: Bisect try job name. | |
| 915 patch: A DEPS patch (used while bisecting 3rd party repositories). | |
| 916 | |
| 917 Returns: | |
| 918 True if a tryjob was sent otherwise raises RunGitError exception. | |
| 919 """ | |
| 920 try: | |
| 921 # Temporary branch for running tryjob. | |
| 922 _PrepareBisectBranch(BISECT_MASTER_BRANCH, BISECT_TRYJOB_BRANCH) | |
| 923 patch_content = '/dev/null' | |
| 924 # Create a temporary patch file, if it fails raise an exception. | |
| 925 if patch: | |
| 926 WriteStringToFile(patch, BISECT_PATCH_FILE) | |
| 927 patch_content = BISECT_PATCH_FILE | |
| 928 | |
| 929 try_cmd = ['try', | |
| 930 '-b', bot_name, | |
| 931 '-r', git_revision, | |
| 932 '-n', bisect_job_name, | |
| 933 '--svn_repo=%s' % SVN_REPO_URL, | |
| 934 '--diff=%s' % patch_content | |
| 935 ] | |
| 936 # Execute try job to build revision. | |
| 937 output, returncode = bisect_utils.RunGit(try_cmd) | |
| 938 | |
| 939 if returncode: | |
| 940 raise RunGitError('Could not execute tryjob: %s.\n Error: %s' % ( | |
| 941 'git %s' % ' '.join(try_cmd), output)) | |
| 942 print ('Try job successfully submitted.\n TryJob Details: %s\n%s' % ( | |
| 943 'git %s' % ' '.join(try_cmd), output)) | |
| 944 | |
| 945 finally: | |
| 946 # Delete patch file if exists | |
| 947 try: | |
| 948 os.remove(BISECT_PATCH_FILE) | |
| 949 except OSError as e: | |
| 950 if e.errno != errno.ENOENT: | |
| 951 raise | |
| 952 # Checkout master branch and delete bisect-tryjob branch. | |
| 953 bisect_utils.RunGit(['checkout', '-f', BISECT_MASTER_BRANCH]) | |
| 954 bisect_utils.RunGit(['branch', '-D', BISECT_TRYJOB_BRANCH]) | |
| 955 | |
| 956 return True | |
|
qyearsley
2014/10/02 01:07:53
Probably unnecessary to return something here; if
prasadv
2014/10/02 17:27:27
Done.
| |
| 957 | |
| 849 | 958 |
| 850 class BisectPerformanceMetrics(object): | 959 class BisectPerformanceMetrics(object): |
| 851 """This class contains functionality to perform a bisection of a range of | 960 """This class contains functionality to perform a bisection of a range of |
| 852 revisions to narrow down where performance regressions may have occurred. | 961 revisions to narrow down where performance regressions may have occurred. |
| 853 | 962 |
| 854 The main entry-point is the Run method. | 963 The main entry-point is the Run method. |
| 855 """ | 964 """ |
| 856 | 965 |
| 857 def __init__(self, source_control, opts): | 966 def __init__(self, source_control, opts): |
| 858 super(BisectPerformanceMetrics, self).__init__() | 967 super(BisectPerformanceMetrics, self).__init__() |
| (...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1175 if not downloaded_archive: | 1284 if not downloaded_archive: |
| 1176 # Get commit position for the given SHA. | 1285 # Get commit position for the given SHA. |
| 1177 commit_position = self.source_control.GetCommitPosition(revision) | 1286 commit_position = self.source_control.GetCommitPosition(revision) |
| 1178 if commit_position: | 1287 if commit_position: |
| 1179 # Source archive file path on cloud storage using SVN revision. | 1288 # Source archive file path on cloud storage using SVN revision. |
| 1180 source_file = GetRemoteBuildPath( | 1289 source_file = GetRemoteBuildPath( |
| 1181 commit_position, self.opts.target_platform, target_arch, patch_sha) | 1290 commit_position, self.opts.target_platform, target_arch, patch_sha) |
| 1182 return FetchFromCloudStorage(gs_bucket, source_file, out_dir) | 1291 return FetchFromCloudStorage(gs_bucket, source_file, out_dir) |
| 1183 return downloaded_archive | 1292 return downloaded_archive |
| 1184 | 1293 |
| 1185 def DownloadCurrentBuild(self, revision, build_type='Release', patch=None): | 1294 def DownloadCurrentBuild(self, revision, depot, build_type='Release'): |
| 1186 """Downloads the build archive for the given revision. | 1295 """Downloads the build archive for the given revision. |
| 1187 | 1296 |
| 1188 Args: | 1297 Args: |
| 1189 revision: The Git revision to download or build. | 1298 revision: The Git revision to download or build. |
| 1190 build_type: Target build type ('Release', 'Debug', 'Release_x64' etc.) | 1299 build_type: Target build type ('Release', 'Debug', 'Release_x64' etc.) |
| 1191 patch: A DEPS patch (used while bisecting 3rd party repositories). | 1300 patch: A DEPS patch (used while bisecting 3rd party repositories). |
| 1192 | 1301 |
| 1193 Returns: | 1302 Returns: |
| 1194 True if download succeeds, otherwise False. | 1303 True if download succeeds, otherwise False. |
| 1195 """ | 1304 """ |
| 1305 patch = None | |
| 1196 patch_sha = None | 1306 patch_sha = None |
| 1307 if depot != 'chromium': | |
| 1308 # Create a DEPS patch with new revision for dependency repository. | |
| 1309 revision, patch = self.CreateDEPSPatch(depot, revision) | |
| 1310 | |
| 1197 if patch: | 1311 if patch: |
| 1198 # Get the SHA of the DEPS changes patch. | 1312 # Get the SHA of the DEPS changes patch. |
| 1199 patch_sha = GetSHA1HexDigest(patch) | 1313 patch_sha = GetSHA1HexDigest(patch) |
| 1200 | 1314 |
| 1201 # Update the DEPS changes patch with a patch to create a new file named | 1315 # Update the DEPS changes patch with a patch to create a new file named |
| 1202 # 'DEPS.sha' and add patch_sha evaluated above to it. | 1316 # 'DEPS.sha' and add patch_sha evaluated above to it. |
| 1203 patch = '%s\n%s' % (patch, DEPS_SHA_PATCH % {'deps_sha': patch_sha}) | 1317 patch = '%s\n%s' % (patch, DEPS_SHA_PATCH % {'deps_sha': patch_sha}) |
| 1204 | 1318 |
| 1205 # Get Build output directory | 1319 # Get Build output directory |
| 1206 abs_build_dir = os.path.abspath( | 1320 abs_build_dir = os.path.abspath( |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1283 if bisect_utils.IsLinuxHost(): | 1397 if bisect_utils.IsLinuxHost(): |
| 1284 if target_platform == 'android': | 1398 if target_platform == 'android': |
| 1285 return ('android_perf_bisect_builder', MAX_LINUX_BUILD_TIME) | 1399 return ('android_perf_bisect_builder', MAX_LINUX_BUILD_TIME) |
| 1286 return ('linux_perf_bisect_builder', MAX_LINUX_BUILD_TIME) | 1400 return ('linux_perf_bisect_builder', MAX_LINUX_BUILD_TIME) |
| 1287 if bisect_utils.IsMacHost(): | 1401 if bisect_utils.IsMacHost(): |
| 1288 return ('mac_perf_bisect_builder', MAX_MAC_BUILD_TIME) | 1402 return ('mac_perf_bisect_builder', MAX_MAC_BUILD_TIME) |
| 1289 raise NotImplementedError('Unsupported Platform "%s".' % sys.platform) | 1403 raise NotImplementedError('Unsupported Platform "%s".' % sys.platform) |
| 1290 if not fetch_build: | 1404 if not fetch_build: |
| 1291 return False | 1405 return False |
| 1292 | 1406 |
| 1293 bot_name, build_timeout = GetBuilderNameAndBuildTime( | |
| 1294 self.opts.target_platform, self.opts.target_arch) | |
| 1295 builder_host = self.opts.builder_host | |
| 1296 builder_port = self.opts.builder_port | |
| 1297 # Create a unique ID for each build request posted to try server builders. | 1407 # Create a unique ID for each build request posted to try server builders. |
| 1298 # This ID is added to "Reason" property of the build. | 1408 # This ID is added to "Reason" property of the build. |
| 1299 build_request_id = GetSHA1HexDigest( | 1409 build_request_id = GetSHA1HexDigest( |
| 1300 '%s-%s-%s' % (git_revision, patch, time.time())) | 1410 '%s-%s-%s' % (git_revision, patch, time.time())) |
| 1301 | 1411 |
| 1302 # Creates a try job description. | 1412 # Reverts any changes to DEPS file. |
| 1303 # Always use Git hash to post build request since Commit positions are | 1413 self.source_control.CheckoutFileAtRevision( |
| 1304 # not supported by builders to build. | 1414 bisect_utils.FILE_DEPS, git_revision, cwd=self.src_cwd) |
| 1305 job_args = { | 1415 |
| 1306 'revision': 'src@%s' % git_revision, | 1416 bot_name, build_timeout = GetBuilderNameAndBuildTime( |
| 1307 'bot': bot_name, | 1417 self.opts.target_platform, self.opts.target_arch) |
| 1308 'name': build_request_id, | 1418 target_file = None |
| 1309 } | 1419 try: |
| 1310 # Update patch information if supplied. | 1420 # Execute try job request to build revision with patch. |
| 1311 if patch: | 1421 _BuilderTryjob(git_revision, bot_name, build_request_id, patch) |
| 1312 job_args['patch'] = patch | |
| 1313 # Posts job to build the revision on the server. | |
| 1314 if request_build.PostTryJob(builder_host, builder_port, job_args): | |
| 1315 target_file, error_msg = _WaitUntilBuildIsReady( | 1422 target_file, error_msg = _WaitUntilBuildIsReady( |
| 1316 fetch_build, bot_name, builder_host, builder_port, build_request_id, | 1423 fetch_build, bot_name, self.opts.builder_host, |
| 1317 build_timeout) | 1424 self.opts.builder_port, build_request_id, build_timeout) |
| 1318 if not target_file: | 1425 if not target_file: |
| 1319 print '%s [revision: %s]' % (error_msg, git_revision) | 1426 print '%s [revision: %s]' % (error_msg, git_revision) |
| 1320 return None | 1427 except RunGitError as e: |
| 1321 return target_file | 1428 print ('Failed to post builder try job for revision: [%s].\n' |
| 1322 print 'Failed to post build request for revision: [%s]' % git_revision | 1429 'Error: %s' % (git_revision, e)) |
| 1323 return None | 1430 |
| 1431 return target_file | |
| 1324 | 1432 |
| 1325 def IsDownloadable(self, depot): | 1433 def IsDownloadable(self, depot): |
| 1326 """Checks if build can be downloaded based on target platform and depot.""" | 1434 """Checks if build can be downloaded based on target platform and depot.""" |
| 1327 if (self.opts.target_platform in ['chromium', 'android'] and | 1435 if (self.opts.target_platform in ['chromium', 'android'] and |
| 1328 self.opts.gs_bucket): | 1436 self.opts.gs_bucket): |
| 1329 return (depot == 'chromium' or | 1437 return (depot == 'chromium' or |
| 1330 'chromium' in DEPOT_DEPS_NAME[depot]['from'] or | 1438 'chromium' in DEPOT_DEPS_NAME[depot]['from'] or |
| 1331 'v8' in DEPOT_DEPS_NAME[depot]['from']) | 1439 'v8' in DEPOT_DEPS_NAME[depot]['from']) |
| 1332 return False | 1440 return False |
| 1333 | 1441 |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1410 updated_deps_content = self.UpdateDepsContents( | 1518 updated_deps_content = self.UpdateDepsContents( |
| 1411 deps_contents, depot, revision, deps_var) | 1519 deps_contents, depot, revision, deps_var) |
| 1412 # Write changes to DEPS file | 1520 # Write changes to DEPS file |
| 1413 if updated_deps_content: | 1521 if updated_deps_content: |
| 1414 WriteStringToFile(updated_deps_content, deps_file) | 1522 WriteStringToFile(updated_deps_content, deps_file) |
| 1415 return True | 1523 return True |
| 1416 except IOError, e: | 1524 except IOError, e: |
| 1417 print 'Something went wrong while updating DEPS file. [%s]' % e | 1525 print 'Something went wrong while updating DEPS file. [%s]' % e |
| 1418 return False | 1526 return False |
| 1419 | 1527 |
| 1528 | |
| 1420 def CreateDEPSPatch(self, depot, revision): | 1529 def CreateDEPSPatch(self, depot, revision): |
| 1421 """Modifies DEPS and returns diff as text. | 1530 """Modifies DEPS and returns diff as text. |
| 1422 | 1531 |
| 1423 Args: | 1532 Args: |
| 1424 depot: Current depot being bisected. | 1533 depot: Current depot being bisected. |
| 1425 revision: A git hash revision of the dependency repository. | 1534 revision: A git hash revision of the dependency repository. |
| 1426 | 1535 |
| 1427 Returns: | 1536 Returns: |
| 1428 A tuple with git hash of chromium revision and DEPS patch text. | 1537 A tuple with git hash of chromium revision and DEPS patch text. |
| 1429 """ | 1538 """ |
| 1430 deps_file_path = os.path.join(self.src_cwd, bisect_utils.FILE_DEPS) | 1539 deps_file_path = os.path.join(self.src_cwd, bisect_utils.FILE_DEPS) |
| 1431 if not os.path.exists(deps_file_path): | 1540 if not os.path.exists(deps_file_path): |
| 1432 raise RuntimeError('DEPS file does not exists.[%s]' % deps_file_path) | 1541 raise RuntimeError('DEPS file does not exists.[%s]' % deps_file_path) |
| 1433 # Get current chromium revision (git hash). | 1542 # Get current chromium revision (git hash). |
| 1434 cmd = ['rev-parse', 'HEAD'] | 1543 cmd = ['rev-parse', 'HEAD'] |
| 1435 chromium_sha = bisect_utils.CheckRunGit(cmd).strip() | 1544 chromium_sha = bisect_utils.CheckRunGit(cmd).strip() |
| 1436 if not chromium_sha: | 1545 if not chromium_sha: |
| 1437 raise RuntimeError('Failed to determine Chromium revision for %s' % | 1546 raise RuntimeError('Failed to determine Chromium revision for %s' % |
| 1438 revision) | 1547 revision) |
| 1439 if ('chromium' in DEPOT_DEPS_NAME[depot]['from'] or | 1548 if ('chromium' in DEPOT_DEPS_NAME[depot]['from'] or |
| 1440 'v8' in DEPOT_DEPS_NAME[depot]['from']): | 1549 'v8' in DEPOT_DEPS_NAME[depot]['from']): |
| 1441 # Checkout DEPS file for the current chromium revision. | 1550 # Checkout DEPS file for the current chromium revision. |
| 1442 if self.source_control.CheckoutFileAtRevision( | 1551 if self.source_control.CheckoutFileAtRevision( |
| 1443 bisect_utils.FILE_DEPS, chromium_sha, cwd=self.src_cwd): | 1552 bisect_utils.FILE_DEPS, chromium_sha, cwd=self.src_cwd): |
| 1444 if self.UpdateDeps(revision, depot, deps_file_path): | 1553 if self.UpdateDeps(revision, depot, deps_file_path): |
| 1445 diff_command = [ | 1554 diff_command = [ |
| 1446 'diff', | 1555 'diff', |
| 1447 '--src-prefix=src/', | 1556 '--src-prefix=', |
| 1448 '--dst-prefix=src/', | 1557 '--dst-prefix=', |
| 1449 '--no-ext-diff', | 1558 '--no-ext-diff', |
| 1450 bisect_utils.FILE_DEPS, | 1559 bisect_utils.FILE_DEPS, |
| 1451 ] | 1560 ] |
| 1452 diff_text = bisect_utils.CheckRunGit(diff_command, cwd=self.src_cwd) | 1561 diff_text = bisect_utils.CheckRunGit(diff_command, cwd=self.src_cwd) |
| 1453 return (chromium_sha, ChangeBackslashToSlashInPatch(diff_text)) | 1562 return (chromium_sha, ChangeBackslashToSlashInPatch(diff_text)) |
| 1454 else: | 1563 else: |
| 1455 raise RuntimeError( | 1564 raise RuntimeError( |
| 1456 'Failed to update DEPS file for chromium: [%s]' % chromium_sha) | 1565 'Failed to update DEPS file for chromium: [%s]' % chromium_sha) |
| 1457 else: | 1566 else: |
| 1458 raise RuntimeError( | 1567 raise RuntimeError( |
| 1459 'DEPS checkout Failed for chromium revision : [%s]' % chromium_sha) | 1568 'DEPS checkout Failed for chromium revision : [%s]' % chromium_sha) |
| 1460 return (None, None) | 1569 return (None, None) |
| 1461 | 1570 |
| 1462 def BuildCurrentRevision(self, depot, revision=None): | 1571 def BuildCurrentRevision(self, depot, revision=None): |
| 1463 """Builds chrome and performance_ui_tests on the current revision. | 1572 """Builds chrome and performance_ui_tests on the current revision. |
| 1464 | 1573 |
| 1465 Returns: | 1574 Returns: |
| 1466 True if the build was successful. | 1575 True if the build was successful. |
| 1467 """ | 1576 """ |
| 1468 if self.opts.debug_ignore_build: | 1577 if self.opts.debug_ignore_build: |
| 1469 return True | 1578 return True |
| 1470 | 1579 |
| 1471 build_success = False | 1580 build_success = False |
| 1472 cwd = os.getcwd() | 1581 cwd = os.getcwd() |
| 1473 os.chdir(self.src_cwd) | 1582 os.chdir(self.src_cwd) |
| 1474 # Fetch build archive for the given revision from the cloud storage when | 1583 # Fetch build archive for the given revision from the cloud storage when |
| 1475 # the storage bucket is passed. | 1584 # the storage bucket is passed. |
| 1476 if self.IsDownloadable(depot) and revision: | 1585 if self.IsDownloadable(depot) and revision: |
| 1477 deps_patch = None | 1586 build_success = self.DownloadCurrentBuild(revision, depot) |
| 1478 if depot != 'chromium': | |
| 1479 # Create a DEPS patch with new revision for dependency repository. | |
| 1480 revision, deps_patch = self.CreateDEPSPatch(depot, revision) | |
| 1481 if self.DownloadCurrentBuild(revision, patch=deps_patch): | |
| 1482 if deps_patch: | |
| 1483 # Reverts the changes to DEPS file. | |
| 1484 self.source_control.CheckoutFileAtRevision( | |
| 1485 bisect_utils.FILE_DEPS, revision, cwd=self.src_cwd) | |
| 1486 build_success = True | |
| 1487 else: | 1587 else: |
| 1488 # These codes are executed when bisect bots builds binaries locally. | 1588 # These codes are executed when bisect bots builds binaries locally. |
| 1489 build_success = self.builder.Build(depot, self.opts) | 1589 build_success = self.builder.Build(depot, self.opts) |
| 1490 os.chdir(cwd) | 1590 os.chdir(cwd) |
| 1491 return build_success | 1591 return build_success |
| 1492 | 1592 |
| 1493 def RunGClientHooks(self): | 1593 def RunGClientHooks(self): |
| 1494 """Runs gclient with runhooks command. | 1594 """Runs gclient with runhooks command. |
| 1495 | 1595 |
| 1496 Returns: | 1596 Returns: |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1772 | 1872 |
| 1773 def _PerformPreSyncCleanup(self, depot): | 1873 def _PerformPreSyncCleanup(self, depot): |
| 1774 """Performs any necessary cleanup before syncing. | 1874 """Performs any necessary cleanup before syncing. |
| 1775 | 1875 |
| 1776 Args: | 1876 Args: |
| 1777 depot: Depot name. | 1877 depot: Depot name. |
| 1778 | 1878 |
| 1779 Returns: | 1879 Returns: |
| 1780 True if successful. | 1880 True if successful. |
| 1781 """ | 1881 """ |
| 1782 if depot == 'chromium' or depot == 'android-chrome': | 1882 if depot == 'cros': |
| 1783 # Removes third_party/libjingle. At some point, libjingle was causing | |
| 1784 # issues syncing when using the git workflow (crbug.com/266324). | |
| 1785 os.chdir(self.src_cwd) | |
| 1786 if not bisect_utils.RemoveThirdPartyDirectory('libjingle'): | |
| 1787 return False | |
| 1788 # Removes third_party/skia. At some point, skia was causing | |
| 1789 # issues syncing when using the git workflow (crbug.com/377951). | |
| 1790 if not bisect_utils.RemoveThirdPartyDirectory('skia'): | |
| 1791 return False | |
| 1792 elif depot == 'cros': | |
| 1793 return self.PerformCrosChrootCleanup() | 1883 return self.PerformCrosChrootCleanup() |
| 1794 return True | 1884 return True |
| 1795 | 1885 |
| 1796 def _RunPostSync(self, depot): | 1886 def _RunPostSync(self, depot): |
| 1797 """Performs any work after syncing. | 1887 """Performs any work after syncing. |
| 1798 | 1888 |
| 1799 Args: | 1889 Args: |
| 1800 depot: Depot name. | 1890 depot: Depot name. |
| 1801 | 1891 |
| 1802 Returns: | 1892 Returns: |
| (...skipping 1374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3177 # bugs. If you change this, please update the perf dashboard as well. | 3267 # bugs. If you change this, please update the perf dashboard as well. |
| 3178 bisect_utils.OutputAnnotationStepStart('Results') | 3268 bisect_utils.OutputAnnotationStepStart('Results') |
| 3179 print 'Error: %s' % e.message | 3269 print 'Error: %s' % e.message |
| 3180 if opts.output_buildbot_annotations: | 3270 if opts.output_buildbot_annotations: |
| 3181 bisect_utils.OutputAnnotationStepClosed() | 3271 bisect_utils.OutputAnnotationStepClosed() |
| 3182 return 1 | 3272 return 1 |
| 3183 | 3273 |
| 3184 | 3274 |
| 3185 if __name__ == '__main__': | 3275 if __name__ == '__main__': |
| 3186 sys.exit(main()) | 3276 sys.exit(main()) |
| OLD | NEW |