Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(102)

Side by Side Diff: scripts/slave/recipe_modules/chromium_tests/steps.py

Issue 1855663002: Make android's run_instrumentation_suite() use generated wrapper scripts (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/build.git@wrapper-1
Patch Set: coverage :( Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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
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): These should be listed as deps for
1585 # system_webview_shell_layout_test_apk.
1610 'additional_compile_targets': [ 1586 'additional_compile_targets': [
1611 'system_webview_apk', 1587 'system_webview_apk',
1612 'system_webview_shell_apk', 1588 'system_webview_shell_apk',
1613 'android_tools' 1589 'android_tools'
1614 ], 1590 ],
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 }, 1591 },
1621 'MojoTest': { 1592 'MojoTest': {
1622 'compile_target': 'mojo_test_apk', 1593 'compile_target': 'mojo_test_apk',
1623 'isolate_file_path': None,
1624 'apk_under_test': None,
1625 'test_apk': 'MojoTest.apk',
1626 } 1594 }
1627 } 1595 }
1628 1596
1629 _DEFAULT_SUITES_BY_TARGET = { 1597 _DEFAULT_SUITES_BY_TARGET = {
1630 'android_webview_test_apk': _DEFAULT_SUITES['AndroidWebViewTest'], 1598 'android_webview_test_apk': _DEFAULT_SUITES['AndroidWebViewTest'],
1631 'chrome_public_test_apk': _DEFAULT_SUITES['ChromePublicTest'], 1599 'chrome_public_test_apk': _DEFAULT_SUITES['ChromePublicTest'],
1632 'chrome_sync_shell_test_apk': _DEFAULT_SUITES['ChromeSyncShellTest'], 1600 'chrome_sync_shell_test_apk': _DEFAULT_SUITES['ChromeSyncShellTest'],
1633 'content_shell_test_apk': _DEFAULT_SUITES['ContentShellTest'], 1601 'content_shell_test_apk': _DEFAULT_SUITES['ContentShellTest'],
1634 'mojo_test_apk': _DEFAULT_SUITES['MojoTest'], 1602 'mojo_test_apk': _DEFAULT_SUITES['MojoTest'],
1635 'remoting_test_apk': _DEFAULT_SUITES['ChromotingTest'], 1603 'remoting_test_apk': _DEFAULT_SUITES['ChromotingTest'],
(...skipping 26 matching lines...) Expand all
1662 self._apk_under_test = ( 1630 self._apk_under_test = (
1663 apk_under_test or suite_defaults.get('apk_under_test')) 1631 apk_under_test or suite_defaults.get('apk_under_test'))
1664 self._except_annotation = except_annotation 1632 self._except_annotation = except_annotation
1665 self._flakiness_dashboard = flakiness_dashboard 1633 self._flakiness_dashboard = flakiness_dashboard
1666 self._host_driven_root = host_driven_root 1634 self._host_driven_root = host_driven_root
1667 self._screenshot = screenshot 1635 self._screenshot = screenshot
1668 self._test_apk = test_apk or suite_defaults.get('test_apk') 1636 self._test_apk = test_apk or suite_defaults.get('test_apk')
1669 self._timeout_scale = timeout_scale 1637 self._timeout_scale = timeout_scale
1670 self._tool = tool 1638 self._tool = tool
1671 self._verbose = verbose 1639 self._verbose = verbose
1640 self._wrapper_script_suite_name = compile_targets[0]
1641
1672 1642
1673 #override 1643 #override
1674 def run_tests(self, api, suffix, json_results_file): 1644 def run_tests(self, api, suffix, json_results_file):
1675 mock_test_results = { 1645 mock_test_results = {
1676 'per_iteration_data': [{'TestA': [{'status': 'SUCCESS'}]}, 1646 'per_iteration_data': [{'TestA': [{'status': 'SUCCESS'}]},
1677 {'TestB': [{'status': 'FAILURE'}]}] 1647 {'TestB': [{'status': 'FAILURE'}]}]
1678 } 1648 }
1679 api.chromium_android.run_instrumentation_suite( 1649 api.chromium_android.run_instrumentation_suite(
1680 self.name, 1650 self.name,
1681 test_apk=api.chromium_android.apk_path(self._test_apk), 1651 test_apk=api.chromium_android.apk_path(self._test_apk),
1682 apk_under_test=api.chromium_android.apk_path(self._apk_under_test), 1652 apk_under_test=api.chromium_android.apk_path(self._apk_under_test),
1683 additional_apks=[ 1653 additional_apks=[
1684 api.chromium_android.apk_path(a) 1654 api.chromium_android.apk_path(a)
1685 for a in self._additional_apks or []], 1655 for a in self._additional_apks or []],
1686 suffix=suffix, 1656 suffix=suffix,
1687 isolate_file_path=self.isolate_file_path, 1657 isolate_file_path=self.isolate_file_path,
1688 flakiness_dashboard=self._flakiness_dashboard, 1658 flakiness_dashboard=self._flakiness_dashboard,
1689 annotation=self._annotation, except_annotation=self._except_annotation, 1659 annotation=self._annotation, except_annotation=self._except_annotation,
1690 screenshot=self._screenshot, verbose=self._verbose, tool=self._tool, 1660 screenshot=self._screenshot, verbose=self._verbose, tool=self._tool,
1691 host_driven_root=self._host_driven_root, 1661 host_driven_root=self._host_driven_root,
1692 json_results_file=json_results_file, 1662 json_results_file=json_results_file,
1693 timeout_scale=self._timeout_scale, 1663 timeout_scale=self._timeout_scale,
1664 wrapper_script_suite_name=self._wrapper_script_suite_name,
1694 step_test_data=lambda: api.json.test_api.output(mock_test_results)) 1665 step_test_data=lambda: api.json.test_api.output(mock_test_results))
1695 1666
1696 1667
1697 class BlinkTest(Test): 1668 class BlinkTest(Test):
1698 # TODO(dpranke): This should be converted to a PythonBasedTest, although it 1669 # TODO(dpranke): This should be converted to a PythonBasedTest, although it
1699 # will need custom behavior because we archive the results as well. 1670 # will need custom behavior because we archive the results as well.
1700 def __init__(self, extra_args=None): 1671 def __init__(self, extra_args=None):
1701 super(BlinkTest, self).__init__() 1672 super(BlinkTest, self).__init__()
1702 self._extra_args = extra_args 1673 self._extra_args = extra_args
1703 1674
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
1901 def run(self, api, suffix, test_filter=None): 1872 def run(self, api, suffix, test_filter=None):
1902 api.chromium_android.coverage_report(upload=False) 1873 api.chromium_android.coverage_report(upload=False)
1903 api.chromium_android.get_changed_lines_for_revision() 1874 api.chromium_android.get_changed_lines_for_revision()
1904 api.chromium_android.incremental_coverage_report() 1875 api.chromium_android.incremental_coverage_report()
1905 1876
1906 1877
1907 GOMA_TESTS = [ 1878 GOMA_TESTS = [
1908 GTestTest('base_unittests'), 1879 GTestTest('base_unittests'),
1909 GTestTest('content_unittests'), 1880 GTestTest('content_unittests'),
1910 ] 1881 ]
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698