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

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

Issue 1105323002: [Android] Remove more uses of android_commands from build/android/pylib. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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 | « build/android/pylib/utils/emulator.py ('k') | 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
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 android_commands
20 from pylib import constants 19 from pylib import constants
21 from pylib import forwarder 20 from pylib import forwarder
22 from pylib import ports 21 from pylib import ports
23 from pylib.base import base_test_result 22 from pylib.base import base_test_result
24 from pylib.base import environment_factory 23 from pylib.base import environment_factory
25 from pylib.base import test_dispatcher 24 from pylib.base import test_dispatcher
26 from pylib.base import test_instance_factory 25 from pylib.base import test_instance_factory
27 from pylib.base import test_run_factory 26 from pylib.base import test_run_factory
27 from pylib.device import device_errors
28 from pylib.device import device_utils
28 from pylib.gtest import gtest_config 29 from pylib.gtest import gtest_config
29 from pylib.gtest import setup as gtest_setup 30 from pylib.gtest import setup as gtest_setup
30 from pylib.gtest import test_options as gtest_test_options 31 from pylib.gtest import test_options as gtest_test_options
31 from pylib.linker import setup as linker_setup 32 from pylib.linker import setup as linker_setup
32 from pylib.host_driven import setup as host_driven_setup 33 from pylib.host_driven import setup as host_driven_setup
33 from pylib.instrumentation import setup as instrumentation_setup 34 from pylib.instrumentation import setup as instrumentation_setup
34 from pylib.instrumentation import test_options as instrumentation_test_options 35 from pylib.instrumentation import test_options as instrumentation_test_options
35 from pylib.junit import setup as junit_setup 36 from pylib.junit import setup as junit_setup
36 from pylib.junit import test_dispatcher as junit_dispatcher 37 from pylib.junit import test_dispatcher as junit_dispatcher
37 from pylib.monkey import setup as monkey_setup 38 from pylib.monkey import setup as monkey_setup
(...skipping 822 matching lines...) Expand 10 before | Expand all | Expand 10 after
860 861
861 def _GetAttachedDevices(test_device=None): 862 def _GetAttachedDevices(test_device=None):
862 """Get all attached devices. 863 """Get all attached devices.
863 864
864 Args: 865 Args:
865 test_device: Name of a specific device to use. 866 test_device: Name of a specific device to use.
866 867
867 Returns: 868 Returns:
868 A list of attached devices. 869 A list of attached devices.
869 """ 870 """
870 attached_devices = [] 871 attached_devices = device_utils.DeviceUtils.HealthyDevices()
872 if test_device:
873 test_device = [d for d in attached_devices if d == test_device]
874 if not test_device:
875 raise device_errors.DeviceUnreachableError(
876 'Did not find device %s among attached device. Attached devices: %s'
877 % (test_device, ', '.join(attached_devices)))
871 878
872 attached_devices = android_commands.GetAttachedDevices() 879 if not attached_devices:
873 if test_device: 880 raise device_errors.NoDevicesError()
874 assert test_device in attached_devices, (
875 'Did not find device %s among attached device. Attached devices: %s'
876 % (test_device, ', '.join(attached_devices)))
877 attached_devices = [test_device]
878
879 assert attached_devices, 'No devices attached.'
880 881
881 return sorted(attached_devices) 882 return sorted(attached_devices)
882 883
883 884
884 def RunTestsCommand(args, parser): 885 def RunTestsCommand(args, parser):
885 """Checks test type and dispatches to the appropriate function. 886 """Checks test type and dispatches to the appropriate function.
886 887
887 Args: 888 Args:
888 args: argparse.Namespace object. 889 args: argparse.Namespace object.
889 parser: argparse.ArgumentParser object. 890 parser: argparse.ArgumentParser object.
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
1029 return constants.INFRA_EXIT_CODE 1030 return constants.INFRA_EXIT_CODE
1030 else: 1031 else:
1031 return constants.ERROR_EXIT_CODE 1032 return constants.ERROR_EXIT_CODE
1032 except: # pylint: disable=W0702 1033 except: # pylint: disable=W0702
1033 logging.exception('Unrecognized error occurred.') 1034 logging.exception('Unrecognized error occurred.')
1034 return constants.ERROR_EXIT_CODE 1035 return constants.ERROR_EXIT_CODE
1035 1036
1036 1037
1037 if __name__ == '__main__': 1038 if __name__ == '__main__':
1038 sys.exit(main()) 1039 sys.exit(main())
OLDNEW
« no previous file with comments | « build/android/pylib/utils/emulator.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698