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 25 matching lines...) Expand all Loading... |
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. | 41 # test_data: data folder in format destination:source. |
42 # host_driven_root: The host-driven test root directory. | 42 # host_driven_root: The host-driven test root directory. |
43 # annotation: Annotation of the tests to include. | 43 # annotation: Annotation of the tests to include. |
44 # exclude_annotation: The annotation of the tests to exclude. | 44 # exclude_annotation: The annotation of the tests to exclude. |
45 I_TEST = collections.namedtuple('InstrumentationTest', [ | 45 I_TEST = collections.namedtuple('InstrumentationTest', [ |
46 'name', 'apk', 'apk_package', 'test_apk', 'test_data', 'host_driven_root', | 46 'name', 'apk', 'apk_package', 'test_apk', 'test_data', 'isolate_file_path', |
47 'annotation', 'exclude_annotation', 'extra_flags']) | 47 'host_driven_root', 'annotation', 'exclude_annotation', 'extra_flags']) |
48 | 48 |
49 | 49 |
50 def SrcPath(*path): | 50 def SrcPath(*path): |
51 return os.path.join(CHROME_SRC_DIR, *path) | 51 return os.path.join(CHROME_SRC_DIR, *path) |
52 | 52 |
53 | 53 |
54 def I(name, apk, apk_package, test_apk, test_data, host_driven_root=None, | 54 def I(name, apk, apk_package, test_apk, test_data, isolate_file_path=None, |
55 annotation=None, exclude_annotation=None, extra_flags=None): | 55 host_driven_root=None, annotation=None, exclude_annotation=None, |
56 return I_TEST(name, apk, apk_package, test_apk, test_data, host_driven_root, | 56 extra_flags=None): |
57 annotation, exclude_annotation, extra_flags) | 57 return I_TEST(name, apk, apk_package, test_apk, test_data, isolate_file_path, |
| 58 host_driven_root, annotation, exclude_annotation, extra_flags) |
58 | 59 |
59 INSTRUMENTATION_TESTS = dict((suite.name, suite) for suite in [ | 60 INSTRUMENTATION_TESTS = dict((suite.name, suite) for suite in [ |
60 I('ContentShell', | 61 I('ContentShell', |
61 'ContentShell.apk', | 62 'ContentShell.apk', |
62 'org.chromium.content_shell_apk', | 63 'org.chromium.content_shell_apk', |
63 'ContentShellTest', | 64 'ContentShellTest', |
64 'content:content/test/data/android/device_files'), | 65 'content:content/test/data/android/device_files', |
| 66 isolate_file_path='content/content_shell_test_apk.isolate'), |
65 I('ChromeShell', | 67 I('ChromeShell', |
66 'ChromeShell.apk', | 68 'ChromeShell.apk', |
67 'org.chromium.chrome.shell', | 69 'org.chromium.chrome.shell', |
68 'ChromeShellTest', | 70 'ChromeShellTest', |
69 'chrome:chrome/test/data/android/device_files', | 71 'chrome:chrome/test/data/android/device_files', |
70 constants.CHROME_SHELL_HOST_DRIVEN_DIR), | 72 isolate_file_path='chrome/chrome_shell_test_apk.isolate', |
| 73 host_driven_root=constants.CHROME_SHELL_HOST_DRIVEN_DIR), |
71 I('AndroidWebView', | 74 I('AndroidWebView', |
72 'AndroidWebView.apk', | 75 'AndroidWebView.apk', |
73 'org.chromium.android_webview.shell', | 76 'org.chromium.android_webview.shell', |
74 'AndroidWebViewTest', | 77 'AndroidWebViewTest', |
75 'webview:android_webview/test/data/device_files'), | 78 'webview:android_webview/test/data/device_files', |
| 79 isolate_file_path='android_webview/android_webview_test_apk.isolate'), |
76 I('ChromeSyncShell', | 80 I('ChromeSyncShell', |
77 'ChromeSyncShell.apk', | 81 'ChromeSyncShell.apk', |
78 'org.chromium.chrome.browser.sync', | 82 'org.chromium.chrome.browser.sync', |
79 'ChromeSyncShellTest', | 83 'ChromeSyncShellTest', |
80 None), | 84 None), |
81 ]) | 85 ]) |
82 | 86 |
83 InstallablePackage = collections.namedtuple('InstallablePackage', [ | 87 InstallablePackage = collections.namedtuple('InstallablePackage', [ |
84 'name', 'apk', 'apk_package']) | 88 'name', 'apk', 'apk_package']) |
85 | 89 |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 args.extend(['--test_data', test.test_data]) | 262 args.extend(['--test_data', test.test_data]) |
259 if options.target == 'Release': | 263 if options.target == 'Release': |
260 args.append('--release') | 264 args.append('--release') |
261 if options.asan: | 265 if options.asan: |
262 args.append('--tool=asan') | 266 args.append('--tool=asan') |
263 if options.flakiness_server: | 267 if options.flakiness_server: |
264 args.append('--flakiness-dashboard-server=%s' % | 268 args.append('--flakiness-dashboard-server=%s' % |
265 options.flakiness_server) | 269 options.flakiness_server) |
266 if options.coverage_bucket: | 270 if options.coverage_bucket: |
267 args.append('--coverage-dir=%s' % options.coverage_dir) | 271 args.append('--coverage-dir=%s' % options.coverage_dir) |
| 272 if test.isolate_file_path: |
| 273 args.append('--isolate-file-path=%s' % test.isolate_file_path) |
268 if test.host_driven_root: | 274 if test.host_driven_root: |
269 args.append('--host-driven-root=%s' % test.host_driven_root) | 275 args.append('--host-driven-root=%s' % test.host_driven_root) |
270 if test.annotation: | 276 if test.annotation: |
271 args.extend(['-A', test.annotation]) | 277 args.extend(['-A', test.annotation]) |
272 if test.exclude_annotation: | 278 if test.exclude_annotation: |
273 args.extend(['-E', test.exclude_annotation]) | 279 args.extend(['-E', test.exclude_annotation]) |
274 if test.extra_flags: | 280 if test.extra_flags: |
275 args.extend(test.extra_flags) | 281 args.extend(test.extra_flags) |
276 if python_only: | 282 if python_only: |
277 args.append('-p') | 283 args.append('-p') |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 elif exit_code == 253: # test_run_results.NO_TESTS_EXIT_STATUS | 339 elif exit_code == 253: # test_run_results.NO_TESTS_EXIT_STATUS |
334 bb_annotations.PrintMsg('?? (no tests found)') | 340 bb_annotations.PrintMsg('?? (no tests found)') |
335 else: | 341 else: |
336 full_results_path = os.path.join('..', 'layout-test-results', | 342 full_results_path = os.path.join('..', 'layout-test-results', |
337 'full_results.json') | 343 'full_results.json') |
338 if os.path.exists(full_results_path): | 344 if os.path.exists(full_results_path): |
339 full_results = json.load(open(full_results_path)) | 345 full_results = json.load(open(full_results_path)) |
340 unexpected_passes, unexpected_failures, unexpected_flakes = ( | 346 unexpected_passes, unexpected_failures, unexpected_flakes = ( |
341 _ParseLayoutTestResults(full_results)) | 347 _ParseLayoutTestResults(full_results)) |
342 if unexpected_failures: | 348 if unexpected_failures: |
343 _PrintDashboardLink('failed', unexpected_failures, | 349 _PrintDashboardLink('failed', unexpected_failures.keys(), |
344 max_tests=25) | 350 max_tests=25) |
345 elif unexpected_passes: | 351 elif unexpected_passes: |
346 _PrintDashboardLink('unexpected passes', unexpected_passes, | 352 _PrintDashboardLink('unexpected passes', unexpected_passes.keys(), |
347 max_tests=10) | 353 max_tests=10) |
348 if unexpected_flakes: | 354 if unexpected_flakes: |
349 _PrintDashboardLink('unexpected flakes', unexpected_flakes, | 355 _PrintDashboardLink('unexpected flakes', unexpected_flakes.keys(), |
350 max_tests=10) | 356 max_tests=10) |
351 | 357 |
352 if exit_code == 0 and (unexpected_passes or unexpected_flakes): | 358 if exit_code == 0 and (unexpected_passes or unexpected_flakes): |
353 # If exit_code != 0, RunCmd() will have already printed an error. | 359 # If exit_code != 0, RunCmd() will have already printed an error. |
354 bb_annotations.PrintWarning() | 360 bb_annotations.PrintWarning() |
355 else: | 361 else: |
356 bb_annotations.PrintError() | 362 bb_annotations.PrintError() |
357 bb_annotations.PrintMsg('?? (results missing)') | 363 bb_annotations.PrintMsg('?? (results missing)') |
358 | 364 |
359 if options.factory_properties.get('archive_webkit_results', False): | 365 if options.factory_properties.get('archive_webkit_results', False): |
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
747 | 753 |
748 if options.coverage_bucket: | 754 if options.coverage_bucket: |
749 setattr(options, 'coverage_dir', | 755 setattr(options, 'coverage_dir', |
750 os.path.join(CHROME_OUT_DIR, options.target, 'coverage')) | 756 os.path.join(CHROME_OUT_DIR, options.target, 'coverage')) |
751 | 757 |
752 MainTestWrapper(options) | 758 MainTestWrapper(options) |
753 | 759 |
754 | 760 |
755 if __name__ == '__main__': | 761 if __name__ == '__main__': |
756 sys.exit(main(sys.argv)) | 762 sys.exit(main(sys.argv)) |
OLD | NEW |