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

Side by Side Diff: build/android/test_runner.py

Issue 1397013002: Android test_runner.py: Eliminate unused "adb devices" call for gtests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove unnecessary check Created 5 years, 2 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 903 matching lines...) Expand 10 before | Expand all | Expand 10 after
914 Exception: Unknown command name passed in, or an exception from an 914 Exception: Unknown command name passed in, or an exception from an
915 individual test runner. 915 individual test runner.
916 """ 916 """
917 command = args.command 917 command = args.command
918 918
919 ProcessCommonOptions(args) 919 ProcessCommonOptions(args)
920 920
921 if args.enable_platform_mode: 921 if args.enable_platform_mode:
922 return RunTestsInPlatformMode(args, parser) 922 return RunTestsInPlatformMode(args, parser)
923 923
924 if command in constants.LOCAL_MACHINE_TESTS:
925 devices = []
926 else:
927 devices = _GetAttachedDevices(args.blacklist_file, args.test_device,
928 args.enable_device_cache)
929
930 forwarder.Forwarder.RemoveHostLog() 924 forwarder.Forwarder.RemoveHostLog()
931 if not ports.ResetTestServerPortAllocation(): 925 if not ports.ResetTestServerPortAllocation():
932 raise Exception('Failed to reset test server port.') 926 raise Exception('Failed to reset test server port.')
933 927
928 def get_devices():
jbudorick 2015/10/09 01:06:28 oh, hrm. That wasn't what I meant, but this is fin
929 return _GetAttachedDevices(args.blacklist_file, args.test_device,
930 args.enable_device_cache)
931
934 if command == 'gtest': 932 if command == 'gtest':
935 return RunTestsInPlatformMode(args, parser) 933 return RunTestsInPlatformMode(args, parser)
936 elif command == 'linker': 934 elif command == 'linker':
937 return _RunLinkerTests(args, devices) 935 return _RunLinkerTests(args, get_devices())
938 elif command == 'instrumentation': 936 elif command == 'instrumentation':
939 return _RunInstrumentationTests(args, devices) 937 return _RunInstrumentationTests(args, get_devices())
940 elif command == 'uiautomator': 938 elif command == 'uiautomator':
941 return _RunUIAutomatorTests(args, devices) 939 return _RunUIAutomatorTests(args, get_devices())
942 elif command == 'junit': 940 elif command == 'junit':
943 return _RunJUnitTests(args) 941 return _RunJUnitTests(args)
944 elif command == 'monkey': 942 elif command == 'monkey':
945 return _RunMonkeyTests(args, devices) 943 return _RunMonkeyTests(args, get_devices())
946 elif command == 'perf': 944 elif command == 'perf':
947 return _RunPerfTests(args, devices) 945 return _RunPerfTests(args, get_devices())
948 elif command == 'python': 946 elif command == 'python':
949 return _RunPythonTests(args) 947 return _RunPythonTests(args)
950 else: 948 else:
951 raise Exception('Unknown test type.') 949 raise Exception('Unknown test type.')
952 950
953 951
954 _SUPPORTED_IN_PLATFORM_MODE = [ 952 _SUPPORTED_IN_PLATFORM_MODE = [
955 # TODO(jbudorick): Add support for more test types. 953 # TODO(jbudorick): Add support for more test types.
956 'gtest', 954 'gtest',
957 'instrumentation', 955 'instrumentation',
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
1056 if e.is_infra_error: 1054 if e.is_infra_error:
1057 return constants.INFRA_EXIT_CODE 1055 return constants.INFRA_EXIT_CODE
1058 return constants.ERROR_EXIT_CODE 1056 return constants.ERROR_EXIT_CODE
1059 except: # pylint: disable=W0702 1057 except: # pylint: disable=W0702
1060 logging.exception('Unrecognized error occurred.') 1058 logging.exception('Unrecognized error occurred.')
1061 return constants.ERROR_EXIT_CODE 1059 return constants.ERROR_EXIT_CODE
1062 1060
1063 1061
1064 if __name__ == '__main__': 1062 if __name__ == '__main__':
1065 sys.exit(main()) 1063 sys.exit(main())
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698