OLD | NEW |
1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import logging | 5 import logging |
6 import psutil | 6 import psutil |
7 import signal | 7 import signal |
8 | 8 |
9 from pylib import android_commands | 9 from pylib import android_commands |
10 from pylib.device import device_errors | 10 from pylib.device import device_errors |
(...skipping 13 matching lines...) Expand all Loading... |
24 signalled.append(p) | 24 signalled.append(p) |
25 except Exception as e: | 25 except Exception as e: |
26 logging.warning('Failed killing %s %s %s', server, p.pid, e) | 26 logging.warning('Failed killing %s %s %s', server, p.pid, e) |
27 for p in signalled: | 27 for p in signalled: |
28 try: | 28 try: |
29 p.wait(1) | 29 p.wait(1) |
30 except Exception as e: | 30 except Exception as e: |
31 logging.warning('Failed waiting for %s to die. %s', p.pid, e) | 31 logging.warning('Failed waiting for %s to die. %s', p.pid, e) |
32 | 32 |
33 | 33 |
34 | |
35 def CleanupLeftoverProcesses(): | 34 def CleanupLeftoverProcesses(): |
36 """Clean up the test environment, restarting fresh adb and HTTP daemons.""" | 35 """Clean up the test environment, restarting fresh adb and HTTP daemons.""" |
37 _KillWebServers() | 36 _KillWebServers() |
38 did_restart_host_adb = False | 37 did_restart_host_adb = False |
| 38 # TODO(jbudorick) Implement this with the device parallelizer utility. |
39 for device_serial in android_commands.GetAttachedDevices(): | 39 for device_serial in android_commands.GetAttachedDevices(): |
40 device = device_utils.DeviceUtils(device_serial) | 40 device = device_utils.DeviceUtils(device_serial) |
41 # Make sure we restart the host adb server only once. | 41 # Make sure we restart the host adb server only once. |
42 if not did_restart_host_adb: | 42 if not did_restart_host_adb: |
43 device_utils.RestartServer() | 43 device_utils.RestartServer() |
44 did_restart_host_adb = True | 44 did_restart_host_adb = True |
45 device.old_interface.RestartAdbdOnDevice() | 45 device.old_interface.RestartAdbdOnDevice() |
46 try: | 46 try: |
47 device.EnableRoot() | 47 device.EnableRoot() |
48 except device_errors.CommandFailedError as e: | 48 except device_errors.CommandFailedError as e: |
49 # TODO(jbudorick) Handle this exception appropriately after interface | 49 # TODO(jbudorick) Handle this exception appropriately after interface |
50 # conversions are finished. | 50 # conversions are finished. |
51 logging.error(str(e)) | 51 logging.error(str(e)) |
52 device.old_interface.WaitForDevicePm() | 52 device.WaitUntilFullyBooted() |
53 | 53 |
OLD | NEW |