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 20 matching lines...) Expand all Loading... |
31 SLAVE_SCRIPTS_DIR = os.path.join(bb_utils.BB_BUILD_DIR, 'scripts', 'slave') | 31 SLAVE_SCRIPTS_DIR = os.path.join(bb_utils.BB_BUILD_DIR, 'scripts', 'slave') |
32 LOGCAT_DIR = os.path.join(bb_utils.CHROME_OUT_DIR, 'logcat') | 32 LOGCAT_DIR = os.path.join(bb_utils.CHROME_OUT_DIR, 'logcat') |
33 GS_URL = 'https://storage.googleapis.com' | 33 GS_URL = 'https://storage.googleapis.com' |
34 GS_AUTH_URL = 'https://storage.cloud.google.com' | 34 GS_AUTH_URL = 'https://storage.cloud.google.com' |
35 | 35 |
36 # Describes an instrumation test suite: | 36 # Describes an instrumation test suite: |
37 # test: Name of test we're running. | 37 # test: Name of test we're running. |
38 # apk: apk to be installed. | 38 # apk: apk to be installed. |
39 # apk_package: package for the apk to be installed. | 39 # apk_package: package for the apk to be installed. |
40 # test_apk: apk to run tests on. | 40 # test_apk: apk to run tests on. |
41 # test_data: data folder in format destination:source. | |
42 # host_driven_root: The host-driven test root directory. | 41 # host_driven_root: The host-driven test root directory. |
43 # annotation: Annotation of the tests to include. | 42 # annotation: Annotation of the tests to include. |
44 # exclude_annotation: The annotation of the tests to exclude. | 43 # exclude_annotation: The annotation of the tests to exclude. |
45 I_TEST = collections.namedtuple('InstrumentationTest', [ | 44 I_TEST = collections.namedtuple('InstrumentationTest', [ |
46 'name', 'apk', 'apk_package', 'test_apk', 'test_data', 'isolate_file_path', | 45 'name', 'apk', 'apk_package', 'test_apk', 'isolate_file_path', |
47 'host_driven_root', 'annotation', 'exclude_annotation', 'extra_flags']) | 46 'host_driven_root', 'annotation', 'exclude_annotation', 'extra_flags']) |
48 | 47 |
49 | 48 |
50 def SrcPath(*path): | 49 def SrcPath(*path): |
51 return os.path.join(CHROME_SRC_DIR, *path) | 50 return os.path.join(CHROME_SRC_DIR, *path) |
52 | 51 |
53 | 52 |
54 def I(name, apk, apk_package, test_apk, test_data, isolate_file_path=None, | 53 def I(name, apk, apk_package, test_apk, isolate_file_path=None, |
55 host_driven_root=None, annotation=None, exclude_annotation=None, | 54 host_driven_root=None, annotation=None, exclude_annotation=None, |
56 extra_flags=None): | 55 extra_flags=None): |
57 return I_TEST(name, apk, apk_package, test_apk, test_data, isolate_file_path, | 56 return I_TEST(name, apk, apk_package, test_apk, isolate_file_path, |
58 host_driven_root, annotation, exclude_annotation, extra_flags) | 57 host_driven_root, annotation, exclude_annotation, extra_flags) |
59 | 58 |
60 INSTRUMENTATION_TESTS = dict((suite.name, suite) for suite in [ | 59 INSTRUMENTATION_TESTS = dict((suite.name, suite) for suite in [ |
61 I('ContentShell', | 60 I('ContentShell', |
62 'ContentShell.apk', | 61 'ContentShell.apk', |
63 'org.chromium.content_shell_apk', | 62 'org.chromium.content_shell_apk', |
64 'ContentShellTest', | 63 'ContentShellTest', |
65 'content:content/test/data/android/device_files', | |
66 isolate_file_path='content/content_shell_test_data.isolate'), | 64 isolate_file_path='content/content_shell_test_data.isolate'), |
67 I('ChromePublic', | 65 I('ChromePublic', |
68 'ChromePublic.apk', | 66 'ChromePublic.apk', |
69 'org.chromium.chrome', | 67 'org.chromium.chrome', |
70 'ChromePublicTest', | 68 'ChromePublicTest', |
71 'chrome:chrome/test/data/android/device_files', | |
72 isolate_file_path='chrome/chrome_public_test_apk.isolate'), | 69 isolate_file_path='chrome/chrome_public_test_apk.isolate'), |
73 I('AndroidWebView', | 70 I('AndroidWebView', |
74 'AndroidWebView.apk', | 71 'AndroidWebView.apk', |
75 'org.chromium.android_webview.shell', | 72 'org.chromium.android_webview.shell', |
76 'AndroidWebViewTest', | 73 'AndroidWebViewTest', |
77 'webview:android_webview/test/data/device_files', | |
78 isolate_file_path='android_webview/android_webview_test_data.isolate'), | 74 isolate_file_path='android_webview/android_webview_test_data.isolate'), |
79 I('ChromeSyncShell', | 75 I('ChromeSyncShell', |
80 'ChromeSyncShell.apk', | 76 'ChromeSyncShell.apk', |
81 'org.chromium.chrome.browser.sync', | 77 'org.chromium.chrome.browser.sync', |
82 'ChromeSyncShellTest', | 78 'ChromeSyncShellTest', |
83 None), | 79 None), |
84 ]) | 80 ]) |
85 | 81 |
86 InstallablePackage = collections.namedtuple('InstallablePackage', [ | 82 InstallablePackage = collections.namedtuple('InstallablePackage', [ |
87 'name', 'apk', 'apk_package']) | 83 'name', 'apk', 'apk_package']) |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 official_build: Run official-build tests. | 234 official_build: Run official-build tests. |
239 """ | 235 """ |
240 bb_annotations.PrintNamedStep('%s_instrumentation_tests' % test.name.lower()) | 236 bb_annotations.PrintNamedStep('%s_instrumentation_tests' % test.name.lower()) |
241 | 237 |
242 if test.apk: | 238 if test.apk: |
243 InstallApk(options, test) | 239 InstallApk(options, test) |
244 args = [ | 240 args = [ |
245 '--test-apk', test.test_apk, '--verbose', | 241 '--test-apk', test.test_apk, '--verbose', |
246 '--blacklist-file', 'out/bad_devices.json' | 242 '--blacklist-file', 'out/bad_devices.json' |
247 ] | 243 ] |
248 if test.test_data: | |
249 args.extend(['--test_data', test.test_data]) | |
250 if options.target == 'Release': | 244 if options.target == 'Release': |
251 args.append('--release') | 245 args.append('--release') |
252 if options.asan: | 246 if options.asan: |
253 args.append('--tool=asan') | 247 args.append('--tool=asan') |
254 if options.flakiness_server: | 248 if options.flakiness_server: |
255 args.append('--flakiness-dashboard-server=%s' % | 249 args.append('--flakiness-dashboard-server=%s' % |
256 options.flakiness_server) | 250 options.flakiness_server) |
257 if options.coverage_bucket: | 251 if options.coverage_bucket: |
258 args.append('--coverage-dir=%s' % options.coverage_dir) | 252 args.append('--coverage-dir=%s' % options.coverage_dir) |
259 if test.isolate_file_path: | 253 if test.isolate_file_path: |
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
774 | 768 |
775 if options.coverage_bucket: | 769 if options.coverage_bucket: |
776 setattr(options, 'coverage_dir', | 770 setattr(options, 'coverage_dir', |
777 os.path.join(CHROME_OUT_DIR, options.target, 'coverage')) | 771 os.path.join(CHROME_OUT_DIR, options.target, 'coverage')) |
778 | 772 |
779 return MainTestWrapper(options) | 773 return MainTestWrapper(options) |
780 | 774 |
781 | 775 |
782 if __name__ == '__main__': | 776 if __name__ == '__main__': |
783 sys.exit(main(sys.argv)) | 777 sys.exit(main(sys.argv)) |
OLD | NEW |