| 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 import collections | 6 import collections |
| 7 import glob | 7 import glob |
| 8 import hashlib | 8 import hashlib |
| 9 import json | 9 import json |
| 10 import os | 10 import os |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 'AndroidWebViewTest', | 74 'AndroidWebViewTest', |
| 75 'webview:android_webview/test/data/device_files'), | 75 'webview:android_webview/test/data/device_files'), |
| 76 I('ChromeSyncShell', | 76 I('ChromeSyncShell', |
| 77 'ChromeSyncShell.apk', | 77 'ChromeSyncShell.apk', |
| 78 'org.chromium.chrome.browser.sync', | 78 'org.chromium.chrome.browser.sync', |
| 79 'ChromeSyncShellTest', | 79 'ChromeSyncShellTest', |
| 80 None), | 80 None), |
| 81 ]) | 81 ]) |
| 82 | 82 |
| 83 VALID_TESTS = set(['chromedriver', 'chrome_proxy', 'gpu', | 83 VALID_TESTS = set(['chromedriver', 'chrome_proxy', 'gpu', |
| 84 'telemetry_perf_unittests', 'ui', 'unit', 'webkit', | 84 'telemetry_unittests', 'telemetry_perf_unittests', 'ui', |
| 85 'webkit_layout', 'python_unittests']) | 85 'unit', 'webkit', 'webkit_layout', 'python_unittests']) |
| 86 | 86 |
| 87 RunCmd = bb_utils.RunCmd | 87 RunCmd = bb_utils.RunCmd |
| 88 | 88 |
| 89 | 89 |
| 90 def _GetRevision(options): | 90 def _GetRevision(options): |
| 91 """Get the SVN revision number. | 91 """Get the SVN revision number. |
| 92 | 92 |
| 93 Args: | 93 Args: |
| 94 options: options object. | 94 options: options object. |
| 95 | 95 |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 """ | 183 """ |
| 184 InstallApk(options, INSTRUMENTATION_TESTS['ChromeShell'], False) | 184 InstallApk(options, INSTRUMENTATION_TESTS['ChromeShell'], False) |
| 185 args = ['--browser', 'android-chrome-shell'] | 185 args = ['--browser', 'android-chrome-shell'] |
| 186 devices = android_commands.GetAttachedDevices() | 186 devices = android_commands.GetAttachedDevices() |
| 187 if devices: | 187 if devices: |
| 188 args = args + ['--device', devices[0]] | 188 args = args + ['--device', devices[0]] |
| 189 bb_annotations.PrintNamedStep('chrome_proxy') | 189 bb_annotations.PrintNamedStep('chrome_proxy') |
| 190 RunCmd(['tools/chrome_proxy/run_tests'] + args) | 190 RunCmd(['tools/chrome_proxy/run_tests'] + args) |
| 191 | 191 |
| 192 | 192 |
| 193 def RunTelemetryPerfUnitTests(options): | 193 def RunTelemetryTests(options, step_name, run_tests_path): |
| 194 """Runs the telemetry perf unit tests. | 194 """Runs either telemetry_perf_unittests or telemetry_unittests. |
| 195 | 195 |
| 196 Args: | 196 Args: |
| 197 options: options object. | 197 options: options object. |
| 198 step_name: either 'telemetry_unittests' or 'telemetry_perf_unittests' |
| 199 run_tests_path: path to run_tests script (tools/perf/run_tests for |
| 200 perf_unittests and tools/telemetry/run_tests for |
| 201 telemetry_unittests) |
| 198 """ | 202 """ |
| 199 InstallApk(options, INSTRUMENTATION_TESTS['ChromeShell'], False) | 203 InstallApk(options, INSTRUMENTATION_TESTS['ChromeShell'], False) |
| 200 args = ['--browser', 'android-chrome-shell'] | 204 args = ['--browser', 'android-chrome-shell'] |
| 201 devices = android_commands.GetAttachedDevices() | 205 devices = android_commands.GetAttachedDevices() |
| 202 if devices: | 206 if devices: |
| 203 args = args + ['--device', devices[0]] | 207 args = args + ['--device', devices[0]] |
| 204 bb_annotations.PrintNamedStep('telemetry_perf_unittests') | 208 bb_annotations.PrintNamedStep(step_name) |
| 205 RunCmd(['tools/perf/run_tests'] + args) | 209 RunCmd([run_tests_path] + args) |
| 206 | 210 |
| 207 | 211 |
| 208 def InstallApk(options, test, print_step=False): | 212 def InstallApk(options, test, print_step=False): |
| 209 """Install an apk to all phones. | 213 """Install an apk to all phones. |
| 210 | 214 |
| 211 Args: | 215 Args: |
| 212 options: options object | 216 options: options object |
| 213 test: An I_TEST namedtuple | 217 test: An I_TEST namedtuple |
| 214 print_step: Print a buildbot step | 218 print_step: Print a buildbot step |
| 215 """ | 219 """ |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 465 | 469 |
| 466 | 470 |
| 467 def RunUnitTests(options): | 471 def RunUnitTests(options): |
| 468 suites = gtest_config.STABLE_TEST_SUITES | 472 suites = gtest_config.STABLE_TEST_SUITES |
| 469 if options.asan: | 473 if options.asan: |
| 470 suites = [s for s in suites | 474 suites = [s for s in suites |
| 471 if s not in gtest_config.ASAN_EXCLUDED_TEST_SUITES] | 475 if s not in gtest_config.ASAN_EXCLUDED_TEST_SUITES] |
| 472 RunTestSuites(options, suites) | 476 RunTestSuites(options, suites) |
| 473 | 477 |
| 474 | 478 |
| 479 def RunTelemetryUnitTests(options): |
| 480 RunTelemetryTests(options, 'telemetry_unittests', 'tools/telemetry/run_tests') |
| 481 |
| 482 |
| 483 def RunTelemetryPerfUnitTests(options): |
| 484 RunTelemetryTests(options, 'telemetry_perf_unittests', 'tools/perf/run_tests') |
| 485 |
| 486 |
| 475 def RunInstrumentationTests(options): | 487 def RunInstrumentationTests(options): |
| 476 for test in INSTRUMENTATION_TESTS.itervalues(): | 488 for test in INSTRUMENTATION_TESTS.itervalues(): |
| 477 RunInstrumentationSuite(options, test) | 489 RunInstrumentationSuite(options, test) |
| 478 | 490 |
| 479 | 491 |
| 480 def RunWebkitTests(options): | 492 def RunWebkitTests(options): |
| 481 RunTestSuites(options, ['webkit_unit_tests', 'blink_heap_unittests']) | 493 RunTestSuites(options, ['webkit_unit_tests', 'blink_heap_unittests']) |
| 482 RunWebkitLint() | 494 RunWebkitLint() |
| 483 | 495 |
| 484 | 496 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 522 bb_annotations.PrintNamedStep(suite) | 534 bb_annotations.PrintNamedStep(suite) |
| 523 RunCmd(['build/android/test_runner.py', 'python', '-s', suite]) | 535 RunCmd(['build/android/test_runner.py', 'python', '-s', suite]) |
| 524 | 536 |
| 525 | 537 |
| 526 def GetTestStepCmds(): | 538 def GetTestStepCmds(): |
| 527 return [ | 539 return [ |
| 528 ('chromedriver', RunChromeDriverTests), | 540 ('chromedriver', RunChromeDriverTests), |
| 529 ('chrome_proxy', RunChromeProxyTests), | 541 ('chrome_proxy', RunChromeProxyTests), |
| 530 ('gpu', RunGPUTests), | 542 ('gpu', RunGPUTests), |
| 531 ('python_unittests', RunPythonUnitTests), | 543 ('python_unittests', RunPythonUnitTests), |
| 544 ('telemetry_unittests', RunTelemetryUnitTests), |
| 532 ('telemetry_perf_unittests', RunTelemetryPerfUnitTests), | 545 ('telemetry_perf_unittests', RunTelemetryPerfUnitTests), |
| 533 ('ui', RunInstrumentationTests), | 546 ('ui', RunInstrumentationTests), |
| 534 ('unit', RunUnitTests), | 547 ('unit', RunUnitTests), |
| 535 ('webkit', RunWebkitTests), | 548 ('webkit', RunWebkitTests), |
| 536 ('webkit_layout', RunWebkitLayoutTests), | 549 ('webkit_layout', RunWebkitLayoutTests), |
| 537 ] | 550 ] |
| 538 | 551 |
| 539 | 552 |
| 540 def MakeGSPath(options, gs_base_dir): | 553 def MakeGSPath(options, gs_base_dir): |
| 541 revision = _GetRevision(options) | 554 revision = _GetRevision(options) |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 575 '--metadata-dir', os.path.join(CHROME_OUT_DIR, options.target), | 588 '--metadata-dir', os.path.join(CHROME_OUT_DIR, options.target), |
| 576 '--cleanup', | 589 '--cleanup', |
| 577 '--output', os.path.join(coverage_html, 'index.html')]) | 590 '--output', os.path.join(coverage_html, 'index.html')]) |
| 578 return coverage_html | 591 return coverage_html |
| 579 | 592 |
| 580 | 593 |
| 581 def LogcatDump(options): | 594 def LogcatDump(options): |
| 582 # Print logcat, kill logcat monitor | 595 # Print logcat, kill logcat monitor |
| 583 bb_annotations.PrintNamedStep('logcat_dump') | 596 bb_annotations.PrintNamedStep('logcat_dump') |
| 584 logcat_file = os.path.join(CHROME_OUT_DIR, options.target, 'full_log.txt') | 597 logcat_file = os.path.join(CHROME_OUT_DIR, options.target, 'full_log.txt') |
| 585 RunCmd([SrcPath('build' , 'android', 'adb_logcat_printer.py'), | 598 RunCmd([SrcPath('build', 'android', 'adb_logcat_printer.py'), |
| 586 '--output-path', logcat_file, LOGCAT_DIR]) | 599 '--output-path', logcat_file, LOGCAT_DIR]) |
| 587 gs_path = MakeGSPath(options, 'chromium-android/logcat_dumps') | 600 gs_path = MakeGSPath(options, 'chromium-android/logcat_dumps') |
| 588 RunCmd([bb_utils.GSUTIL_PATH, 'cp', '-z', 'txt', logcat_file, | 601 RunCmd([bb_utils.GSUTIL_PATH, 'cp', '-z', 'txt', logcat_file, |
| 589 'gs://%s' % gs_path]) | 602 'gs://%s' % gs_path]) |
| 590 bb_annotations.PrintLink('logcat dump', '%s/%s' % (GS_AUTH_URL, gs_path)) | 603 bb_annotations.PrintLink('logcat dump', '%s/%s' % (GS_AUTH_URL, gs_path)) |
| 591 | 604 |
| 592 | 605 |
| 593 def RunStackToolSteps(options): | 606 def RunStackToolSteps(options): |
| 594 """Run stack tool steps. | 607 """Run stack tool steps. |
| 595 | 608 |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 686 parser.add_option( | 699 parser.add_option( |
| 687 '--logcat-dump-output', | 700 '--logcat-dump-output', |
| 688 help='The logcat dump output will be "tee"-ed into this file') | 701 help='The logcat dump output will be "tee"-ed into this file') |
| 689 # During processing perf bisects, a seperate working directory created under | 702 # During processing perf bisects, a seperate working directory created under |
| 690 # which builds are produced. Therefore we should look for relevent output | 703 # which builds are produced. Therefore we should look for relevent output |
| 691 # file under this directory.(/b/build/slave/<slave_name>/build/bisect/src/out) | 704 # file under this directory.(/b/build/slave/<slave_name>/build/bisect/src/out) |
| 692 parser.add_option( | 705 parser.add_option( |
| 693 '--chrome-output-dir', | 706 '--chrome-output-dir', |
| 694 help='Chrome output directory to be used while bisecting.') | 707 help='Chrome output directory to be used while bisecting.') |
| 695 | 708 |
| 696 parser.add_option('--disable-stack-tool', action='store_true', | 709 parser.add_option('--disable-stack-tool', action='store_true', |
| 697 help='Do not run stack tool.') | 710 help='Do not run stack tool.') |
| 698 parser.add_option('--asan-symbolize', action='store_true', | 711 parser.add_option('--asan-symbolize', action='store_true', |
| 699 help='Run stack tool for ASAN') | 712 help='Run stack tool for ASAN') |
| 700 parser.add_option('--cleanup', action='store_true', | 713 parser.add_option('--cleanup', action='store_true', |
| 701 help='Delete out/<target> directory at the end of the run.') | 714 help='Delete out/<target> directory at the end of the run.') |
| 702 return parser | 715 return parser |
| 703 | 716 |
| 704 | 717 |
| 705 def main(argv): | 718 def main(argv): |
| 706 parser = GetDeviceStepsOptParser() | 719 parser = GetDeviceStepsOptParser() |
| 707 options, args = parser.parse_args(argv[1:]) | 720 options, args = parser.parse_args(argv[1:]) |
| 708 | 721 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 723 | 736 |
| 724 if options.coverage_bucket: | 737 if options.coverage_bucket: |
| 725 setattr(options, 'coverage_dir', | 738 setattr(options, 'coverage_dir', |
| 726 os.path.join(CHROME_OUT_DIR, options.target, 'coverage')) | 739 os.path.join(CHROME_OUT_DIR, options.target, 'coverage')) |
| 727 | 740 |
| 728 MainTestWrapper(options) | 741 MainTestWrapper(options) |
| 729 | 742 |
| 730 | 743 |
| 731 if __name__ == '__main__': | 744 if __name__ == '__main__': |
| 732 sys.exit(main(sys.argv)) | 745 sys.exit(main(sys.argv)) |
| OLD | NEW |