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 |
11 import logging | 11 import logging |
12 import os | 12 import os |
13 import shutil | 13 import shutil |
14 import signal | 14 import signal |
15 import sys | 15 import sys |
16 import threading | 16 import threading |
17 import unittest | 17 import unittest |
18 | 18 |
19 from pylib import constants | 19 from pylib import constants |
20 from pylib import forwarder | 20 from pylib import forwarder |
21 from pylib import ports | 21 from pylib import ports |
22 from pylib.base import base_test_result | 22 from pylib.base import base_test_result |
23 from pylib.base import environment_factory | 23 from pylib.base import environment_factory |
24 from pylib.base import test_dispatcher | 24 from pylib.base import test_dispatcher |
25 from pylib.base import test_instance_factory | 25 from pylib.base import test_instance_factory |
26 from pylib.base import test_run_factory | 26 from pylib.base import test_run_factory |
27 from pylib.device import device_errors | 27 from pylib.device import device_errors |
28 from pylib.device import device_utils | 28 from pylib.device import device_utils |
29 from pylib.gtest import gtest_config | 29 from pylib.gtest import gtest_config |
30 # TODO(jbudorick): Remove this once we stop selectively enabling platform mode. | |
31 from pylib.gtest import gtest_test_instance | |
32 from pylib.gtest import setup as gtest_setup | 30 from pylib.gtest import setup as gtest_setup |
33 from pylib.gtest import test_options as gtest_test_options | 31 from pylib.gtest import test_options as gtest_test_options |
34 from pylib.linker import setup as linker_setup | 32 from pylib.linker import setup as linker_setup |
35 from pylib.host_driven import setup as host_driven_setup | 33 from pylib.host_driven import setup as host_driven_setup |
36 from pylib.instrumentation import setup as instrumentation_setup | 34 from pylib.instrumentation import setup as instrumentation_setup |
37 from pylib.instrumentation import test_options as instrumentation_test_options | 35 from pylib.instrumentation import test_options as instrumentation_test_options |
38 from pylib.junit import setup as junit_setup | 36 from pylib.junit import setup as junit_setup |
39 from pylib.junit import test_dispatcher as junit_dispatcher | 37 from pylib.junit import test_dispatcher as junit_dispatcher |
40 from pylib.monkey import setup as monkey_setup | 38 from pylib.monkey import setup as monkey_setup |
41 from pylib.monkey import test_options as monkey_test_options | 39 from pylib.monkey import test_options as monkey_test_options |
(...skipping 872 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
914 if command in constants.LOCAL_MACHINE_TESTS: | 912 if command in constants.LOCAL_MACHINE_TESTS: |
915 devices = [] | 913 devices = [] |
916 else: | 914 else: |
917 devices = _GetAttachedDevices(args.test_device) | 915 devices = _GetAttachedDevices(args.test_device) |
918 | 916 |
919 forwarder.Forwarder.RemoveHostLog() | 917 forwarder.Forwarder.RemoveHostLog() |
920 if not ports.ResetTestServerPortAllocation(): | 918 if not ports.ResetTestServerPortAllocation(): |
921 raise Exception('Failed to reset test server port.') | 919 raise Exception('Failed to reset test server port.') |
922 | 920 |
923 if command == 'gtest': | 921 if command == 'gtest': |
924 if args.suite_name[0] in gtest_test_instance.BROWSER_TEST_SUITES: | |
925 return RunTestsInPlatformMode(args, parser) | |
926 return _RunGTests(args, devices) | 922 return _RunGTests(args, devices) |
927 elif command == 'linker': | 923 elif command == 'linker': |
928 return _RunLinkerTests(args, devices) | 924 return _RunLinkerTests(args, devices) |
929 elif command == 'instrumentation': | 925 elif command == 'instrumentation': |
930 return _RunInstrumentationTests(args, devices) | 926 return _RunInstrumentationTests(args, devices) |
931 elif command == 'uiautomator': | 927 elif command == 'uiautomator': |
932 return _RunUIAutomatorTests(args, devices) | 928 return _RunUIAutomatorTests(args, devices) |
933 elif command == 'junit': | 929 elif command == 'junit': |
934 return _RunJUnitTests(args) | 930 return _RunJUnitTests(args) |
935 elif command == 'monkey': | 931 elif command == 'monkey': |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1039 if e.is_infra_error: | 1035 if e.is_infra_error: |
1040 return constants.INFRA_EXIT_CODE | 1036 return constants.INFRA_EXIT_CODE |
1041 return constants.ERROR_EXIT_CODE | 1037 return constants.ERROR_EXIT_CODE |
1042 except: # pylint: disable=W0702 | 1038 except: # pylint: disable=W0702 |
1043 logging.exception('Unrecognized error occurred.') | 1039 logging.exception('Unrecognized error occurred.') |
1044 return constants.ERROR_EXIT_CODE | 1040 return constants.ERROR_EXIT_CODE |
1045 | 1041 |
1046 | 1042 |
1047 if __name__ == '__main__': | 1043 if __name__ == '__main__': |
1048 sys.exit(main()) | 1044 sys.exit(main()) |
OLD | NEW |