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

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

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