| 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 |
| 11 import random | 11 import random |
| 12 import re | 12 import re |
| 13 import shutil | 13 import shutil |
| 14 import sys | 14 import sys |
| 15 | 15 |
| 16 import bb_utils | 16 import bb_utils |
| 17 import bb_annotations | 17 import bb_annotations |
| 18 | 18 |
| 19 sys.path.append(os.path.join(os.path.dirname(__file__), '..')) | 19 sys.path.append(os.path.join(os.path.dirname(__file__), '..')) |
| 20 import provision_devices | 20 import provision_devices |
| 21 from devil.android import device_utils | 21 from devil.android import device_utils |
| 22 from pylib import constants | 22 from pylib import constants |
| 23 from pylib.gtest import gtest_config |
| 23 | 24 |
| 24 CHROME_SRC_DIR = bb_utils.CHROME_SRC | 25 CHROME_SRC_DIR = bb_utils.CHROME_SRC |
| 25 DIR_BUILD_ROOT = os.path.dirname(CHROME_SRC_DIR) | 26 DIR_BUILD_ROOT = os.path.dirname(CHROME_SRC_DIR) |
| 26 CHROME_OUT_DIR = bb_utils.CHROME_OUT_DIR | 27 CHROME_OUT_DIR = bb_utils.CHROME_OUT_DIR |
| 27 BLINK_SCRIPTS_DIR = 'third_party/WebKit/Tools/Scripts' | 28 BLINK_SCRIPTS_DIR = 'third_party/WebKit/Tools/Scripts' |
| 28 | 29 |
| 29 SLAVE_SCRIPTS_DIR = os.path.join(bb_utils.BB_BUILD_DIR, 'scripts', 'slave') | 30 SLAVE_SCRIPTS_DIR = os.path.join(bb_utils.BB_BUILD_DIR, 'scripts', 'slave') |
| 30 LOGCAT_DIR = os.path.join(bb_utils.CHROME_OUT_DIR, 'logcat') | 31 LOGCAT_DIR = os.path.join(bb_utils.CHROME_OUT_DIR, 'logcat') |
| 31 GS_URL = 'https://storage.googleapis.com' | 32 GS_URL = 'https://storage.googleapis.com' |
| 32 GS_AUTH_URL = 'https://storage.cloud.google.com' | 33 GS_AUTH_URL = 'https://storage.cloud.google.com' |
| 33 | 34 |
| 34 # gtest suite groups. | |
| 35 ASAN_EXCLUDED_GTEST_SUITES = [ | |
| 36 'breakpad_unittests', | |
| 37 'sandbox_linux_unittests' | |
| 38 ] | |
| 39 | |
| 40 EXPERIMENTAL_GTEST_SUITES = [ | |
| 41 'components_browsertests', | |
| 42 'content_gl_tests', | |
| 43 'heap_profiler_unittests', | |
| 44 'devtools_bridge_tests', | |
| 45 ] | |
| 46 | |
| 47 STABLE_GTEST_SUITES = [ | |
| 48 'android_webview_unittests', | |
| 49 'base_unittests', | |
| 50 'breakpad_unittests', | |
| 51 'cc_unittests', | |
| 52 'components_unittests', | |
| 53 'content_browsertests', | |
| 54 'content_unittests', | |
| 55 'events_unittests', | |
| 56 'gl_tests', | |
| 57 'gl_unittests', | |
| 58 'gpu_unittests', | |
| 59 'ipc_tests', | |
| 60 'media_unittests', | |
| 61 'midi_unittests', | |
| 62 'net_unittests', | |
| 63 'sandbox_linux_unittests', | |
| 64 'skia_unittests', | |
| 65 'sql_unittests', | |
| 66 'sync_unit_tests', | |
| 67 'ui_android_unittests', | |
| 68 'ui_base_unittests', | |
| 69 'ui_touch_selection_unittests', | |
| 70 'unit_tests', | |
| 71 'webkit_unit_tests', | |
| 72 ] | |
| 73 | |
| 74 # Describes an instrumation test suite: | 35 # Describes an instrumation test suite: |
| 75 # test: Name of test we're running. | 36 # test: Name of test we're running. |
| 76 # apk: apk to be installed. | 37 # apk: apk to be installed. |
| 77 # apk_package: package for the apk to be installed. | 38 # apk_package: package for the apk to be installed. |
| 78 # test_apk: apk to run tests on. | 39 # test_apk: apk to run tests on. |
| 79 # test_data: data folder in format destination:source. | 40 # test_data: data folder in format destination:source. |
| 80 # host_driven_root: The host-driven test root directory. | 41 # host_driven_root: The host-driven test root directory. |
| 81 # annotation: Annotation of the tests to include. | 42 # annotation: Annotation of the tests to include. |
| 82 # exclude_annotation: The annotation of the tests to exclude. | 43 # exclude_annotation: The annotation of the tests to exclude. |
| 83 I_TEST = collections.namedtuple('InstrumentationTest', [ | 44 I_TEST = collections.namedtuple('InstrumentationTest', [ |
| 84 'name', 'apk', 'apk_package', 'test_apk', 'test_data', 'isolate_file_path', | 45 'name', 'apk', 'apk_package', 'test_apk', 'test_data', 'isolate_file_path', |
| 85 'host_driven_root', 'annotation', 'exclude_annotation', 'extra_flags']) | 46 'host_driven_root', 'annotation', 'exclude_annotation', 'extra_flags']) |
| 86 | 47 |
| 87 | 48 |
| 88 def SrcPath(*path): | 49 def SrcPath(*path): |
| 89 return os.path.join(CHROME_SRC_DIR, *path) | 50 return os.path.join(CHROME_SRC_DIR, *path) |
| 90 | 51 |
| 52 |
| 91 def I(name, apk, apk_package, test_apk, test_data, isolate_file_path=None, | 53 def I(name, apk, apk_package, test_apk, test_data, isolate_file_path=None, |
| 92 host_driven_root=None, annotation=None, exclude_annotation=None, | 54 host_driven_root=None, annotation=None, exclude_annotation=None, |
| 93 extra_flags=None): | 55 extra_flags=None): |
| 94 return I_TEST(name, apk, apk_package, test_apk, test_data, isolate_file_path, | 56 return I_TEST(name, apk, apk_package, test_apk, test_data, isolate_file_path, |
| 95 host_driven_root, annotation, exclude_annotation, extra_flags) | 57 host_driven_root, annotation, exclude_annotation, extra_flags) |
| 96 | 58 |
| 97 INSTRUMENTATION_TESTS = dict((suite.name, suite) for suite in [ | 59 INSTRUMENTATION_TESTS = dict((suite.name, suite) for suite in [ |
| 98 I('ContentShell', | 60 I('ContentShell', |
| 99 'ContentShell.apk', | 61 'ContentShell.apk', |
| 100 'org.chromium.content_shell_apk', | 62 'org.chromium.content_shell_apk', |
| (...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 510 | 472 |
| 511 | 473 |
| 512 def GetDeviceSetupStepCmds(): | 474 def GetDeviceSetupStepCmds(): |
| 513 return [ | 475 return [ |
| 514 ('device_status_check', DeviceStatusCheck), | 476 ('device_status_check', DeviceStatusCheck), |
| 515 ('provision_devices', ProvisionDevices), | 477 ('provision_devices', ProvisionDevices), |
| 516 ] | 478 ] |
| 517 | 479 |
| 518 | 480 |
| 519 def RunUnitTests(options): | 481 def RunUnitTests(options): |
| 520 suites = STABLE_GTEST_SUITES | 482 suites = gtest_config.STABLE_TEST_SUITES |
| 521 if options.asan: | 483 if options.asan: |
| 522 suites = [s for s in suites | 484 suites = [s for s in suites |
| 523 if s not in ASAN_EXCLUDED_GTEST_SUITES] | 485 if s not in gtest_config.ASAN_EXCLUDED_TEST_SUITES] |
| 524 RunTestSuites(options, suites) | 486 RunTestSuites(options, suites) |
| 525 | 487 |
| 526 | 488 |
| 527 def RunInstrumentationTests(options): | 489 def RunInstrumentationTests(options): |
| 528 for test in INSTRUMENTATION_TESTS.itervalues(): | 490 for test in INSTRUMENTATION_TESTS.itervalues(): |
| 529 RunInstrumentationSuite(options, test) | 491 RunInstrumentationSuite(options, test) |
| 530 | 492 |
| 531 | 493 |
| 532 def RunWebkitTests(options): | 494 def RunWebkitTests(options): |
| 533 RunTestSuites(options, ['webkit_unit_tests', 'blink_heap_unittests']) | 495 RunTestSuites(options, ['webkit_unit_tests', 'blink_heap_unittests']) |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 703 if options.test_filter: | 665 if options.test_filter: |
| 704 bb_utils.RunSteps(options.test_filter, GetTestStepCmds(), options) | 666 bb_utils.RunSteps(options.test_filter, GetTestStepCmds(), options) |
| 705 | 667 |
| 706 if options.coverage_bucket: | 668 if options.coverage_bucket: |
| 707 coverage_html = GenerateJavaCoverageReport(options) | 669 coverage_html = GenerateJavaCoverageReport(options) |
| 708 UploadHTML(options, '%s/java' % options.coverage_bucket, coverage_html, | 670 UploadHTML(options, '%s/java' % options.coverage_bucket, coverage_html, |
| 709 'Coverage Report') | 671 'Coverage Report') |
| 710 shutil.rmtree(coverage_html, ignore_errors=True) | 672 shutil.rmtree(coverage_html, ignore_errors=True) |
| 711 | 673 |
| 712 if options.experimental: | 674 if options.experimental: |
| 713 RunTestSuites(options, EXPERIMENTAL_GTEST_SUITES) | 675 RunTestSuites(options, gtest_config.EXPERIMENTAL_TEST_SUITES) |
| 714 | 676 |
| 715 finally: | 677 finally: |
| 716 # Run all post test steps | 678 # Run all post test steps |
| 717 LogcatDump(options) | 679 LogcatDump(options) |
| 718 if not options.disable_stack_tool: | 680 if not options.disable_stack_tool: |
| 719 RunStackToolSteps(options) | 681 RunStackToolSteps(options) |
| 720 GenerateTestReport(options) | 682 GenerateTestReport(options) |
| 721 # KillHostHeartbeat() has logic to check if heartbeat process is running, | 683 # KillHostHeartbeat() has logic to check if heartbeat process is running, |
| 722 # and kills only if it finds the process is running on the host. | 684 # and kills only if it finds the process is running on the host. |
| 723 provision_devices.KillHostHeartbeat() | 685 provision_devices.KillHostHeartbeat() |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 798 | 760 |
| 799 if options.coverage_bucket: | 761 if options.coverage_bucket: |
| 800 setattr(options, 'coverage_dir', | 762 setattr(options, 'coverage_dir', |
| 801 os.path.join(CHROME_OUT_DIR, options.target, 'coverage')) | 763 os.path.join(CHROME_OUT_DIR, options.target, 'coverage')) |
| 802 | 764 |
| 803 MainTestWrapper(options) | 765 MainTestWrapper(options) |
| 804 | 766 |
| 805 | 767 |
| 806 if __name__ == '__main__': | 768 if __name__ == '__main__': |
| 807 sys.exit(main(sys.argv)) | 769 sys.exit(main(sys.argv)) |
| OLD | NEW |