Chromium Code Reviews| 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 895 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 906 Integer indicated exit code. | 906 Integer indicated exit code. |
| 907 | 907 |
| 908 Raises: | 908 Raises: |
| 909 Exception: Unknown command name passed in, or an exception from an | 909 Exception: Unknown command name passed in, or an exception from an |
| 910 individual test runner. | 910 individual test runner. |
| 911 """ | 911 """ |
| 912 command = args.command | 912 command = args.command |
| 913 | 913 |
| 914 ProcessCommonOptions(args) | 914 ProcessCommonOptions(args) |
| 915 | 915 |
| 916 if args.enable_platform_mode: | 916 if args.enable_platform_mode: |
|
jbudorick
2015/10/09 00:28:48
alternatively, we could just switch this to
if
agrieve
2015/10/09 00:58:54
Interesting! Sounds good except with the change as
| |
| 917 return RunTestsInPlatformMode(args, parser) | 917 return RunTestsInPlatformMode(args, parser) |
| 918 | 918 |
| 919 if command in constants.LOCAL_MACHINE_TESTS: | |
| 920 devices = [] | |
| 921 else: | |
| 922 devices = _GetAttachedDevices(args.blacklist_file, args.test_device) | |
| 923 | |
| 924 forwarder.Forwarder.RemoveHostLog() | 919 forwarder.Forwarder.RemoveHostLog() |
| 925 if not ports.ResetTestServerPortAllocation(): | 920 if not ports.ResetTestServerPortAllocation(): |
| 926 raise Exception('Failed to reset test server port.') | 921 raise Exception('Failed to reset test server port.') |
| 927 | 922 |
| 923 def get_devices(): | |
| 924 if command in constants.LOCAL_MACHINE_TESTS: | |
| 925 return [] | |
| 926 return _GetAttachedDevices(args.blacklist_file, args.test_device) | |
| 927 | |
| 928 if command == 'gtest': | 928 if command == 'gtest': |
| 929 return RunTestsInPlatformMode(args, parser) | 929 return RunTestsInPlatformMode(args, parser) |
| 930 elif command == 'linker': | 930 elif command == 'linker': |
| 931 return _RunLinkerTests(args, devices) | 931 return _RunLinkerTests(args, get_devices()) |
| 932 elif command == 'instrumentation': | 932 elif command == 'instrumentation': |
| 933 return _RunInstrumentationTests(args, devices) | 933 return _RunInstrumentationTests(args, get_devices()) |
| 934 elif command == 'uiautomator': | 934 elif command == 'uiautomator': |
| 935 return _RunUIAutomatorTests(args, devices) | 935 return _RunUIAutomatorTests(args, get_devices()) |
| 936 elif command == 'junit': | 936 elif command == 'junit': |
| 937 return _RunJUnitTests(args) | 937 return _RunJUnitTests(args) |
| 938 elif command == 'monkey': | 938 elif command == 'monkey': |
| 939 return _RunMonkeyTests(args, devices) | 939 return _RunMonkeyTests(args, get_devices()) |
| 940 elif command == 'perf': | 940 elif command == 'perf': |
| 941 return _RunPerfTests(args, devices) | 941 return _RunPerfTests(args, get_devices()) |
| 942 elif command == 'python': | 942 elif command == 'python': |
| 943 return _RunPythonTests(args) | 943 return _RunPythonTests(args) |
| 944 else: | 944 else: |
| 945 raise Exception('Unknown test type.') | 945 raise Exception('Unknown test type.') |
| 946 | 946 |
| 947 | 947 |
| 948 _SUPPORTED_IN_PLATFORM_MODE = [ | 948 _SUPPORTED_IN_PLATFORM_MODE = [ |
| 949 # TODO(jbudorick): Add support for more test types. | 949 # TODO(jbudorick): Add support for more test types. |
| 950 'gtest', | 950 'gtest', |
| 951 'instrumentation', | 951 'instrumentation', |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1050 if e.is_infra_error: | 1050 if e.is_infra_error: |
| 1051 return constants.INFRA_EXIT_CODE | 1051 return constants.INFRA_EXIT_CODE |
| 1052 return constants.ERROR_EXIT_CODE | 1052 return constants.ERROR_EXIT_CODE |
| 1053 except: # pylint: disable=W0702 | 1053 except: # pylint: disable=W0702 |
| 1054 logging.exception('Unrecognized error occurred.') | 1054 logging.exception('Unrecognized error occurred.') |
| 1055 return constants.ERROR_EXIT_CODE | 1055 return constants.ERROR_EXIT_CODE |
| 1056 | 1056 |
| 1057 | 1057 |
| 1058 if __name__ == '__main__': | 1058 if __name__ == '__main__': |
| 1059 sys.exit(main()) | 1059 sys.exit(main()) |
| OLD | NEW |