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 = None |
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 10 matching lines...) Expand all Loading... |
370 def InstallAPK(self, opts): | 379 def InstallAPK(self, opts): |
371 """Installs apk to device. | 380 """Installs apk to device. |
372 | 381 |
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', 'ChromiumTestShell.apk', '--apk_package', |
381 'org.chromium.content_shell_apk', '--release'] | 390 'org.chromium.chrome.testshell', '--release'] |
382 return_code = RunProcess(cmd) | 391 return_code = RunProcess(cmd) |
| 392 |
383 return not return_code | 393 return not return_code |
384 | 394 |
385 def Build(self, depot, opts): | 395 def Build(self, depot, opts): |
386 """Builds the android content shell and other necessary tools using options | 396 """Builds the android content shell and other necessary tools using options |
387 passed into the script. | 397 passed into the script. |
388 | 398 |
389 Args: | 399 Args: |
390 depot: Current depot being bisected. | 400 depot: Current depot being bisected. |
391 opts: The options parsed from the command line. | 401 opts: The options parsed from the command line. |
392 | 402 |
393 Returns: | 403 Returns: |
394 True if build was successful. | 404 True if build was successful. |
395 """ | 405 """ |
396 targets = ['content_shell_apk', 'forwarder2', 'md5sum'] | 406 targets = ['chromium_testshell', 'forwarder2', 'md5sum'] |
397 threads = 16 | 407 threads = None |
398 if opts.use_goma: | 408 if opts.use_goma: |
399 threads = 64 | 409 threads = 64 |
400 | 410 |
401 build_success = False | 411 build_success = False |
402 if opts.build_preference == 'ninja': | 412 if opts.build_preference == 'ninja': |
403 build_success = BuildWithNinja(threads, targets) | 413 build_success = BuildWithNinja(threads, targets) |
404 else: | 414 else: |
405 assert False, 'No build system defined.' | 415 assert False, 'No build system defined.' |
406 | 416 |
407 if build_success: | 417 if build_success: |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
518 | 528 |
519 ie. gclient sync --revision <revision> | 529 ie. gclient sync --revision <revision> |
520 | 530 |
521 Args: | 531 Args: |
522 revision: The git SHA1 or svn CL (depending on workflow). | 532 revision: The git SHA1 or svn CL (depending on workflow). |
523 | 533 |
524 Returns: | 534 Returns: |
525 The return code of the call. | 535 The return code of the call. |
526 """ | 536 """ |
527 return bisect_utils.RunGClient(['sync', '--revision', | 537 return bisect_utils.RunGClient(['sync', '--revision', |
528 revision, '--verbose']) | 538 revision, '--verbose', '--nohooks']) |
529 | 539 |
530 def SyncToRevisionWithRepo(self, timestamp): | 540 def SyncToRevisionWithRepo(self, timestamp): |
531 """Uses repo to sync all the underlying git depots to the specified | 541 """Uses repo to sync all the underlying git depots to the specified |
532 time. | 542 time. |
533 | 543 |
534 Args: | 544 Args: |
535 timestamp: The unix timestamp to sync to. | 545 timestamp: The unix timestamp to sync to. |
536 | 546 |
537 Returns: | 547 Returns: |
538 The return code of the call. | 548 The return code of the call. |
(...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1178 elif depot == 'cros': | 1188 elif depot == 'cros': |
1179 return self.PerformCrosChrootCleanup() | 1189 return self.PerformCrosChrootCleanup() |
1180 return True | 1190 return True |
1181 | 1191 |
1182 def RunPostSync(self, depot): | 1192 def RunPostSync(self, depot): |
1183 """Performs any work after syncing. | 1193 """Performs any work after syncing. |
1184 | 1194 |
1185 Returns: | 1195 Returns: |
1186 True if successful. | 1196 True if successful. |
1187 """ | 1197 """ |
| 1198 if self.opts.target_platform == 'android': |
| 1199 cwd = os.getcwd() |
| 1200 os.chdir(os.path.join(self.src_cwd, '..')) |
| 1201 if not bisect_utils.SetupAndroidBuildEnvironment(self.opts): |
| 1202 return False |
| 1203 os.chdir(cwd) |
| 1204 |
1188 if depot == 'cros': | 1205 if depot == 'cros': |
1189 return self.CreateCrosChroot() | 1206 return self.CreateCrosChroot() |
1190 else: | 1207 else: |
1191 return self.RunGClientHooks() | 1208 return self.RunGClientHooks() |
1192 return True | 1209 return True |
1193 | 1210 |
1194 def ShouldSkipRevision(self, depot, revision): | 1211 def ShouldSkipRevision(self, depot, revision): |
1195 """Some commits can be safely skipped (such as a DEPS roll), since the tool | 1212 """Some commits can be safely skipped (such as a DEPS roll), since the tool |
1196 is git based those changes would have no effect. | 1213 is git based those changes would have no effect. |
1197 | 1214 |
(...skipping 1133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2331 | 2348 |
2332 if not(bisect_results['error']): | 2349 if not(bisect_results['error']): |
2333 return 0 | 2350 return 0 |
2334 else: | 2351 else: |
2335 print 'Error: ' + bisect_results['error'] | 2352 print 'Error: ' + bisect_results['error'] |
2336 print | 2353 print |
2337 return 1 | 2354 return 1 |
2338 | 2355 |
2339 if __name__ == '__main__': | 2356 if __name__ == '__main__': |
2340 sys.exit(main()) | 2357 sys.exit(main()) |
OLD | NEW |