OLD | NEW |
---|---|
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import re | 5 import re |
6 import string | 6 import string |
7 | 7 |
8 | 8 |
9 class Test(object): | 9 class Test(object): |
10 """ | 10 """ |
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
477 swarming_dimension_sets = swarming_spec.get('dimension_sets') | 477 swarming_dimension_sets = swarming_spec.get('dimension_sets') |
478 swarming_priority = swarming_spec.get('priority_adjustment') | 478 swarming_priority = swarming_spec.get('priority_adjustment') |
479 swarming_expiration = swarming_spec.get('expiration') | 479 swarming_expiration = swarming_spec.get('expiration') |
480 if use_swarming and swarming_dimension_sets: | 480 if use_swarming and swarming_dimension_sets: |
481 for dimensions in swarming_dimension_sets: | 481 for dimensions in swarming_dimension_sets: |
482 # TODO(stip): Swarmify instrumentation tests | 482 # TODO(stip): Swarmify instrumentation tests |
483 pass | 483 pass |
484 else: | 484 else: |
485 yield AndroidInstrumentationTest( | 485 yield AndroidInstrumentationTest( |
486 test_name, | 486 test_name, |
487 compile_targets=test.get('override_compile_targets', None), | 487 compile_targets=test.get('override_compile_targets', None)) |
488 isolate_file_path=test.get('isolate_file_path', None), | |
489 apk_under_test=test.get('apk_under_test', None), | |
490 test_apk=test.get('test_apk', None), | |
491 additional_apks=test.get('additional_apks', None)) | |
492 | 488 |
493 | 489 |
494 def generate_script(api, chromium_tests_api, mastername, buildername, test_spec, | 490 def generate_script(api, chromium_tests_api, mastername, buildername, test_spec, |
495 bot_update_step, enable_swarming=False, | 491 bot_update_step, enable_swarming=False, |
496 swarming_dimensions=None, scripts_compile_targets=None): | 492 swarming_dimensions=None, scripts_compile_targets=None): |
497 for script_spec in test_spec.get(buildername, {}).get('scripts', []): | 493 for script_spec in test_spec.get(buildername, {}).get('scripts', []): |
498 yield ScriptTest( | 494 yield ScriptTest( |
499 str(script_spec['name']), | 495 str(script_spec['name']), |
500 script_spec['script'], | 496 script_spec['script'], |
501 scripts_compile_targets, | 497 scripts_compile_targets, |
(...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1066 test_apk=self.name, | 1062 test_apk=self.name, |
1067 isolate_file_path=isolate_file_path, | 1063 isolate_file_path=isolate_file_path, |
1068 timeout_scale=self._test_timeout_scale) | 1064 timeout_scale=self._test_timeout_scale) |
1069 | 1065 |
1070 #override | 1066 #override |
1071 def run_test_locally(self, api, suffix): | 1067 def run_test_locally(self, api, suffix): |
1072 isolate_file_path = (api.path['checkout'].join(self._android_isolate_path) | 1068 isolate_file_path = (api.path['checkout'].join(self._android_isolate_path) |
1073 if self._android_isolate_path else None) | 1069 if self._android_isolate_path else None) |
1074 return AndroidInstrumentationTest( | 1070 return AndroidInstrumentationTest( |
1075 name=self.name, | 1071 name=self.name, |
1076 compile_targets=self._compile_target, | 1072 compile_targets=[self._compile_target], |
1077 apk_under_test=self._apk_under_test, | |
1078 test_apk=self.name, | |
1079 isolate_file_path=isolate_file_path, | |
1080 timeout_scale=self._test_timeout_scale).run(api, suffix) | 1073 timeout_scale=self._test_timeout_scale).run(api, suffix) |
1081 | 1074 |
1082 | 1075 |
1083 class LocalIsolatedScriptTest(Test): | 1076 class LocalIsolatedScriptTest(Test): |
1084 def __init__(self, name, args=None, target_name=None, | 1077 def __init__(self, name, args=None, target_name=None, |
1085 override_compile_targets=None, **runtest_kwargs): | 1078 override_compile_targets=None, **runtest_kwargs): |
1086 """Constructs an instance of LocalIsolatedScriptTest. | 1079 """Constructs an instance of LocalIsolatedScriptTest. |
1087 | 1080 |
1088 An LocalIsolatedScriptTest knows how to invoke an isolate which obeys a | 1081 An LocalIsolatedScriptTest knows how to invoke an isolate which obeys a |
1089 certain contract. The isolate's main target must be a wrapper script which | 1082 certain contract. The isolate's main target must be a wrapper script which |
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1566 api.chromium_android.run_java_unit_test_suite( | 1559 api.chromium_android.run_java_unit_test_suite( |
1567 self.name, verbose=True, suffix=suffix, | 1560 self.name, verbose=True, suffix=suffix, |
1568 json_results_file=json_results_file, | 1561 json_results_file=json_results_file, |
1569 step_test_data=lambda: api.json.test_api.output(mock_test_results)) | 1562 step_test_data=lambda: api.json.test_api.output(mock_test_results)) |
1570 | 1563 |
1571 | 1564 |
1572 class AndroidInstrumentationTest(AndroidTest): | 1565 class AndroidInstrumentationTest(AndroidTest): |
1573 _DEFAULT_SUITES = { | 1566 _DEFAULT_SUITES = { |
1574 'AndroidWebViewTest': { | 1567 'AndroidWebViewTest': { |
1575 'compile_target': 'android_webview_test_apk', | 1568 'compile_target': 'android_webview_test_apk', |
1576 'isolate_file_path': 'android_webview/android_webview_test_apk.isolate', | |
1577 'apk_under_test': 'AndroidWebView.apk', | |
1578 'test_apk': 'AndroidWebViewTest.apk', | |
1579 }, | 1569 }, |
1580 'ChromePublicTest': { | 1570 'ChromePublicTest': { |
1581 'compile_target': 'chrome_public_test_apk', | 1571 'compile_target': 'chrome_public_test_apk', |
1582 'isolate_file_path': 'chrome/chrome_public_test_apk.isolate', | |
1583 'apk_under_test': 'ChromePublic.apk', | |
1584 'test_apk': 'ChromePublicTest.apk', | |
1585 'additional_apks': [ | |
1586 'ChromePublicTestSupport.apk', | |
1587 'ChromiumNetTestSupport.apk', | |
1588 ], | |
1589 }, | 1572 }, |
1590 'ChromeSyncShellTest': { | 1573 'ChromeSyncShellTest': { |
1591 'compile_target': 'chrome_sync_shell_test_apk', | 1574 'compile_target': 'chrome_sync_shell_test_apk', |
1592 'isolate_file_path': None, | |
1593 'apk_under_test': 'ChromeSyncShell.apk', | |
1594 'test_apk': 'ChromeSyncShellTest.apk', | |
1595 }, | 1575 }, |
1596 'ChromotingTest': { | 1576 'ChromotingTest': { |
1597 'compile_target': 'remoting_test_apk', | 1577 'compile_target': 'remoting_test_apk', |
1598 'isolate_file_path': None, | |
1599 'apk_under_test': 'Chromoting.apk', | |
1600 'test_apk': 'ChromotingTest.apk', | |
1601 }, | 1578 }, |
1602 'ContentShellTest': { | 1579 'ContentShellTest': { |
1603 'compile_target': 'content_shell_test_apk', | 1580 'compile_target': 'content_shell_test_apk', |
1604 'isolate_file_path': 'content/content_shell_test_apk.isolate', | |
1605 'apk_under_test': 'ContentShell.apk', | |
1606 'test_apk': 'ContentShellTest.apk', | |
1607 }, | 1581 }, |
1608 'SystemWebViewShellLayoutTest': { | 1582 'SystemWebViewShellLayoutTest': { |
1609 'compile_target': 'system_webview_shell_layout_test_apk', | 1583 'compile_target': 'system_webview_shell_layout_test_apk', |
1584 # TODO(agrieve): Are these needed? | |
jbudorick
2016/04/02 00:59:57
iirc yes
agrieve
2016/04/05 02:37:01
Updated comment to say that system_webview_shell_l
| |
1610 'additional_compile_targets': [ | 1585 'additional_compile_targets': [ |
1611 'system_webview_apk', | 1586 'system_webview_apk', |
1612 'system_webview_shell_apk', | 1587 'system_webview_shell_apk', |
1613 'android_tools' | 1588 'android_tools' |
1614 ], | 1589 ], |
1615 'isolate_file_path': ('android_webview/' | |
1616 'system_webview_shell_test_apk.isolate'), | |
1617 'apk_under_test': 'SystemWebViewShell.apk', | |
1618 'test_apk': 'SystemWebViewShellLayoutTest.apk', | |
1619 'additional_apks': ['SystemWebView.apk'], | |
1620 }, | 1590 }, |
1621 'MojoTest': { | 1591 'MojoTest': { |
1622 'compile_target': 'mojo_test_apk', | 1592 'compile_target': 'mojo_test_apk', |
1623 'isolate_file_path': None, | |
1624 'apk_under_test': None, | |
1625 'test_apk': 'MojoTest.apk', | |
1626 } | 1593 } |
1627 } | 1594 } |
1628 | 1595 |
1629 _DEFAULT_SUITES_BY_TARGET = { | 1596 _DEFAULT_SUITES_BY_TARGET = { |
1630 'android_webview_test_apk': _DEFAULT_SUITES['AndroidWebViewTest'], | 1597 'android_webview_test_apk': _DEFAULT_SUITES['AndroidWebViewTest'], |
1631 'chrome_public_test_apk': _DEFAULT_SUITES['ChromePublicTest'], | 1598 'chrome_public_test_apk': _DEFAULT_SUITES['ChromePublicTest'], |
1632 'chrome_sync_shell_test_apk': _DEFAULT_SUITES['ChromeSyncShellTest'], | 1599 'chrome_sync_shell_test_apk': _DEFAULT_SUITES['ChromeSyncShellTest'], |
1633 'content_shell_test_apk': _DEFAULT_SUITES['ContentShellTest'], | 1600 'content_shell_test_apk': _DEFAULT_SUITES['ContentShellTest'], |
1634 'mojo_test_apk': _DEFAULT_SUITES['MojoTest'], | 1601 'mojo_test_apk': _DEFAULT_SUITES['MojoTest'], |
1635 'remoting_test_apk': _DEFAULT_SUITES['ChromotingTest'], | 1602 'remoting_test_apk': _DEFAULT_SUITES['ChromotingTest'], |
1636 'system_webview_shell_layout_test_apk': | 1603 'system_webview_shell_layout_test_apk': |
1637 _DEFAULT_SUITES['SystemWebViewShellLayoutTest'], | 1604 _DEFAULT_SUITES['SystemWebViewShellLayoutTest'], |
1638 } | 1605 } |
1639 | 1606 |
1640 def __init__(self, name, compile_targets=None, apk_under_test=None, | 1607 def __init__(self, name, compile_targets=None, apk_under_test=None, |
1641 test_apk=None, isolate_file_path=None, timeout_scale=None, | 1608 test_apk=None, isolate_file_path=None, timeout_scale=None, |
1642 flakiness_dashboard='test-results.appspot.com', | 1609 flakiness_dashboard='test-results.appspot.com', |
1643 annotation=None, except_annotation=None, screenshot=False, | 1610 annotation=None, except_annotation=None, screenshot=False, |
1644 verbose=True, tool=None, host_driven_root=None, | 1611 verbose=True, tool=None, host_driven_root=None, |
1645 additional_apks=None): | 1612 additional_apks=None): |
1646 suite_defaults = ( | 1613 suite_defaults = ( |
1647 AndroidInstrumentationTest._DEFAULT_SUITES.get(name) | 1614 AndroidInstrumentationTest._DEFAULT_SUITES.get(name) |
1648 or AndroidInstrumentationTest._DEFAULT_SUITES_BY_TARGET.get(name) | 1615 or AndroidInstrumentationTest._DEFAULT_SUITES_BY_TARGET.get(name) |
1649 or {}) | 1616 or {}) |
1650 if not compile_targets: | 1617 if not compile_targets: |
1651 compile_targets = [suite_defaults['compile_target']] | 1618 compile_targets = [suite_defaults['compile_target']] |
1652 compile_targets.extend( | 1619 compile_targets.extend( |
1653 suite_defaults.get('additional_compile_targets', [])) | 1620 suite_defaults.get('additional_compile_targets', [])) |
1621 # Normalize the name to be the compile target. | |
1622 name = compile_targets[0] | |
1654 | 1623 |
1655 super(AndroidInstrumentationTest, self).__init__( | 1624 super(AndroidInstrumentationTest, self).__init__( |
1656 name, | 1625 name, |
1657 compile_targets, | 1626 compile_targets, |
1658 isolate_file_path or suite_defaults.get('isolate_file_path')) | 1627 isolate_file_path or suite_defaults.get('isolate_file_path')) |
1659 self._additional_apks = ( | 1628 self._additional_apks = ( |
1660 additional_apks or suite_defaults.get('additional_apks')) | 1629 additional_apks or suite_defaults.get('additional_apks')) |
1661 self._annotation = annotation | 1630 self._annotation = annotation |
1662 self._apk_under_test = ( | 1631 self._apk_under_test = ( |
1663 apk_under_test or suite_defaults.get('apk_under_test')) | 1632 apk_under_test or suite_defaults.get('apk_under_test')) |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1901 def run(self, api, suffix, test_filter=None): | 1870 def run(self, api, suffix, test_filter=None): |
1902 api.chromium_android.coverage_report(upload=False) | 1871 api.chromium_android.coverage_report(upload=False) |
1903 api.chromium_android.get_changed_lines_for_revision() | 1872 api.chromium_android.get_changed_lines_for_revision() |
1904 api.chromium_android.incremental_coverage_report() | 1873 api.chromium_android.incremental_coverage_report() |
1905 | 1874 |
1906 | 1875 |
1907 GOMA_TESTS = [ | 1876 GOMA_TESTS = [ |
1908 GTestTest('base_unittests'), | 1877 GTestTest('base_unittests'), |
1909 GTestTest('content_unittests'), | 1878 GTestTest('content_unittests'), |
1910 ] | 1879 ] |
OLD | NEW |