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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
256 . .---. \ \==) | 256 . .---. \ \==) |
257 . |PERF\ \ \\ | 257 . |PERF\ \ \\ |
258 . | ---------'-------'-----------. | 258 . | ---------'-------'-----------. |
259 . . 0 0 0 0 0 0 0 0 0 0 0 0 0 0 |_`-. | 259 . . 0 0 0 0 0 0 0 0 0 0 0 0 0 0 |_`-. |
260 . \_____________.-------._______________) | 260 . \_____________.-------._______________) |
261 . / / | 261 . / / |
262 . / / | 262 . / / |
263 . / /==) | 263 . / /==) |
264 . ._____.""" | 264 . ._____.""" |
265 | 265 |
266 # Git branch name used to run bisect try jobs. | |
267 BISECT_TRYJOB_BRANCH = 'bisect-tryjob' | |
268 # Git master branch name. | |
269 BISECT_MASTER_BRANCH = 'master' | |
270 # File to store 'git diff' content. | |
271 BISECT_PATCH_FILE = 'deps_patch.txt' | |
272 # SVN repo where the bisect try jobs are submitted. | |
273 SVN_REPO_URL = 'svn://svn.chromium.org/chrome-try/try-perf' | |
274 | |
275 class RunGitError(Exception): | |
276 | |
277 def __str__(self): | |
278 return '%s\nError executing git command.' % self.args[0] | |
279 | |
266 | 280 |
267 def _AddAdditionalDepotInfo(depot_info): | 281 def _AddAdditionalDepotInfo(depot_info): |
268 """Adds additional depot info to the global depot variables.""" | 282 """Adds additional depot info to the global depot variables.""" |
269 global DEPOT_DEPS_NAME | 283 global DEPOT_DEPS_NAME |
270 global DEPOT_NAMES | 284 global DEPOT_NAMES |
271 DEPOT_DEPS_NAME = dict(DEPOT_DEPS_NAME.items() + depot_info.items()) | 285 DEPOT_DEPS_NAME = dict(DEPOT_DEPS_NAME.items() + depot_info.items()) |
272 DEPOT_NAMES = DEPOT_DEPS_NAME.keys() | 286 DEPOT_NAMES = DEPOT_DEPS_NAME.keys() |
273 | 287 |
274 | 288 |
275 def GetSHA1HexDigest(contents): | 289 def GetSHA1HexDigest(contents): |
(...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
852 'was added without proper support?' % depot_name) | 866 'was added without proper support?' % depot_name) |
853 | 867 |
854 def ChangeToDepotDir(self, depot_name): | 868 def ChangeToDepotDir(self, depot_name): |
855 """Given a depot, changes to the appropriate working directory. | 869 """Given a depot, changes to the appropriate working directory. |
856 | 870 |
857 Args: | 871 Args: |
858 depot_name: The name of the depot (see DEPOT_NAMES). | 872 depot_name: The name of the depot (see DEPOT_NAMES). |
859 """ | 873 """ |
860 os.chdir(self.GetDepotDir(depot_name)) | 874 os.chdir(self.GetDepotDir(depot_name)) |
861 | 875 |
876 def _PrepareBisectBranch(parent_branch, new_branch): | |
877 """Creates a new branch to submit bisect try job. | |
878 | |
879 Args: | |
880 parent_branch: Parent branch to be used to create new branch. | |
881 new_branch: New branch name. | |
882 | |
883 Returns: | |
884 True if new branch is created succesfully, otherwise raises RunGitError | |
885 exception. | |
qyearsley
2014/09/27 01:45:33
No need to return anything if the lack of an excep
prasadv
2014/09/29 17:36:13
Done.
| |
886 """ | |
887 current_branch, returncode = bisect_utils.RunGit( | |
888 ['rev-parse', '--abbrev-ref', 'HEAD']) | |
889 if returncode: | |
890 raise RunGitError('Must be in a git repository to send changes to trybots.') | |
891 | |
892 current_branch = current_branch.strip() | |
893 # Make sure current branch is master. | |
894 if current_branch != parent_branch: | |
895 output, returncode = bisect_utils.RunGit(['checkout', '-f', parent_branch]) | |
896 if returncode: | |
897 raise RunGitError('Failed to checkout branch: %s.' % output) | |
898 | |
899 # Delete new branch if exists. | |
900 output, returncode = bisect_utils.RunGit(['branch', '--list' ]) | |
901 if new_branch in output: | |
902 output, returncode = bisect_utils.RunGit(['branch', '-D', new_branch]) | |
903 if returncode: | |
904 raise RunGitError('Deleting branch failed, %s', output) | |
905 | |
906 # Check if the tree is dirty: make sure the index is up to date and then | |
907 # run diff-index | |
qyearsley
2014/09/27 01:45:33
Nit: should add a period at the end of the sentenc
prasadv
2014/09/29 17:36:13
Correct it lists if we have any uncommitted change
| |
908 bisect_utils.RunGit(['update-index', '--refresh', '-q']) | |
909 output, returncode = bisect_utils.RunGit(['diff-index', 'HEAD']) | |
910 if output: | |
911 raise RunGitError('Cannot send a try job with a dirty tree.') | |
912 | |
913 # Create/check out the telemetry-tryjob branch, and edit the configs | |
914 # for the tryjob there. | |
915 output, returncode = bisect_utils.RunGit(['checkout', '-b', new_branch]) | |
916 if returncode: | |
917 raise RunGitError('Failed to checkout branch: %s.' % output) | |
918 | |
919 output, returncode = bisect_utils.RunGit( | |
920 ['branch', '--set-upstream-to', parent_branch]) | |
921 if returncode: | |
922 raise RunGitError('Error in git branch --set-upstream-to') | |
923 | |
924 return True | |
925 | |
926 | |
927 def _BuilderTryjob(git_revision, bot_name, bisect_job_name, patch=None): | |
928 """Attempts to run a tryjob from the current directory. | |
929 | |
930 Args: | |
931 git_revision: A Git hash revision. | |
932 bot_name: Name of the bisect bot to be used for try job. | |
933 bisect_job_name: Bisect try job name. | |
934 patch: A DEPS patch (used while bisecting 3rd party repositories). | |
935 | |
936 Returns: | |
937 True if a tryjob was sent otherwise raises RunGitError exception. | |
938 """ | |
939 if not patch: | |
940 raise RunGitError('No associated patch to try') | |
941 | |
942 try: | |
943 # Temporary branch for running tryjob. | |
944 _PrepareBisectBranch(BISECT_MASTER_BRANCH, BISECT_TRYJOB_BRANCH) | |
945 patch_content = '/dev/null' | |
946 # Create a temporary patch file, if it fails raise an exception. | |
947 if patch: | |
948 WriteStringToFile(patch, BISECT_PATCH_FILE) | |
949 patch_content = BISECT_PATCH_FILE | |
950 | |
951 try_cmd = ['try', | |
952 '-b', bot_name, | |
953 '-r', git_revision, | |
954 '-n', bisect_job_name, | |
955 '--svn_repo=%s' % SVN_REPO_URL, | |
956 '--diff=%s' % patch_content | |
957 ] | |
958 # Execute try job to build revision. | |
959 output, returncode = bisect_utils.RunGit(try_cmd) | |
960 | |
961 if returncode: | |
962 raise RunGitError('Could not execute tryjob: %s.\n Error: %s' % ( | |
963 'git %s' % ' '.join(try_cmd), output)) | |
964 print ('Try job successfully submitted.\n TryJob Details: %s\n%s' % ( | |
965 'git %s' % ' '.join(try_cmd), output)) | |
966 | |
967 finally: | |
968 # Delete patch file if exists | |
969 try: | |
970 os.remove(BISECT_PATCH_FILE) | |
971 except OSError as e: | |
972 if e.errno != errno.ENOENT: | |
973 raise | |
974 # Checkout master branch and delete bisect-tryjob branch. | |
975 bisect_utils.RunGit(['checkout', '-f', BISECT_MASTER_BRANCH]) | |
976 bisect_utils.RunGit(['branch', '-D', BISECT_TRYJOB_BRANCH]) | |
977 | |
978 return True | |
979 | |
862 | 980 |
863 class BisectPerformanceMetrics(object): | 981 class BisectPerformanceMetrics(object): |
864 """This class contains functionality to perform a bisection of a range of | 982 """This class contains functionality to perform a bisection of a range of |
865 revisions to narrow down where performance regressions may have occurred. | 983 revisions to narrow down where performance regressions may have occurred. |
866 | 984 |
867 The main entry-point is the Run method. | 985 The main entry-point is the Run method. |
868 """ | 986 """ |
869 | 987 |
870 def __init__(self, source_control, opts): | 988 def __init__(self, source_control, opts): |
871 super(BisectPerformanceMetrics, self).__init__() | 989 super(BisectPerformanceMetrics, self).__init__() |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1188 if not downloaded_archive: | 1306 if not downloaded_archive: |
1189 # Get commit position for the given SHA. | 1307 # Get commit position for the given SHA. |
1190 commit_position = self.source_control.GetCommitPosition(revision) | 1308 commit_position = self.source_control.GetCommitPosition(revision) |
1191 if commit_position: | 1309 if commit_position: |
1192 # Source archive file path on cloud storage using SVN revision. | 1310 # Source archive file path on cloud storage using SVN revision. |
1193 source_file = GetRemoteBuildPath( | 1311 source_file = GetRemoteBuildPath( |
1194 commit_position, self.opts.target_platform, target_arch, patch_sha) | 1312 commit_position, self.opts.target_platform, target_arch, patch_sha) |
1195 return FetchFromCloudStorage(gs_bucket, source_file, out_dir) | 1313 return FetchFromCloudStorage(gs_bucket, source_file, out_dir) |
1196 return downloaded_archive | 1314 return downloaded_archive |
1197 | 1315 |
1198 def DownloadCurrentBuild(self, revision, build_type='Release', patch=None): | 1316 def DownloadCurrentBuild(self, revision, depot, build_type='Release'): |
1199 """Downloads the build archive for the given revision. | 1317 """Downloads the build archive for the given revision. |
1200 | 1318 |
1201 Args: | 1319 Args: |
1202 revision: The Git revision to download or build. | 1320 revision: The Git revision to download or build. |
1203 build_type: Target build type ('Release', 'Debug', 'Release_x64' etc.) | 1321 build_type: Target build type ('Release', 'Debug', 'Release_x64' etc.) |
1204 patch: A DEPS patch (used while bisecting 3rd party repositories). | 1322 patch: A DEPS patch (used while bisecting 3rd party repositories). |
1205 | 1323 |
1206 Returns: | 1324 Returns: |
1207 True if download succeeds, otherwise False. | 1325 True if download succeeds, otherwise False. |
1208 """ | 1326 """ |
1327 patch = None | |
1209 patch_sha = None | 1328 patch_sha = None |
1329 if depot != 'chromium': | |
1330 # Create a DEPS patch with new revision for dependency repository. | |
1331 revision, patch = self.CreateDEPSPatch(depot, revision) | |
1332 | |
1210 if patch: | 1333 if patch: |
1211 # Get the SHA of the DEPS changes patch. | 1334 # Get the SHA of the DEPS changes patch. |
1212 patch_sha = GetSHA1HexDigest(patch) | 1335 patch_sha = GetSHA1HexDigest(patch) |
1213 | 1336 |
1214 # Update the DEPS changes patch with a patch to create a new file named | 1337 # Update the DEPS changes patch with a patch to create a new file named |
1215 # 'DEPS.sha' and add patch_sha evaluated above to it. | 1338 # 'DEPS.sha' and add patch_sha evaluated above to it. |
1216 patch = '%s\n%s' % (patch, DEPS_SHA_PATCH % {'deps_sha': patch_sha}) | 1339 patch = '%s\n%s' % (patch, DEPS_SHA_PATCH % {'deps_sha': patch_sha}) |
1217 | 1340 |
1218 # Get Build output directory | 1341 # Get Build output directory |
1219 abs_build_dir = os.path.abspath( | 1342 abs_build_dir = os.path.abspath( |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1296 if bisect_utils.IsLinuxHost(): | 1419 if bisect_utils.IsLinuxHost(): |
1297 if target_platform == 'android': | 1420 if target_platform == 'android': |
1298 return ('android_perf_bisect_builder', MAX_LINUX_BUILD_TIME) | 1421 return ('android_perf_bisect_builder', MAX_LINUX_BUILD_TIME) |
1299 return ('linux_perf_bisect_builder', MAX_LINUX_BUILD_TIME) | 1422 return ('linux_perf_bisect_builder', MAX_LINUX_BUILD_TIME) |
1300 if bisect_utils.IsMacHost(): | 1423 if bisect_utils.IsMacHost(): |
1301 return ('mac_perf_bisect_builder', MAX_MAC_BUILD_TIME) | 1424 return ('mac_perf_bisect_builder', MAX_MAC_BUILD_TIME) |
1302 raise NotImplementedError('Unsupported Platform "%s".' % sys.platform) | 1425 raise NotImplementedError('Unsupported Platform "%s".' % sys.platform) |
1303 if not fetch_build: | 1426 if not fetch_build: |
1304 return False | 1427 return False |
1305 | 1428 |
1306 bot_name, build_timeout = GetBuilderNameAndBuildTime( | |
1307 self.opts.target_platform, self.opts.target_arch) | |
1308 builder_host = self.opts.builder_host | |
1309 builder_port = self.opts.builder_port | |
1310 # Create a unique ID for each build request posted to try server builders. | 1429 # Create a unique ID for each build request posted to try server builders. |
1311 # This ID is added to "Reason" property of the build. | 1430 # This ID is added to "Reason" property of the build. |
1312 build_request_id = GetSHA1HexDigest( | 1431 build_request_id = GetSHA1HexDigest( |
1313 '%s-%s-%s' % (git_revision, patch, time.time())) | 1432 '%s-%s-%s' % (git_revision, patch, time.time())) |
1314 | 1433 |
1315 # Creates a try job description. | 1434 # Reverts any changes to DEPS file. |
1316 # Always use Git hash to post build request since Commit positions are | 1435 self.source_control.CheckoutFileAtRevision( |
1317 # not supported by builders to build. | 1436 bisect_utils.FILE_DEPS, git_revision, cwd=self.src_cwd) |
1318 job_args = { | 1437 |
1319 'revision': 'src@%s' % git_revision, | 1438 bot_name, build_timeout = GetBuilderNameAndBuildTime( |
1320 'bot': bot_name, | 1439 self.opts.target_platform, self.opts.target_arch) |
1321 'name': build_request_id, | 1440 target_file = None |
1322 } | 1441 try: |
1323 # Update patch information if supplied. | 1442 # Execute try job request to build revision with patch. |
1324 if patch: | 1443 _BuilderTryjob(git_revision, bot_name, build_request_id, patch) |
1325 job_args['patch'] = patch | |
1326 # Posts job to build the revision on the server. | |
1327 if request_build.PostTryJob(builder_host, builder_port, job_args): | |
1328 target_file, error_msg = _WaitUntilBuildIsReady( | 1444 target_file, error_msg = _WaitUntilBuildIsReady( |
1329 fetch_build, bot_name, builder_host, builder_port, build_request_id, | 1445 fetch_build, bot_name, self.opts.builder_host, |
1330 build_timeout) | 1446 self.opts.builder_port, build_request_id, build_timeout) |
1331 if not target_file: | 1447 if not target_file: |
1332 print '%s [revision: %s]' % (error_msg, git_revision) | 1448 print '%s [revision: %s]' % (error_msg, git_revision) |
1333 return None | 1449 except RunGitError, e: |
qyearsley
2014/09/27 01:45:33
The style guide suggests using "as", e.g. "except
| |
1334 return target_file | 1450 print ('Failed to post builder try job for revision: [%s].\n' |
1335 print 'Failed to post build request for revision: [%s]' % git_revision | 1451 'Error: %s' % (git_revision, e)) |
1336 return None | 1452 |
1453 return target_file | |
1337 | 1454 |
1338 def IsDownloadable(self, depot): | 1455 def IsDownloadable(self, depot): |
1339 """Checks if build can be downloaded based on target platform and depot.""" | 1456 """Checks if build can be downloaded based on target platform and depot.""" |
1340 if (self.opts.target_platform in ['chromium', 'android'] and | 1457 if (self.opts.target_platform in ['chromium', 'android'] and |
1341 self.opts.gs_bucket): | 1458 self.opts.gs_bucket): |
1342 return (depot == 'chromium' or | 1459 return (depot == 'chromium' or |
1343 'chromium' in DEPOT_DEPS_NAME[depot]['from'] or | 1460 'chromium' in DEPOT_DEPS_NAME[depot]['from'] or |
1344 'v8' in DEPOT_DEPS_NAME[depot]['from']) | 1461 'v8' in DEPOT_DEPS_NAME[depot]['from']) |
1345 return False | 1462 return False |
1346 | 1463 |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1423 updated_deps_content = self.UpdateDepsContents( | 1540 updated_deps_content = self.UpdateDepsContents( |
1424 deps_contents, depot, revision, deps_var) | 1541 deps_contents, depot, revision, deps_var) |
1425 # Write changes to DEPS file | 1542 # Write changes to DEPS file |
1426 if updated_deps_content: | 1543 if updated_deps_content: |
1427 WriteStringToFile(updated_deps_content, deps_file) | 1544 WriteStringToFile(updated_deps_content, deps_file) |
1428 return True | 1545 return True |
1429 except IOError, e: | 1546 except IOError, e: |
1430 print 'Something went wrong while updating DEPS file. [%s]' % e | 1547 print 'Something went wrong while updating DEPS file. [%s]' % e |
1431 return False | 1548 return False |
1432 | 1549 |
1550 | |
1433 def CreateDEPSPatch(self, depot, revision): | 1551 def CreateDEPSPatch(self, depot, revision): |
1434 """Modifies DEPS and returns diff as text. | 1552 """Modifies DEPS and returns diff as text. |
1435 | 1553 |
1436 Args: | 1554 Args: |
1437 depot: Current depot being bisected. | 1555 depot: Current depot being bisected. |
1438 revision: A git hash revision of the dependency repository. | 1556 revision: A git hash revision of the dependency repository. |
1439 | 1557 |
1440 Returns: | 1558 Returns: |
1441 A tuple with git hash of chromium revision and DEPS patch text. | 1559 A tuple with git hash of chromium revision and DEPS patch text. |
1442 """ | 1560 """ |
1443 deps_file_path = os.path.join(self.src_cwd, bisect_utils.FILE_DEPS) | 1561 deps_file_path = os.path.join(self.src_cwd, bisect_utils.FILE_DEPS) |
1444 if not os.path.exists(deps_file_path): | 1562 if not os.path.exists(deps_file_path): |
1445 raise RuntimeError('DEPS file does not exists.[%s]' % deps_file_path) | 1563 raise RuntimeError('DEPS file does not exists.[%s]' % deps_file_path) |
1446 # Get current chromium revision (git hash). | 1564 # Get current chromium revision (git hash). |
1447 cmd = ['rev-parse', 'HEAD'] | 1565 cmd = ['rev-parse', 'HEAD'] |
1448 chromium_sha = bisect_utils.CheckRunGit(cmd).strip() | 1566 chromium_sha = bisect_utils.CheckRunGit(cmd).strip() |
1449 if not chromium_sha: | 1567 if not chromium_sha: |
1450 raise RuntimeError('Failed to determine Chromium revision for %s' % | 1568 raise RuntimeError('Failed to determine Chromium revision for %s' % |
1451 revision) | 1569 revision) |
1452 if ('chromium' in DEPOT_DEPS_NAME[depot]['from'] or | 1570 if ('chromium' in DEPOT_DEPS_NAME[depot]['from'] or |
1453 'v8' in DEPOT_DEPS_NAME[depot]['from']): | 1571 'v8' in DEPOT_DEPS_NAME[depot]['from']): |
1454 # Checkout DEPS file for the current chromium revision. | 1572 # Checkout DEPS file for the current chromium revision. |
1455 if self.source_control.CheckoutFileAtRevision( | 1573 if self.source_control.CheckoutFileAtRevision( |
1456 bisect_utils.FILE_DEPS, chromium_sha, cwd=self.src_cwd): | 1574 bisect_utils.FILE_DEPS, chromium_sha, cwd=self.src_cwd): |
1457 if self.UpdateDeps(revision, depot, deps_file_path): | 1575 if self.UpdateDeps(revision, depot, deps_file_path): |
1458 diff_command = [ | 1576 diff_command = [ |
1459 'diff', | 1577 'diff', |
1460 '--src-prefix=src/', | 1578 '--src-prefix=', |
1461 '--dst-prefix=src/', | 1579 '--dst-prefix=', |
1462 '--no-ext-diff', | 1580 '--no-ext-diff', |
1463 bisect_utils.FILE_DEPS, | 1581 bisect_utils.FILE_DEPS, |
1464 ] | 1582 ] |
1465 diff_text = bisect_utils.CheckRunGit(diff_command, cwd=self.src_cwd) | 1583 diff_text = bisect_utils.CheckRunGit(diff_command, cwd=self.src_cwd) |
1466 return (chromium_sha, ChangeBackslashToSlashInPatch(diff_text)) | 1584 return (chromium_sha, ChangeBackslashToSlashInPatch(diff_text)) |
1467 else: | 1585 else: |
1468 raise RuntimeError( | 1586 raise RuntimeError( |
1469 'Failed to update DEPS file for chromium: [%s]' % chromium_sha) | 1587 'Failed to update DEPS file for chromium: [%s]' % chromium_sha) |
1470 else: | 1588 else: |
1471 raise RuntimeError( | 1589 raise RuntimeError( |
1472 'DEPS checkout Failed for chromium revision : [%s]' % chromium_sha) | 1590 'DEPS checkout Failed for chromium revision : [%s]' % chromium_sha) |
1473 return (None, None) | 1591 return (None, None) |
1474 | 1592 |
1475 def BuildCurrentRevision(self, depot, revision=None): | 1593 def BuildCurrentRevision(self, depot, revision=None): |
1476 """Builds chrome and performance_ui_tests on the current revision. | 1594 """Builds chrome and performance_ui_tests on the current revision. |
1477 | 1595 |
1478 Returns: | 1596 Returns: |
1479 True if the build was successful. | 1597 True if the build was successful. |
1480 """ | 1598 """ |
1481 if self.opts.debug_ignore_build: | 1599 if self.opts.debug_ignore_build: |
1482 return True | 1600 return True |
1483 | 1601 |
1484 build_success = False | 1602 build_success = False |
1485 cwd = os.getcwd() | 1603 cwd = os.getcwd() |
1486 os.chdir(self.src_cwd) | 1604 os.chdir(self.src_cwd) |
1487 # Fetch build archive for the given revision from the cloud storage when | 1605 # Fetch build archive for the given revision from the cloud storage when |
1488 # the storage bucket is passed. | 1606 # the storage bucket is passed. |
1489 if self.IsDownloadable(depot) and revision: | 1607 if self.IsDownloadable(depot) and revision: |
1490 deps_patch = None | 1608 build_success = self.DownloadCurrentBuild(revision, depot) |
1491 if depot != 'chromium': | |
1492 # Create a DEPS patch with new revision for dependency repository. | |
1493 revision, deps_patch = self.CreateDEPSPatch(depot, revision) | |
1494 if self.DownloadCurrentBuild(revision, patch=deps_patch): | |
1495 if deps_patch: | |
1496 # Reverts the changes to DEPS file. | |
1497 self.source_control.CheckoutFileAtRevision( | |
1498 bisect_utils.FILE_DEPS, revision, cwd=self.src_cwd) | |
1499 build_success = True | |
1500 else: | 1609 else: |
1501 # These codes are executed when bisect bots builds binaries locally. | 1610 # These codes are executed when bisect bots builds binaries locally. |
1502 build_success = self.builder.Build(depot, self.opts) | 1611 build_success = self.builder.Build(depot, self.opts) |
1503 os.chdir(cwd) | 1612 os.chdir(cwd) |
1504 return build_success | 1613 return build_success |
1505 | 1614 |
1506 def RunGClientHooks(self): | 1615 def RunGClientHooks(self): |
1507 """Runs gclient with runhooks command. | 1616 """Runs gclient with runhooks command. |
1508 | 1617 |
1509 Returns: | 1618 Returns: |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1785 | 1894 |
1786 def _PerformPreSyncCleanup(self, depot): | 1895 def _PerformPreSyncCleanup(self, depot): |
1787 """Performs any necessary cleanup before syncing. | 1896 """Performs any necessary cleanup before syncing. |
1788 | 1897 |
1789 Args: | 1898 Args: |
1790 depot: Depot name. | 1899 depot: Depot name. |
1791 | 1900 |
1792 Returns: | 1901 Returns: |
1793 True if successful. | 1902 True if successful. |
1794 """ | 1903 """ |
1795 if depot == 'chromium' or depot == 'android-chrome': | 1904 if depot == 'cros': |
1796 # Removes third_party/libjingle. At some point, libjingle was causing | |
1797 # issues syncing when using the git workflow (crbug.com/266324). | |
1798 os.chdir(self.src_cwd) | |
1799 if not bisect_utils.RemoveThirdPartyDirectory('libjingle'): | |
1800 return False | |
1801 # Removes third_party/skia. At some point, skia was causing | |
1802 # issues syncing when using the git workflow (crbug.com/377951). | |
1803 if not bisect_utils.RemoveThirdPartyDirectory('skia'): | |
1804 return False | |
1805 elif depot == 'cros': | |
1806 return self.PerformCrosChrootCleanup() | 1905 return self.PerformCrosChrootCleanup() |
1807 return True | 1906 return True |
1808 | 1907 |
1809 def _RunPostSync(self, depot): | 1908 def _RunPostSync(self, depot): |
1810 """Performs any work after syncing. | 1909 """Performs any work after syncing. |
1811 | 1910 |
1812 Args: | 1911 Args: |
1813 depot: Depot name. | 1912 depot: Depot name. |
1814 | 1913 |
1815 Returns: | 1914 Returns: |
(...skipping 1364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3180 # bugs. If you change this, please update the perf dashboard as well. | 3279 # bugs. If you change this, please update the perf dashboard as well. |
3181 bisect_utils.OutputAnnotationStepStart('Results') | 3280 bisect_utils.OutputAnnotationStepStart('Results') |
3182 print 'Error: %s' % e.message | 3281 print 'Error: %s' % e.message |
3183 if opts.output_buildbot_annotations: | 3282 if opts.output_buildbot_annotations: |
3184 bisect_utils.OutputAnnotationStepClosed() | 3283 bisect_utils.OutputAnnotationStepClosed() |
3185 return 1 | 3284 return 1 |
3186 | 3285 |
3187 | 3286 |
3188 if __name__ == '__main__': | 3287 if __name__ == '__main__': |
3189 sys.exit(main()) | 3288 sys.exit(main()) |
OLD | NEW |