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 |
30 from pylib.gtest import setup as gtest_setup | 32 from pylib.gtest import setup as gtest_setup |
31 from pylib.gtest import test_options as gtest_test_options | 33 from pylib.gtest import test_options as gtest_test_options |
32 from pylib.linker import setup as linker_setup | 34 from pylib.linker import setup as linker_setup |
33 from pylib.host_driven import setup as host_driven_setup | 35 from pylib.host_driven import setup as host_driven_setup |
34 from pylib.instrumentation import setup as instrumentation_setup | 36 from pylib.instrumentation import setup as instrumentation_setup |
35 from pylib.instrumentation import test_options as instrumentation_test_options | 37 from pylib.instrumentation import test_options as instrumentation_test_options |
36 from pylib.junit import setup as junit_setup | 38 from pylib.junit import setup as junit_setup |
37 from pylib.junit import test_dispatcher as junit_dispatcher | 39 from pylib.junit import test_dispatcher as junit_dispatcher |
38 from pylib.monkey import setup as monkey_setup | 40 from pylib.monkey import setup as monkey_setup |
39 from pylib.monkey import test_options as monkey_test_options | 41 from pylib.monkey import test_options as monkey_test_options |
(...skipping 872 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
912 if command in constants.LOCAL_MACHINE_TESTS: | 914 if command in constants.LOCAL_MACHINE_TESTS: |
913 devices = [] | 915 devices = [] |
914 else: | 916 else: |
915 devices = _GetAttachedDevices(args.test_device) | 917 devices = _GetAttachedDevices(args.test_device) |
916 | 918 |
917 forwarder.Forwarder.RemoveHostLog() | 919 forwarder.Forwarder.RemoveHostLog() |
918 if not ports.ResetTestServerPortAllocation(): | 920 if not ports.ResetTestServerPortAllocation(): |
919 raise Exception('Failed to reset test server port.') | 921 raise Exception('Failed to reset test server port.') |
920 | 922 |
921 if command == 'gtest': | 923 if command == 'gtest': |
| 924 if args.suite_name[0] in gtest_test_instance.BROWSER_TEST_SUITES: |
| 925 return RunTestsInPlatformMode(args, parser) |
922 return _RunGTests(args, devices) | 926 return _RunGTests(args, devices) |
923 elif command == 'linker': | 927 elif command == 'linker': |
924 return _RunLinkerTests(args, devices) | 928 return _RunLinkerTests(args, devices) |
925 elif command == 'instrumentation': | 929 elif command == 'instrumentation': |
926 return _RunInstrumentationTests(args, devices) | 930 return _RunInstrumentationTests(args, devices) |
927 elif command == 'uiautomator': | 931 elif command == 'uiautomator': |
928 return _RunUIAutomatorTests(args, devices) | 932 return _RunUIAutomatorTests(args, devices) |
929 elif command == 'junit': | 933 elif command == 'junit': |
930 return _RunJUnitTests(args) | 934 return _RunJUnitTests(args) |
931 elif command == 'monkey': | 935 elif command == 'monkey': |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1035 if e.is_infra_error: | 1039 if e.is_infra_error: |
1036 return constants.INFRA_EXIT_CODE | 1040 return constants.INFRA_EXIT_CODE |
1037 return constants.ERROR_EXIT_CODE | 1041 return constants.ERROR_EXIT_CODE |
1038 except: # pylint: disable=W0702 | 1042 except: # pylint: disable=W0702 |
1039 logging.exception('Unrecognized error occurred.') | 1043 logging.exception('Unrecognized error occurred.') |
1040 return constants.ERROR_EXIT_CODE | 1044 return constants.ERROR_EXIT_CODE |
1041 | 1045 |
1042 | 1046 |
1043 if __name__ == '__main__': | 1047 if __name__ == '__main__': |
1044 sys.exit(main()) | 1048 sys.exit(main()) |
OLD | NEW |