| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # | 2 # |
| 3 # Copyright 2013 The Chromium Authors. All rights reserved. | 3 # Copyright 2013 The Chromium Authors. All rights reserved. |
| 4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
| 5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
| 6 | 6 |
| 7 """Runs all types of tests from one unified interface.""" | 7 """Runs all types of tests from one unified interface.""" |
| 8 | 8 |
| 9 import argparse | 9 import argparse |
| 10 import collections | 10 import collections |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 from devil.utils import run_tests_helper | 29 from devil.utils import run_tests_helper |
| 30 | 30 |
| 31 from pylib import constants | 31 from pylib import constants |
| 32 from pylib.constants import host_paths | 32 from pylib.constants import host_paths |
| 33 from pylib.base import base_test_result | 33 from pylib.base import base_test_result |
| 34 from pylib.base import environment_factory | 34 from pylib.base import environment_factory |
| 35 from pylib.base import test_dispatcher | 35 from pylib.base import test_dispatcher |
| 36 from pylib.base import test_instance_factory | 36 from pylib.base import test_instance_factory |
| 37 from pylib.base import test_run_factory | 37 from pylib.base import test_run_factory |
| 38 from pylib.linker import setup as linker_setup | 38 from pylib.linker import setup as linker_setup |
| 39 from pylib.host_driven import setup as host_driven_setup | |
| 40 from pylib.instrumentation import setup as instrumentation_setup | 39 from pylib.instrumentation import setup as instrumentation_setup |
| 41 from pylib.instrumentation import test_options as instrumentation_test_options | 40 from pylib.instrumentation import test_options as instrumentation_test_options |
| 42 from pylib.junit import setup as junit_setup | 41 from pylib.junit import setup as junit_setup |
| 43 from pylib.junit import test_dispatcher as junit_dispatcher | 42 from pylib.junit import test_dispatcher as junit_dispatcher |
| 44 from pylib.monkey import setup as monkey_setup | 43 from pylib.monkey import setup as monkey_setup |
| 45 from pylib.monkey import test_options as monkey_test_options | 44 from pylib.monkey import test_options as monkey_test_options |
| 46 from pylib.perf import setup as perf_setup | 45 from pylib.perf import setup as perf_setup |
| 47 from pylib.perf import test_options as perf_test_options | 46 from pylib.perf import test_options as perf_test_options |
| 48 from pylib.perf import test_runner as perf_test_runner | 47 from pylib.perf import test_runner as perf_test_runner |
| 49 from pylib.results import json_results | 48 from pylib.results import json_results |
| (...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 387 group = parser.add_argument_group('Instrumentation Test Options') | 386 group = parser.add_argument_group('Instrumentation Test Options') |
| 388 AddJavaTestOptions(group) | 387 AddJavaTestOptions(group) |
| 389 | 388 |
| 390 java_or_python_group = group.add_mutually_exclusive_group() | 389 java_or_python_group = group.add_mutually_exclusive_group() |
| 391 java_or_python_group.add_argument( | 390 java_or_python_group.add_argument( |
| 392 '-j', '--java-only', action='store_false', | 391 '-j', '--java-only', action='store_false', |
| 393 dest='run_python_tests', default=True, help='Run only the Java tests.') | 392 dest='run_python_tests', default=True, help='Run only the Java tests.') |
| 394 java_or_python_group.add_argument( | 393 java_or_python_group.add_argument( |
| 395 '-p', '--python-only', action='store_false', | 394 '-p', '--python-only', action='store_false', |
| 396 dest='run_java_tests', default=True, | 395 dest='run_java_tests', default=True, |
| 397 help='Run only the host-driven tests.') | 396 help='DEPRECATED') |
| 398 | 397 |
| 399 group.add_argument('--host-driven-root', | 398 group.add_argument('--host-driven-root', |
| 400 help='Root of the host-driven tests.') | 399 help='DEPRECATED') |
| 401 group.add_argument('-w', '--wait_debugger', dest='wait_for_debugger', | 400 group.add_argument('-w', '--wait_debugger', dest='wait_for_debugger', |
| 402 action='store_true', | 401 action='store_true', |
| 403 help='Wait for debugger.') | 402 help='Wait for debugger.') |
| 404 group.add_argument('--apk-under-test', | 403 group.add_argument('--apk-under-test', |
| 405 help='Path or name of the apk under test.') | 404 help='Path or name of the apk under test.') |
| 406 group.add_argument('--apk-under-test-incremental-install-script', | 405 group.add_argument('--apk-under-test-incremental-install-script', |
| 407 help='Path to install script for the --apk-under-test.') | 406 help='Path to install script for the --apk-under-test.') |
| 408 group.add_argument('--test-apk', required=True, | 407 group.add_argument('--test-apk', required=True, |
| 409 help='Path or name of the apk containing the tests ' | 408 help='Path or name of the apk containing the tests ' |
| 410 '(name is without the .apk extension; ' | 409 '(name is without the .apk extension; ' |
| (...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 757 results = base_test_result.TestRunResults() | 756 results = base_test_result.TestRunResults() |
| 758 exit_code = 0 | 757 exit_code = 0 |
| 759 | 758 |
| 760 if args.run_java_tests: | 759 if args.run_java_tests: |
| 761 java_runner_factory, java_tests = instrumentation_setup.Setup( | 760 java_runner_factory, java_tests = instrumentation_setup.Setup( |
| 762 instrumentation_options, devices) | 761 instrumentation_options, devices) |
| 763 else: | 762 else: |
| 764 java_runner_factory = None | 763 java_runner_factory = None |
| 765 java_tests = None | 764 java_tests = None |
| 766 | 765 |
| 767 if args.run_python_tests: | 766 py_runner_factory = None |
| 768 py_runner_factory, py_tests = host_driven_setup.InstrumentationSetup( | 767 py_tests = None |
| 769 args.host_driven_root, args.official_build, | |
| 770 instrumentation_options) | |
| 771 else: | |
| 772 py_runner_factory = None | |
| 773 py_tests = None | |
| 774 | 768 |
| 775 results = [] | 769 results = [] |
| 776 repetitions = (xrange(args.repeat + 1) if args.repeat >= 0 | 770 repetitions = (xrange(args.repeat + 1) if args.repeat >= 0 |
| 777 else itertools.count()) | 771 else itertools.count()) |
| 778 | 772 |
| 779 code_counts = {constants.INFRA_EXIT_CODE: 0, | 773 code_counts = {constants.INFRA_EXIT_CODE: 0, |
| 780 constants.ERROR_EXIT_CODE: 0, | 774 constants.ERROR_EXIT_CODE: 0, |
| 781 constants.WARNING_EXIT_CODE: 0, | 775 constants.WARNING_EXIT_CODE: 0, |
| 782 0: 0} | 776 0: 0} |
| 783 | 777 |
| (...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1142 if e.is_infra_error: | 1136 if e.is_infra_error: |
| 1143 return constants.INFRA_EXIT_CODE | 1137 return constants.INFRA_EXIT_CODE |
| 1144 return constants.ERROR_EXIT_CODE | 1138 return constants.ERROR_EXIT_CODE |
| 1145 except: # pylint: disable=W0702 | 1139 except: # pylint: disable=W0702 |
| 1146 logging.exception('Unrecognized error occurred.') | 1140 logging.exception('Unrecognized error occurred.') |
| 1147 return constants.ERROR_EXIT_CODE | 1141 return constants.ERROR_EXIT_CODE |
| 1148 | 1142 |
| 1149 | 1143 |
| 1150 if __name__ == '__main__': | 1144 if __name__ == '__main__': |
| 1151 sys.exit(main()) | 1145 sys.exit(main()) |
| OLD | NEW |