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 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 287 A tuple of the output and return code. | 287 A tuple of the output and return code. |
| 288 """ | 288 """ |
| 289 (output, return_code) = RunGit(command) | 289 (output, return_code) = RunGit(command) |
| 290 | 290 |
| 291 assert not return_code, 'An error occurred while running'\ | 291 assert not return_code, 'An error occurred while running'\ |
| 292 ' "git %s"' % ' '.join(command) | 292 ' "git %s"' % ' '.join(command) |
| 293 return output | 293 return output |
| 294 | 294 |
| 295 | 295 |
| 296 def BuildWithMake(threads, targets): | 296 def BuildWithMake(threads, targets): |
| 297 cmd = ['make', 'BUILDTYPE=Release', '-j%d' % threads] + targets | 297 cmd = ['make', 'BUILDTYPE=Release'] |
| 298 | |
| 299 if threads: | |
| 300 cmd.append('-j%d' % threads) | |
| 301 | |
| 302 cmd += targets | |
| 298 | 303 |
| 299 return_code = RunProcess(cmd) | 304 return_code = RunProcess(cmd) |
| 300 | 305 |
| 301 return not return_code | 306 return not return_code |
| 302 | 307 |
| 303 | 308 |
| 304 def BuildWithNinja(threads, targets): | 309 def BuildWithNinja(threads, targets): |
| 305 cmd = ['ninja', '-C', os.path.join('out', 'Release'), | 310 cmd = ['ninja', '-C', os.path.join('out', 'Release')] |
| 306 '-j%d' % threads] + targets | 311 |
| 312 if threads: | |
| 313 cmd.append('-j%d' % threads) | |
| 314 | |
| 315 cmd += targets | |
| 307 | 316 |
| 308 return_code = RunProcess(cmd) | 317 return_code = RunProcess(cmd) |
| 309 | 318 |
| 310 return not return_code | 319 return not return_code |
| 311 | 320 |
| 312 | 321 |
| 313 def BuildWithVisualStudio(targets): | 322 def BuildWithVisualStudio(targets): |
| 314 path_to_devenv = os.path.abspath( | 323 path_to_devenv = os.path.abspath( |
| 315 os.path.join(os.environ['VS100COMNTOOLS'], '..', 'IDE', 'devenv.com')) | 324 os.path.join(os.environ['VS100COMNTOOLS'], '..', 'IDE', 'devenv.com')) |
| 316 path_to_sln = os.path.join(os.getcwd(), 'chrome', 'chrome.sln') | 325 path_to_sln = os.path.join(os.getcwd(), 'chrome', 'chrome.sln') |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 339 | 348 |
| 340 Args: | 349 Args: |
| 341 depot: Current depot being bisected. | 350 depot: Current depot being bisected. |
| 342 opts: The options parsed from the command line. | 351 opts: The options parsed from the command line. |
| 343 | 352 |
| 344 Returns: | 353 Returns: |
| 345 True if build was successful. | 354 True if build was successful. |
| 346 """ | 355 """ |
| 347 targets = ['chrome', 'performance_ui_tests'] | 356 targets = ['chrome', 'performance_ui_tests'] |
| 348 | 357 |
| 349 threads = 16 | 358 threads = 0 |
|
tonyg
2013/07/11 01:34:28
None instead of 0?
shatch
2013/07/11 20:51:06
Done.
| |
| 350 if opts.use_goma: | 359 if opts.use_goma: |
| 351 threads = 64 | 360 threads = 64 |
| 352 | 361 |
| 353 build_success = False | 362 build_success = False |
| 354 if opts.build_preference == 'make': | 363 if opts.build_preference == 'make': |
| 355 build_success = BuildWithMake(threads, targets) | 364 build_success = BuildWithMake(threads, targets) |
| 356 elif opts.build_preference == 'ninja': | 365 elif opts.build_preference == 'ninja': |
| 357 if IsWindows(): | 366 if IsWindows(): |
| 358 targets = [t + '.exe' for t in targets] | 367 targets = [t + '.exe' for t in targets] |
| 359 build_success = BuildWithNinja(threads, targets) | 368 build_success = BuildWithNinja(threads, targets) |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 373 Args: | 382 Args: |
| 374 opts: The options parsed from the command line. | 383 opts: The options parsed from the command line. |
| 375 | 384 |
| 376 Returns: | 385 Returns: |
| 377 True if successful. | 386 True if successful. |
| 378 """ | 387 """ |
| 379 path_to_tool = os.path.join('build', 'android', 'adb_install_apk.py') | 388 path_to_tool = os.path.join('build', 'android', 'adb_install_apk.py') |
| 380 cmd = [path_to_tool, '--apk', 'ContentShell.apk', '--apk_package', | 389 cmd = [path_to_tool, '--apk', 'ContentShell.apk', '--apk_package', |
| 381 'org.chromium.content_shell_apk', '--release'] | 390 'org.chromium.content_shell_apk', '--release'] |
| 382 return_code = RunProcess(cmd) | 391 return_code = RunProcess(cmd) |
| 392 | |
| 393 if not return_code: | |
| 394 cmd = [path_to_tool, '--apk', 'ChromiumTestShell.apk', '--apk_package', | |
| 395 'org.chromium.chrome.testshell', '--release'] | |
| 396 return_code = RunProcess(cmd) | |
| 397 | |
| 383 return not return_code | 398 return not return_code |
| 384 | 399 |
| 385 def Build(self, depot, opts): | 400 def Build(self, depot, opts): |
| 386 """Builds the android content shell and other necessary tools using options | 401 """Builds the android content shell and other necessary tools using options |
| 387 passed into the script. | 402 passed into the script. |
| 388 | 403 |
| 389 Args: | 404 Args: |
| 390 depot: Current depot being bisected. | 405 depot: Current depot being bisected. |
| 391 opts: The options parsed from the command line. | 406 opts: The options parsed from the command line. |
| 392 | 407 |
| 393 Returns: | 408 Returns: |
| 394 True if build was successful. | 409 True if build was successful. |
| 395 """ | 410 """ |
| 396 targets = ['content_shell_apk', 'forwarder2', 'md5sum'] | 411 targets = ['chromium_testshell', 'content_shell_apk', 'forwarder2', |
|
tonyg
2013/07/11 01:34:28
I think the target is chromium_testshell_test_apk,
bulach
2013/07/11 14:52:58
drive-by:
chromium_testshell is the "app", that is
shatch
2013/07/11 20:51:06
Ok, so chromium_testshell is the correct one to bu
shatch
2013/07/11 20:51:06
Done.
| |
| 397 threads = 16 | 412 'md5sum'] |
| 413 threads = 0 | |
| 398 if opts.use_goma: | 414 if opts.use_goma: |
| 399 threads = 64 | 415 threads = 64 |
| 400 | 416 |
| 401 build_success = False | 417 build_success = False |
| 402 if opts.build_preference == 'ninja': | 418 if opts.build_preference == 'ninja': |
| 403 build_success = BuildWithNinja(threads, targets) | 419 build_success = BuildWithNinja(threads, targets) |
| 404 else: | 420 else: |
| 405 assert False, 'No build system defined.' | 421 assert False, 'No build system defined.' |
| 406 | 422 |
| 407 if build_success: | 423 if build_success: |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 518 | 534 |
| 519 ie. gclient sync --revision <revision> | 535 ie. gclient sync --revision <revision> |
| 520 | 536 |
| 521 Args: | 537 Args: |
| 522 revision: The git SHA1 or svn CL (depending on workflow). | 538 revision: The git SHA1 or svn CL (depending on workflow). |
| 523 | 539 |
| 524 Returns: | 540 Returns: |
| 525 The return code of the call. | 541 The return code of the call. |
| 526 """ | 542 """ |
| 527 return bisect_utils.RunGClient(['sync', '--revision', | 543 return bisect_utils.RunGClient(['sync', '--revision', |
| 528 revision, '--verbose']) | 544 revision, '--verbose', '--nohooks']) |
| 529 | 545 |
| 530 def SyncToRevisionWithRepo(self, timestamp): | 546 def SyncToRevisionWithRepo(self, timestamp): |
| 531 """Uses repo to sync all the underlying git depots to the specified | 547 """Uses repo to sync all the underlying git depots to the specified |
| 532 time. | 548 time. |
| 533 | 549 |
| 534 Args: | 550 Args: |
| 535 timestamp: The unix timestamp to sync to. | 551 timestamp: The unix timestamp to sync to. |
| 536 | 552 |
| 537 Returns: | 553 Returns: |
| 538 The return code of the call. | 554 The return code of the call. |
| (...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1178 elif depot == 'cros': | 1194 elif depot == 'cros': |
| 1179 return self.PerformCrosChrootCleanup() | 1195 return self.PerformCrosChrootCleanup() |
| 1180 return True | 1196 return True |
| 1181 | 1197 |
| 1182 def RunPostSync(self, depot): | 1198 def RunPostSync(self, depot): |
| 1183 """Performs any work after syncing. | 1199 """Performs any work after syncing. |
| 1184 | 1200 |
| 1185 Returns: | 1201 Returns: |
| 1186 True if successful. | 1202 True if successful. |
| 1187 """ | 1203 """ |
| 1204 if self.opts.target_platform == 'android': | |
| 1205 cwd = os.getcwd() | |
| 1206 os.chdir(os.path.join(self.src_cwd, '..')) | |
| 1207 if not bisect_utils.SetupAndroidBuildEnvironment(self.opts): | |
| 1208 return False | |
| 1209 os.chdir(cwd) | |
| 1210 | |
| 1188 if depot == 'cros': | 1211 if depot == 'cros': |
| 1189 return self.CreateCrosChroot() | 1212 return self.CreateCrosChroot() |
| 1190 else: | 1213 else: |
| 1191 return self.RunGClientHooks() | 1214 return self.RunGClientHooks() |
| 1192 return True | 1215 return True |
| 1193 | 1216 |
| 1194 def ShouldSkipRevision(self, depot, revision): | 1217 def ShouldSkipRevision(self, depot, revision): |
| 1195 """Some commits can be safely skipped (such as a DEPS roll), since the tool | 1218 """Some commits can be safely skipped (such as a DEPS roll), since the tool |
| 1196 is git based those changes would have no effect. | 1219 is git based those changes would have no effect. |
| 1197 | 1220 |
| (...skipping 1133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2331 | 2354 |
| 2332 if not(bisect_results['error']): | 2355 if not(bisect_results['error']): |
| 2333 return 0 | 2356 return 0 |
| 2334 else: | 2357 else: |
| 2335 print 'Error: ' + bisect_results['error'] | 2358 print 'Error: ' + bisect_results['error'] |
| 2336 print | 2359 print |
| 2337 return 1 | 2360 return 1 |
| 2338 | 2361 |
| 2339 if __name__ == '__main__': | 2362 if __name__ == '__main__': |
| 2340 sys.exit(main()) | 2363 sys.exit(main()) |
| OLD | NEW |